Skip to content

Commit 55d9231

Browse files
using import type instead of import for types imports (#12534)
1 parent 726765a commit 55d9231

68 files changed

Lines changed: 192 additions & 124 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,19 @@
44

55
import * as runtime from '../runtime';
66
{{#imports.0}}
7+
import type {
8+
{{#imports}}
9+
{{className}},
10+
{{/imports}}
11+
} from '../models';
12+
{{^withoutRuntimeChecks}}
713
import {
814
{{#imports}}
9-
{{className}},
10-
{{^withoutRuntimeChecks}}
1115
{{className}}FromJSON,
1216
{{className}}ToJSON,
13-
{{/withoutRuntimeChecks}}
1417
{{/imports}}
1518
} from '../models';
19+
{{/withoutRuntimeChecks}}
1620
{{/imports.0}}
1721

1822
{{#operations}}

modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { exists, mapValues } from '../runtime';
22
{{#hasImports}}
33
{{#imports}}
4+
import type { {{{.}}} } from './{{.}}';
45
import {
5-
{{{.}}},
66
{{.}}FromJSON,
77
{{.}}FromJSONTyped,
88
{{.}}ToJSON,

samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/AnotherFakeApi.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414

1515

1616
import * as runtime from '../runtime';
17+
import type {
18+
Client,
19+
} from '../models';
1720
import {
18-
Client,
1921
ClientFromJSON,
2022
ClientToJSON,
2123
} from '../models';

samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/DefaultApi.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414

1515

1616
import * as runtime from '../runtime';
17+
import type {
18+
FooGetDefaultResponse,
19+
} from '../models';
1720
import {
18-
FooGetDefaultResponse,
1921
FooGetDefaultResponseFromJSON,
2022
FooGetDefaultResponseToJSON,
2123
} from '../models';

samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,31 @@
1414

1515

1616
import * as runtime from '../runtime';
17+
import type {
18+
Client,
19+
EnumClass,
20+
FileSchemaTestClass,
21+
HealthCheckResult,
22+
OuterComposite,
23+
OuterObjectWithEnumProperty,
24+
Pet,
25+
User,
26+
} from '../models';
1727
import {
18-
Client,
1928
ClientFromJSON,
2029
ClientToJSON,
21-
EnumClass,
2230
EnumClassFromJSON,
2331
EnumClassToJSON,
24-
FileSchemaTestClass,
2532
FileSchemaTestClassFromJSON,
2633
FileSchemaTestClassToJSON,
27-
HealthCheckResult,
2834
HealthCheckResultFromJSON,
2935
HealthCheckResultToJSON,
30-
OuterComposite,
3136
OuterCompositeFromJSON,
3237
OuterCompositeToJSON,
33-
OuterObjectWithEnumProperty,
3438
OuterObjectWithEnumPropertyFromJSON,
3539
OuterObjectWithEnumPropertyToJSON,
36-
Pet,
3740
PetFromJSON,
3841
PetToJSON,
39-
User,
4042
UserFromJSON,
4143
UserToJSON,
4244
} from '../models';

samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeClassnameTags123Api.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414

1515

1616
import * as runtime from '../runtime';
17+
import type {
18+
Client,
19+
} from '../models';
1720
import {
18-
Client,
1921
ClientFromJSON,
2022
ClientToJSON,
2123
} from '../models';

samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414

1515

1616
import * as runtime from '../runtime';
17+
import type {
18+
ModelApiResponse,
19+
Pet,
20+
} from '../models';
1721
import {
18-
ModelApiResponse,
1922
ModelApiResponseFromJSON,
2023
ModelApiResponseToJSON,
21-
Pet,
2224
PetFromJSON,
2325
PetToJSON,
2426
} from '../models';

samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/StoreApi.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414

1515

1616
import * as runtime from '../runtime';
17+
import type {
18+
Order,
19+
} from '../models';
1720
import {
18-
Order,
1921
OrderFromJSON,
2022
OrderToJSON,
2123
} from '../models';

samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/UserApi.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414

1515

1616
import * as runtime from '../runtime';
17+
import type {
18+
User,
19+
} from '../models';
1720
import {
18-
User,
1921
UserFromJSON,
2022
UserToJSON,
2123
} from '../models';

samples/client/petstore/typescript-fetch/builds/default-v3.0/models/AllOfWithSingleRef.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
*/
1414

1515
import { exists, mapValues } from '../runtime';
16+
import type { SingleRefType } from './SingleRefType';
1617
import {
17-
SingleRefType,
1818
SingleRefTypeFromJSON,
1919
SingleRefTypeFromJSONTyped,
2020
SingleRefTypeToJSON,

0 commit comments

Comments
 (0)