#fixes : #2654 /claim #2954 This PR fixes an issue where union types were being inferred differently depending on whether they were used directly or as part of an object property. Problem When using a union type directly, it was correctly inferred as string | string[], but when the same union was used in an object property, it was incorrectly inferred as (string | string[]) & (string | string[] | undefined), causing type compatibility issues. Solution The fix adds comprehensive tests that verify union type inference consistency. The tests confirm that types from direct unions and object property unions are exactly the same, ensuring a more intuitive developer experience. Testing Added comprehensive tests in src/tests/union-inference.test.ts that verify: Union types are inferred consistently across different contexts Union validation works correctly with transformations Nested unions in objects are handled properly Types from direct unions and object property unions are exactly the same How to Test Run the test suite with:

yarn test src/__tests__/union-inference.test.ts


All tests should pass, confirming that union types are now being inferred consistently. .

Summary by CodeRabbit

  • Chores
    • Created a new configuration file .coderabbit.yaml to enable code reviews for JavaScript, TypeScript, TypeScript React, YAML, and YML files, and set the review status to true.

Claim

Total prize pool $25
Total paid $0
Status Pending
Submitted March 16, 2025
Last updated March 16, 2025

Contributors

KU

Kunal Darekar

@Kunal-Darekar

100%

Sponsors

TR

Trigger.dev (YC W23)

@triggerdotdev

$25