Skip to content

fix(core): treat null as invalid in isCustomClass, isCustomFactory, isCustomUseExisting - #17600

Merged
kamilmysliwiec merged 1 commit into
nestjs:masterfrom
jyx-07:fix/provider-classifier-null-check
Aug 28, 2026
Merged

kamilmysliwiec merged 1 commit into
nestjs:masterfrom
jyx-07:fix/provider-classifier-null-check

Conversation

@jyx-07

@jyx-07 jyx-07 commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Closes #17599

isCustomClass, isCustomFactory, and isCustomUseExisting in
packages/core/injector/module.ts used isUndefined() to detect
missing provider values. This means { useClass: null },
{ useFactory: null }, and { useExisting: null } are all
misclassified as valid providers, leading to confusing runtime
crashes instead of a clear rejection.

Fix: replace isUndefined with isNil at all three call sites.

Note: if this behavior turns out to be intentional for any of the
three cases, happy to revert or adjust accordingly.

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.

Fix isCustomClass misclassifies { useClass: null } as a valid ClassProvider

2 participants