Skip to content

allow usage of symbol instead of string#118

Open
thomaschaaf wants to merge 1 commit intonotiz-dev:mainfrom
thomaschaaf:patch-1
Open

allow usage of symbol instead of string#118
thomaschaaf wants to merge 1 commit intonotiz-dev:mainfrom
thomaschaaf:patch-1

Conversation

@thomaschaaf
Copy link

No description provided.

@marcjulian
Copy link
Member

Thanks for the PR, what is your use case for this? Please provide an example

@NedcloarBR
Copy link

NedcloarBR commented Feb 15, 2026

I think this is a valuable improvement. Since @Inject already supports Symbol as an injection token, allowing it here would make the library more flexible and consistent with Nest’s capabilities.

Using Symbol can also help avoid naming conflicts and makes dependency tokens safer in larger or more modular applications. Supporting it would improve developer experience without introducing breaking changes.

@NedcloarBR
Copy link

@thomaschaaf I think simply changing the type to string | symbol might not be the best approach here.

In Nest itself, the @Inject decorator does not limit the token to string | symbol. The implementation shows a more flexible typing strategy:

Aligning with Nest’s implementation would likely make this change more robust and future-proof, instead of just widening the type to a union.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants