-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Open
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- What's the version of OpenAPI Generator used?
- Have you search for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Bounty to sponsor the fix (example)
Description
Using the new TypeScript generator from #6341
The generated code is not compatible with --isolatedModules
, which is required by popular setups such as create-react-app
.
openapi-generator version
5.0.0-SNAPSHOT
OpenAPI declaration file content or url
Command line used for generation
OPENAPI_GENERATOR_VERSION=5.0.0-SNAPSHOT /tmp/openapi-generator-cli.sh generate -g typescript -i example.yaml -o ./src/api
Steps to reproduce
git clone https://github.com/bard/repro-openapi-generator-typescript-isolated-modules/blob/master/example.yaml
OPENAPI_GENERATOR_VERSION=5.0.0-SNAPSHOT /tmp/openapi-generator-cli.sh generate -g typescript -i example.yaml -o ./src/api
yarn && yarn start
Failed to compile.
/tmp/repro-openapi-generator-typescript-isolated-modules/src/api/index.ts
TypeScript error in /tmp/repro-openapi-generator-typescript-isolated-modules/src/api/index.ts(4,31):
Cannot re-export a type when the '--isolatedModules' flag is provided. TS1205
2 | export * from "./auth/auth";
3 | export * from "./models/all";
> 4 | export { createConfiguration, Configuration } from "./configuration"
| ^
5 | export * from "./apis/exception";
6 | export * from "./servers";
7 |
Related issues/PRs
facebook/create-react-app#6054
Suggest a fix
Possible workaround is to export *
from index.ts
:
export * from "./http/http";
export * from "./auth/auth";
export * from "./models/all";
- export { createConfiguration, Configuration } from "./configuration"
+ export * from "./configuration"
export * from "./apis/exception";
export * from "./servers";
fpoppinga, eternalphane, yasaichi, Drago92, jase88 and 2 more