Skip to content

fix(plugin): resolve field type for | undefined unions - #4234

Merged
kamilmysliwiec merged 2 commits into
nestjs:masterfrom
thekhegay:fix/plugin-undefined-union
Nov 11, 2026
Merged

kamilmysliwiec merged 2 commits into
nestjs:masterfrom
thekhegay:fix/plugin-undefined-union

Conversation

@thekhegay

Copy link
Copy Markdown
Contributor

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?

Plugin only drops null from a union type node, so string | null | undefined keeps two members and metdata gets type: () => Object. Same for Date | null | undefined and Status[] | null | undefined, and Status | undefined ends up as type: () => Status.DISABLED which is plain wrong

Issue Number: N/A

What is the new behavior?

Union members that are null or undefined are both filtered out before the type is resolved, using existing isNull and isUndefined helpers. Those fields now gets String, Date, [Status] and Status. Unused findNullableTypeFromUnion is removed, extended nullable.dto fixture covers all four cases

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@kamilmysliwiec
kamilmysliwiec merged commit 404a3e7 into nestjs:master Nov 11, 2026
1 check passed
@thekhegay
thekhegay deleted the fix/plugin-undefined-union branch November 11, 2026 16:34
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.

2 participants