Skip to content

fix(nitrogen): ignore optional never properties - #1525

Open
huytdps13400 wants to merge 1 commit into
margelo:mainfrom
huytdps13400:fix/1482-support-optional-never
Open

fix(nitrogen): ignore optional never properties#1525
huytdps13400 wants to merge 1 commit into
margelo:mainfrom
huytdps13400:fix/1482-support-optional-never

Conversation

@huytdps13400

Copy link
Copy Markdown

Summary

  • treat optional never properties as TypeScript-only exclusivity markers
  • inspect the property type node before TypeScript normalizes property?: never to undefined
  • leave required never properties on the existing unsupported-type error path
  • add a minimal compile-time regression to the existing Car spec

TDD evidence

RED: with only purelyTypeLevel?: never added, Nitrogen exited 1 while generating Child, TestObjectCpp, and TestObjectSwiftKotlin because the optional property resolved to an unsupported undefined type.

GREEN: after the parser change, the official bun specs command generated 7/7 HybridObjects successfully. The generated C++/Swift/Kotlin output has no purelyTypeLevel field and produces no tracked generated-file diff.

Verification

  • bun specs
  • bun run build
  • bun typecheck
  • bun --cwd packages/nitrogen lint-ci
  • bun --cwd packages/react-native-nitro-test lint-ci
  • git diff --check

No dependency, lockfile, or generated native file changes.

Closes #1482

Treat optional never properties as TypeScript-only exclusivity markers so they do not become fields in generated native structs.

Closes margelo#1482.
@vercel

vercel Bot commented Aug 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
nitro-docs Skipped Skipped Aug 22, 2026 9:41am

Request Review

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.

Allow never in discriminated union members instead of throwing a spec-generation error

1 participant