Skip to content

fix: generate named union types referenced by arrays - #263

Merged
k-egor-smirnov merged 1 commit into
masterfrom
e-smirnov-fix-named-union-types
Oct 30, 2026
Merged

k-egor-smirnov merged 1 commit into
masterfrom
e-smirnov-fix-named-union-types

Conversation

@k-egor-smirnov

Copy link
Copy Markdown
Contributor

Generating an array whose items reference a named definition with a type array or with oneOf but no scalar type exits with Unknown type of object. The type-string renderer already supports these unions, but generateObject() rejects them before it reaches that renderer.

Route oneOf and array-valued type definitions through the existing type-alias generation path before the scalar-type switch. Referenced branches keep their generated definitions and imports, and ordinary object definitions continue to produce interfaces.

Added six generator regression cases covering type[] with and without oneOf, oneOf with and without a scalar type, referenced union branches, and ordinary object interfaces. The new failure cases were reproduced against the previous implementation before applying the fix.

Validation:

  • yarn test — passed (includes Jest, TypeScript checks, ESLint, and formatting).
  • yarn build — passed.
  • Generated mixed scalar/object/array union typings and compiled the emitted entry point with tsc --noEmit --strict --skipLibCheck — passed.

Package release and downstream dependency updates are outside this PR.

@k-egor-smirnov
k-egor-smirnov merged commit 6227d1a into master Oct 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants