[BUG] [typescript-axios] Generated project does not compile with the supportsES6 option
Created by: ditsuke
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
Have you tested with the latest master to confirm the issue still exists? -
Have you searched for related issues/PRs?
Description
Client generated by the typescript-axios
compiler does not compile if used with the generator's supportsES6
options set to true.
openapi-generator version
6.0.1-SNAPSHOT
OpenAPI declaration file content or url
https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v2.0/yaml/petstore.yaml
Generation Details
- Generator:
typescript-axios
- Configuration:
npmName: petstore_tsax_gen supportsES6: true
- Full command:
generate -i petstore.yaml -g typescript-axios -o out/ts-axios -c config.yaml
Steps to reproduce
- Run
npm install
in the generated typescript project. This will first install dependencies then try to build the project withtsc
- Build step output:
api.ts:17:78 - error ts2792: cannot find module 'axios'. did you mean to set the 'moduleresolution' option to 'node', or to add aliases to the 'paths' option? 17 import globalaxios, { axiospromise, axiosinstance, axiosrequestconfig } from 'axios'; ~~~~~~~ common.ts:18:46 - error ts2792: cannot find module 'axios'. did you mean to set the 'moduleresolution' option to 'node', or to add aliases to the 'paths' option? 18 import { axiosinstance, axiosresponse } from 'axios'; ~~~~~~~ found 2 errors in 2 files. errors files 1 api.ts:17 1 common.ts:18
Related issues/PRs
Suggest a fix
Set "moduleResolution": "Node"
in the tsconfig compiler options.
I'll be happy to open a PR.