completecoding / serverless-auto-swagger

80 stars 48 forks source link

type script with serverless.yml #103

Closed DeanZahavy closed 2 years ago

DeanZahavy commented 2 years ago

Thank you for your amazing work on this plugin, it makes life much easier :)

i have an issue with importing the plugin on type script services. after installing and adding the plugin,

image image

when the service upload the tsconfig tries to access swager-html.ts while your plugin accept only JS files.

image

to solver this for now i created a new plugin that copy you JS output into a TS file. but i am sure this is redundant, have any suggestion on how to create TS files using your plugin?

my tsconfig file-

image

agin thank you for the amazing work

bfaulk96 commented 2 years ago

If serverless is looking for swagger-html.ts, it's something wrong with your tsconfig or serverless setup, not serverless-auto-swagger. I can confirm this plugin works fine with Typescript, as we use it in ~30 APIs at my current workplace. Unfortunately, I don't really know what would be causing that in your setup, nor do I have time to debug without a minimal reproducible example.

To further clarify, I don't think it's the fault of your tsconfig, either. That looks very similar to what we use. I can't really point you in the right direction as I don't know the rest of the setup, but this plugin should work with typical setups simply by including that allowJs: true that you have in your tsconfig.