Skip to content

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

Open
lucastraba wants to merge 1 commit intoardeois:mainfrom
lucastraba:fix/parenthesize-implementing-types
Open

fix: Parenthesize implementing type ternaries joined with ||#201
lucastraba wants to merge 1 commit intoardeois:mainfrom
lucastraba:fix/parenthesize-implementing-types

Conversation

@lucastraba
Copy link

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
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
Author

Looks good !
Thanks for the update

Really happy to contribute to this awesome project!

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