Skip to content

Commit 8d8e3dd

Browse files
authored
fix(typescript-fetch): use type modifier on imports for discriminator.mappedModels (#21397)
* typescript-fetch: use `type` modifier on imports for `discriminator.mappedModels` This ensures that the generated code works when `--verbatimModuleSyntax` is enabled for the TypeScript compiler. Regular imports already use the `type` modifier, so this should not be a breaking change. * update samples
1 parent 623463a commit 8d8e3dd

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
{{/hasImports}}
1414
{{#discriminator}}
1515
{{#discriminator.mappedModels}}
16-
import { {{modelName}}, {{modelName}}FromJSONTyped, {{modelName}}ToJSON, {{modelName}}ToJSONTyped } from './{{modelName}}{{importFileExtension}}';
16+
import { type {{modelName}}, {{modelName}}FromJSONTyped, {{modelName}}ToJSON, {{modelName}}ToJSONTyped } from './{{modelName}}{{importFileExtension}}';
1717
{{/discriminator.mappedModels}}
1818
{{/discriminator}}
1919
{{>modelGenericInterfaces}}

samples/client/others/typescript-fetch/self-import-issue/models/AbstractUserDto.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import {
2121
BranchDtoToJSONTyped,
2222
} from './BranchDto';
2323

24-
import { InternalAuthenticatedUserDto, InternalAuthenticatedUserDtoFromJSONTyped, InternalAuthenticatedUserDtoToJSON, InternalAuthenticatedUserDtoToJSONTyped } from './InternalAuthenticatedUserDto';
25-
import { RemoteAuthenticatedUserDto, RemoteAuthenticatedUserDtoFromJSONTyped, RemoteAuthenticatedUserDtoToJSON, RemoteAuthenticatedUserDtoToJSONTyped } from './RemoteAuthenticatedUserDto';
24+
import { type InternalAuthenticatedUserDto, InternalAuthenticatedUserDtoFromJSONTyped, InternalAuthenticatedUserDtoToJSON, InternalAuthenticatedUserDtoToJSONTyped } from './InternalAuthenticatedUserDto';
25+
import { type RemoteAuthenticatedUserDto, RemoteAuthenticatedUserDtoFromJSONTyped, RemoteAuthenticatedUserDtoToJSON, RemoteAuthenticatedUserDtoToJSONTyped } from './RemoteAuthenticatedUserDto';
2626
/**
2727
*
2828
* @export

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
*/
1414

1515
import { mapValues } from '../runtime';
16-
import { Cat, CatFromJSONTyped, CatToJSON, CatToJSONTyped } from './Cat';
17-
import { Dog, DogFromJSONTyped, DogToJSON, DogToJSONTyped } from './Dog';
16+
import { type Cat, CatFromJSONTyped, CatToJSON, CatToJSONTyped } from './Cat';
17+
import { type Dog, DogFromJSONTyped, DogToJSON, DogToJSONTyped } from './Dog';
1818
/**
1919
*
2020
* @export

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

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

1515
import { mapValues } from '../runtime';
16-
import { ChildWithNullable, ChildWithNullableFromJSONTyped, ChildWithNullableToJSON, ChildWithNullableToJSONTyped } from './ChildWithNullable';
16+
import { type ChildWithNullable, ChildWithNullableFromJSONTyped, ChildWithNullableToJSON, ChildWithNullableToJSONTyped } from './ChildWithNullable';
1717
/**
1818
*
1919
* @export

samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Animal.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
*/
1414

1515
import { mapValues } from '../runtime';
16-
import { Cat, CatFromJSONTyped, CatToJSON, CatToJSONTyped } from './Cat';
17-
import { Dog, DogFromJSONTyped, DogToJSON, DogToJSONTyped } from './Dog';
16+
import { type Cat, CatFromJSONTyped, CatToJSON, CatToJSONTyped } from './Cat';
17+
import { type Dog, DogFromJSONTyped, DogToJSON, DogToJSONTyped } from './Dog';
1818
/**
1919
*
2020
* @export

0 commit comments

Comments
 (0)