-
Notifications
You must be signed in to change notification settings - Fork 394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
question: @Param not type casted #1157
Comments
Well this indeed seems weird. Could you setup a repro repo so I can debug? |
Here is the link for testing and it acts the same. |
Is there a chance you are missing |
I think that's not the issue. My main project has |
Unfortunately I have no experience with sst. I tried your repo locally, adding |
Could you try to log the values here? https://github.com/typestack/routing-controllers/blob/90ebb6a11e0a1d2f9f9da143c034576cdb564fa6/src/metadata/ParamMetadata.ts#LL123C1-L123C1 To see of explicitType is set or ParamTypes is resolved correctly. |
Well it seems like emitDecoratorMetadata is not set so you are not getting type information. Are you sure it is set correctly? |
It seems right to me |
Sorry for the very long delay. Did you find a solution to this? The tsconfig.json indeed looks ok to me. |
Just ran into this issue as well.
The problem was we were dumping it into prisma which expected a number, a simple Should note that it worked in dev mode so something happens during compile to not cast it i guess. |
What do you use to compile typescript? I know we had issues with esbuild and type casting from decorators. |
good question, unless I'm mistaken, we're using
|
You have reflect-metadata imported, right? |
yea and its in the dist too |
Could you try to make a simple repro repo for this so I can debug it further? |
sure mate, ill ping here when its done |
Prod:
Dev:
Navigate to: On prod it should give:
And on dev it'll be:
|
It seems like you are missing some config in .swcrc. Could you try adding "transform": {
"legacyDecorator": true,
"decoratorMetadata": true
} into the "jsc" block? |
That got it for me. Can't believe I missed that one. Although it might not have been the case for OP Thanks much |
Any updates regarding this? I had the same error where @param arguments are not being type-casted, tried to debug and I'm seeing param.targetName to be empty strings |
@engr-mervin could you provide more context or a repro repo? |
Hi, after a day of debugging, it turns out that it was not a problem with routing-controllers itself, but it's because I'm using tsx which does not support decorators. I moved to tsc with watch instead, and everything is working. Thanks |
I was trying to...
Context:
serverless
tosst
@vendia/serverless-express
during migration (but not 100% sure if this is necessary but without this sst threw an error ofstream.listeners is not a function
)The problem:
After migrating to
sst
@Param
doesn't castid: number
intonumber
.app.ts
oneOfTheControllers.ts
The text was updated successfully, but these errors were encountered: