You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The advantages of the above setup (for us) is we can then configure cfn-lint tool to run against the entire /resources folder and validate the template chunks. With the help of VSCode plugins, we also get Intellisense that is context dependent on the raw resource type + links to relevant AWS docs, both which help a lot.
Problem
I tried to convert the serverless.yml template to TypeScript and I ran into issues with the file references to the raw resource templates. I do not want to convert the resource definitions to TypeScript, because I would lose the cfn-lint support.
The following works (but does not compile with the current @serverless/typescript definitions):
So to summarize, the type of resources should be changed to a union type that acccepts T | T[], where T = (the current type of resources entry + string type).
Obviously, if there is a better way that I did not see, I'm open to suggestions.
The text was updated successfully, but these errors were encountered:
Thanks for raising this issue @coyoteecd.
The problem you're pointing out actually extend to all definition file properties where serverless variables can be used. This issue was raised in #11
Please bear in mind that types exported from this repository are auto-generated, you cannot modify them manually. The only persistent way to introduce this kind of modification is using a custom compiler pass in the generation library. PR are more than welcome on #11 and #1 which is the first blocker.
Use case
Our existing serverless.yml files reference (partial) CloudFormation templates defined separately, as follows:
Each resource yml file is a "valid" chunk of CloudFormation template, as follows:
The advantages of the above setup (for us) is we can then configure cfn-lint tool to run against the entire /resources folder and validate the template chunks. With the help of VSCode plugins, we also get Intellisense that is context dependent on the raw resource type + links to relevant AWS docs, both which help a lot.
Problem
I tried to convert the serverless.yml template to TypeScript and I ran into issues with the file references to the raw resource templates. I do not want to convert the resource definitions to TypeScript, because I would lose the cfn-lint support.
The following works (but does not compile with the current @serverless/typescript definitions):
So to summarize, the type of resources should be changed to a union type that acccepts T | T[], where T = (the current type of resources entry + string type).
Obviously, if there is a better way that I did not see, I'm open to suggestions.
The text was updated successfully, but these errors were encountered: