Skip to content

Fix complex oneOf #1207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 7, 2023
Merged

Fix complex oneOf #1207

merged 2 commits into from
Jul 7, 2023

Conversation

drwpow
Copy link
Contributor

@drwpow drwpow commented Jul 7, 2023

Changes

Fixes #1019. At oneOf length of > 5, fall back to TS unions rather than the complex custom OneOf<> (XOR) comparison.

This is tough because it’s hard to predict just how complex some types would be, so there’s not a correct number. But hopefully most people see an invisible improvement in types, and if we see new issues come in we’ll adjust based on feedback.

How to Review

See #1019 for context.

Checklist

  • examples/ directory updated (only applicable for openapi-typescript)

@changeset-bot
Copy link

changeset-bot bot commented Jul 7, 2023

🦋 Changeset detected

Latest commit: 506d80b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
openapi-typescript Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@drwpow drwpow force-pushed the fix-complex-one-of branch from 12e1290 to 0603110 Compare July 7, 2023 01:08
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jul 7, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 506d80b
Status: ✅  Deploy successful!
Preview URL: https://1f25045d.openapi-ts.pages.dev
Branch Preview URL: https://fix-complex-one-of.openapi-ts.pages.dev

View logs

@drwpow drwpow changed the title Fix complex one of Fix complex oneOf Jul 7, 2023
@drwpow drwpow force-pushed the fix-complex-one-of branch from 0603110 to 506d80b Compare July 7, 2023 01:09
@drwpow drwpow merged commit 914e049 into main Jul 7, 2023
@drwpow drwpow deleted the fix-complex-one-of branch July 7, 2023 01:15
@github-actions github-actions bot mentioned this pull request Jul 7, 2023
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.

Use of OneOf type causing upcasting to any
1 participant