Skip to content

Fix nullable NoInfer handler narrowing - #355

Draft
gvergnaud wants to merge 1 commit into
mainfrom
vibe/fix-noinfer-nullable-055371
Draft

Fix nullable NoInfer handler narrowing#355
gvergnaud wants to merge 1 commit into
mainfrom
vibe/fix-noinfer-nullable-055371

Conversation

@gvergnaud

@gvergnaud gvergnaud commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add a regression test for nullable NoInfer<User | null> | null values with P.nonNullable property patterns.
  • Preserve useful handler narrowing when precise extraction falls back by intersecting safe inverted object patterns with the input type.
  • Keep fallback behavior unchanged for never, any, unknown, primitive, and impossible object patterns.

Verification

  • npm run check -- --noErrorTruncation
  • npm test

Closes #354


Summary by cubic

Fixes handler narrowing for nullable NoInfer objects when matching with P.nonNullable, so properties like name narrow to string as expected. Updates the MatchedValue fallback to preserve useful narrowing without changing behavior for never, any, unknown, primitives, or impossible patterns. Closes #354.

  • Bug Fixes
    • Added a regression test for NoInfer<User | null> | null with { name: P.nonNullable }.
    • Adjusted MatchedValue to intersect a & invpattern only for safe object patterns.

Written for commit e0274cf. Summary will update on new commits.

Review in cubic

Co-authored-by: gvergnaud <gvergnaud@users.noreply.github.com>
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.

Nullable NoInfer breaks with() handler

2 participants