Skip to content
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

fix: decorator types #1685

Merged
merged 2 commits into from
Apr 7, 2023
Merged

fix: decorator types #1685

merged 2 commits into from
Apr 7, 2023

Conversation

Nicklason
Copy link
Contributor

Hello. I have had a problem for a while where Visual Studio Code would give me errors about the InjectMetrics decorator but I would still be able to build and run my code. I have now tried to update my project to TypeScript v5 and I can't build my project anymore. The error it gives in the build logs is the same error that Visual Studio Code has given me for a while, so I assume it is because some extension I use moved to TypeScript v5.

I found this issue #1667 that had the same errors as me, but the comments didn't help. I also found a different issue nestjs/nest#10959, and the fix they used nestjs/nest#10970, and used that to fix the problem with the InjectMetric decorator.

The problem is that the decorator types are wrong. Record<string, unknown> fails with strict checks, and the key may also be undefined.

Fixes #1667

@willsoto willsoto merged commit 6f8a52e into willsoto:main Apr 7, 2023
@willsoto
Copy link
Owner

willsoto commented Apr 7, 2023

Thanks for the context and the PR

willsoto pushed a commit that referenced this pull request Apr 7, 2023
## [5.1.1](v5.1.0...v5.1.1) (2023-04-07)

### Bug Fixes

* decorator types ([#1685](#1685)) ([6f8a52e](6f8a52e)), closes [#1667](#1667)
@willsoto
Copy link
Owner

willsoto commented Apr 7, 2023

🎉 This PR is included in version 5.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeScript error "Unable to resolve signature of parameter decorator when called as an expression"
2 participants