mtennoe / swagger-typescript-codegen

A Swagger Codegenerator tailored for typescript.
Apache License 2.0
140 stars 52 forks source link

[question] Webpack compilation errors #88

Closed OndraRehounek closed 5 years ago

OndraRehounek commented 5 years ago

Hi,

first of all, thank you for maintaining this repo. I've recently started using this tool in my Nuxt Typescript project and I am getting errors during compilation in options.d.ts file

ERROR in /home/ondra/Projects/cluster/endevel/endcode/src/end/services/cars/front/node_modules/swagger-typescript-codegen/lib/options/options.d.ts                              
1:23 Cannot find type definition file for 'js-beautify'.

ERROR in /home/ondra/Projects/cluster/endevel/endcode/src/end/services/cars/front/node_modules/swagger-typescript-codegen/lib/options/options.d.ts                 
18:31 Cannot find name 'JsBeautifyOptions'.

After hours of searching I was unable to resolve the issue (unless I simple comment out errored lines) - I am wondering if someone has similar issue...

Maybe there is some specific webpack/Nuxt config needed... do you have any experience with this kind of issue?

Markionium commented 5 years ago

Hey @OndraRehounek,

Sorry for the slow reply. Summer here in Norway is pretty slow. A bunch of people in the office are on holiday and I'm somewhat low on bandwidth ;). Thank you for the thank you! :D

It seems like we might need to add some @types to the dependencies.

Could you try to install the types for beautify? npm install @types/js-beautify@^1.8.0 or yarn add @types/js-beautify@^1.8.0

https://github.com/mtennoe/swagger-typescript-codegen/blob/master/package.json#L47

I think that might resolve your issue? If not could you perhaps share your tsconfig.json file?

OndraRehounek commented 5 years ago

Hi @Markionium

thank you very much for the reply

npm install @types/js-beautify@^1.8.0 worked perfectly :100:

Enjoy summer in Norway :)