It is currently checking the argument using ts.isStringLiteral(). Could we just simply check if it is a string instead of String Literal?
Steps to Reproduce
See description above.
4.
Context (Environment)
Version of the library: 3.14.1
Version of NodeJS: 16.20.2
Confirm you were using yarn not npm: [ ] We are using rush
Detailed Description
See description above.
Breaking change?
Not sure. String is a superset of String Literal, so it should not break existing functionalities, but not sure if String Literal was required for any reason.
If I use a string variable in the first argument of
@Extension
:it throws the following error:
I have tried the followings but none of them worked:
Currently, the only way to set the key is to use a string literal:
I am going to be using the key
x-extension
in many API endpoints, so it would be nice to be able to declare a constant as the key to reduce errors.Is there a workaround to pass in string variable as the first argument of
@Extension
?Sorting
I'm submitting a ...
I confirm that I
Expected Behavior
We should be able to pass in a string variable like in other decorators.
Current Behavior
It throws an error when I pass in a string variable as the first argument of
@Extension
.Possible Solution
The error is thrown from this line of code: https://github.com/lukeautry/tsoa/blob/8b30ec76a2ea460553a26a511317e918bc503da6/packages/cli/src/metadataGeneration/extension.ts#L16C1-L16C1
It is currently checking the argument using
ts.isStringLiteral()
. Could we just simply check if it is a string instead of String Literal?Steps to Reproduce
See description above.
Context (Environment)
Version of the library: 3.14.1 Version of NodeJS: 16.20.2
rush
Detailed Description
See description above.
Breaking change?
Not sure. String is a superset of String Literal, so it should not break existing functionalities, but not sure if String Literal was required for any reason.