Skip to content

fix: Parenthesize implementing type ternaries joined with ||#201

Merged
ardeois merged 1 commit into
ardeois:mainfrom
lucastraba:fix/parenthesize-implementing-types
Mar 23, 2026
Merged

fix: Parenthesize implementing type ternaries joined with ||#201
ardeois merged 1 commit into
ardeois:mainfrom
lucastraba:fix/parenthesize-implementing-types

Conversation

@lucastraba
Copy link
Copy Markdown
Contributor

Summary

  • Wraps each implementing type expression in parentheses before joining with || in the case 'implement': codepath (src/index.ts), fixing incorrect operator precedence between || and ?:
  • Updates existing test assertions in useImplementingTypes, useImplementingTypesAndDefaultNullableToNull, and useImplementingTypesAndTerminateCircularRelationships to expect parenthesized output
  • Adds a new test case with 3+ implementing types to explicitly verify parenthesization

Test plan

  • Updated all existing toContain assertions to match new parenthesized output
  • Added new test: should parenthesize implementing types with 3+ implementations with a dedicated 3-implementor schema (TypeA, TypeB, TypeC)
  • Full test suite passes (125/125 tests, 14/14 suites)

@lucastraba lucastraba force-pushed the fix/parenthesize-implementing-types branch from 30dc64e to a366020 Compare March 16, 2026 16:38
Copy link
Copy Markdown
Owner

@ardeois ardeois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good !
Thanks for the update

@ardeois ardeois self-assigned this Mar 19, 2026
@lucastraba
Copy link
Copy Markdown
Contributor Author

Looks good !
Thanks for the update

Really happy to contribute to this awesome project!

@ardeois ardeois added the patch Increment the patch version when merged label Mar 23, 2026
@ardeois ardeois merged commit ab9209f into ardeois:main Mar 23, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Increment the patch version when merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants