Unable to resolve Return types from different files.
Sorting
-
I'm submitting a ...
- [ X] bug report
- [ ] feature request
- [X ] support request
-
I confirm that I
- [X ] used the search to make sure that a similar issue hasn't already been submit
Expected Behavior
I have a controller which returns a type that is defined in another file, however TSOA fails to find it during generation. Not sure if this is a relative path issue?
Current Behavior
import { IType } from 'folder/file';
@Post('{path}')
createOrUpdateType(@Path() path
): Promise<IElementsResponse> {
...stufff
}
Possible Solution
Steps to Reproduce
run tsoa spec-and-routes with some thing similar to above:
Generate routes error.
GenerateMetadataError: No declarations found for referenced type IElementsResponse.
at TypeResolver.getModelTypeDeclarations (C:\Users\119481\git\ddp-api-server\node_modules\@tsoa\cli\dist\metadataGeneration\typeResolver.js:871:62)
at TypeResolver.calcRefTypeName (C:\Users\119481\git\ddp-api-server\node_modules\@tsoa\cli\dist\metadataGeneration\typeResolver.js:536:39)
at TypeResolver.calcTypeReferenceTypeName (C:\Users\119481\git\ddp-api-server\node_modules\@tsoa\cli\dist\metadataGeneration\typeResolver.js:712:34)
at TypeResolver.getReferenceType (C:\Users\119481\git\ddp-api-server\node_modules\@tsoa\cli\dist\metadataGeneration\typeResolver.js:721:35)
at TypeResolver.resolveTypeReferenceNode (C:\Users\119481\git\ddp-api-server\node_modules\@tsoa\cli\dist\metadataGeneration\typeResolver.js:468:21)
at TypeResolver.resolve (C:\Users\119481\git\ddp-api-server\node_modules\@tsoa\cli\dist\metadataGeneration\typeResolver.js:293:21)
at TypeResolver.resolveTypeReferenceNode (C:\Users\119481\git\ddp-api-server\node_modules\@tsoa\cli\dist\metadataGeneration\typeResolver.js:458:93)
at TypeResolver.resolve (C:\Users\119481\git\ddp-api-server\node_modules\@tsoa\cli\dist\metadataGeneration\typeResolver.js:293:21)
at MethodGenerator.Generate (C:\Users\119481\git\ddp-api-server\node_modules\@tsoa\cli\dist\metadataGeneration\methodGenerator.js:62:78)
at C:\Users\119481\git\ddp-api-server\node_modules\@tsoa\cli\dist\metadataGeneration\controllerGenerator.js:46:41
Context (Environment)
Version of the library: "^6.5.1" Version of NodeJS: "22.x"
- Confirm you were using yarn not npm: [X ]
Hello there Enquier 👋
Thank you for opening your very first issue in this project.
We will try to get back to you as soon as we can.👀
Similar to the closed (stale) issue #1653 ?
I did a little more testing and it seems as though if I put in a full relative path it works: "eg ../../path/to/file as opposed to path/to/file. Is there a config I am missing or is this just a limitation of the tool
Added some config to compiler options... didn't realize TSOA wasn't taking from the local tsconfig (my bad)
what compile option you add ?
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days