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(common): inject decorator should allow key to be undefined #10970

Merged
merged 2 commits into from
Feb 1, 2023

Conversation

kamilmysliwiec
Copy link
Member

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@coveralls
Copy link

coveralls commented Jan 27, 2023

Pull Request Test Coverage Report for Build 98c608b3-de6f-420d-9005-0cb6aab9f265

  • 2 of 2 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 93.409%

Totals Coverage Status
Change from base Build 3995954d-8a28-41bd-aed6-d1836b737f1e: 0.0%
Covered Lines: 6207
Relevant Lines: 6645

💛 - Coveralls

@DanielRosenwasser
Copy link

DanielRosenwasser commented Jan 27, 2023

Does Optional need a fix?

export function Optional() {
return (target: object, key: string | symbol, index?: number) => {

@kamilmysliwiec kamilmysliwiec merged commit 268d930 into master Feb 1, 2023
@delete-merged-branch delete-merged-branch bot deleted the fix/inject-decorator-signature branch February 1, 2023 10:30
tychota added a commit to tychota/mikro-orm-nestjs that referenced this pull request Mar 24, 2023
This allow support of Typescript 5, that were fixed in
nestjs/nest#10970 and merged
in 9.3.0
willsoto pushed a commit to willsoto/nestjs-prometheus that referenced this pull request Apr 7, 2023
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants