Skip to content

Typescript 5 @InjectModel #1717

@hxtree

Description

@hxtree

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

After upgrade from Typescript 4.9 to 5 I get the following error:

    src/module/character-sheet/character-sheet.repository.ts:13:6 - error TS1239: Unable to resolve signature of parameter decorator when called as an expression.
      Argument of type 'undefined' is not assignable to parameter of type 'string | symbol'.

    13     @InjectModel(CharacterSheet.name)

Minimum reproduction code

https://github.com/hxtree/cats-cradle/tree/main/libraries/nestjs-modules

Steps to reproduce

Upgrade to latest tsc compiler

Was officially released March 16.
https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/

Expected behavior

Ideally it would work the same on both 4.9 and 5

Package version

9.2.1

mongoose version

6.9.1

NestJS version

9.2.1

Node.js version

16

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions