[BUG] [TypeScript] Generated TypeScript dependency version conflict when generated module nested in another project
Created by: karlvr
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? - [HEAD] 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
TypeScript looks in parent folders for node_modules/@types
folders from which to load type definitions. If you nest the openapi generated TypeScript module in subfolder of a folder containing a node_modules
which depends upon a later version of TypeScript, then when building the generated module, TypeScript finds the other node_modules/@types
, tries to load them and fails.
openapi-generator version
HEAD (4.0.0). It is not a regression.
Steps to reproduce
npm init -y
npm install -D @types/jest
mkdir gen
openapi-generator generate -i http://petstore.swagger.io/v2/swagger.json -g typescript-fetch -o gen
cd gen
tsc
The tsc
command fails due to the types that it doesn't understand.
Related issues/PRs
I am about to push a PR.