tsoa: Interfaces declared by TypeScript can't be used
Sorting
-
I’m submitting a …
- bug report
- feature request
- support request
-
I confirm that I
- used the search to make sure that a similar issue hasn’t already been submit
Expected Behavior
No error.
Current Behavior
TypeError: Cannot use 'in' operator to search for 'typeParameters' in undefined
at TypeResolver.typeArgumentsToContext (/mntnode_modules/tsoa/dist/metadataGeneration/typeResolver.js:776:47)
at TypeResolver.getReferenceType (/mntnode_modules/tsoa/dist/metadataGeneration/typeResolver.js:448:14)
at TypeResolver.resolve (/mntnode_modules/tsoa/dist/metadataGeneration/typeResolver.js:318:34)
at TypeResolver.propertyFromSignature (/mntnode_modules/tsoa/dist/metadataGeneration/typeResolver.js:721:119)
at /mntnode_modules/tsoa/dist/metadataGeneration/typeResolver.js:687:161
at Array.map (<anonymous>)
at TypeResolver.getModelProperties (/mntnode_modules/tsoa/dist/metadataGeneration/typeResolver.js:687:124)
at TypeResolver.getModelReference (/mntnode_modules/tsoa/dist/metadataGeneration/typeResolver.js:512:31)
at TypeResolver.getReferenceType (/mntnode_modules/tsoa/dist/metadataGeneration/typeResolver.js:476:38)
at TypeResolver.resolve (/mntnode_modules/tsoa/dist/metadataGeneration/typeResolver.js:318:34)
Steps to Reproduce
Create a method with:
@Get()
public returnNumber(): Number
Context (Environment)
Version of the library: 3.0.8 Version of NodeJS: 10
- Confirm you were using yarn not npm: [x] 😆
Detailed Description
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (2 by maintainers)
I’m sure there’s a bug here, what I’m saying is this:
doesn’t cause issues for me.
The
Number
type does though.Go ahead 😉
Just as a hint for other ppl. trying to use interfaces (not type aliases) from the ts lib declarations: We explicitly filter them currently to avoid issues with duplicated interfaces. Relates to https://github.com/lukeautry/tsoa/issues/333#issuecomment-625258178
Yup, the
Number
is causing issues here (notnumber
). I just tried making sure a very basic case like an interface with some nested props wouldn’t cause issues in tsoa.doesn’t cause any issues either, shows up in SwUI aswell 😕