Skip to content
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

Exact no longer works with recursive types + unions #948

Closed
abrenneke opened this issue Aug 28, 2024 · 0 comments · Fixed by #949
Closed

Exact no longer works with recursive types + unions #948

abrenneke opened this issue Aug 28, 2024 · 0 comments · Fixed by #949

Comments

@abrenneke
Copy link
Contributor

abrenneke commented Aug 28, 2024

Code that worked in v4.21.0 no longer compiles in v4.22.0 after the change to Exact. Simplified code below:

import { Exact } from 'type-fest';

export type A = { a: Expected; }
export type B = { b: string }
export type Expected = A | B;

const _errors: Exact<Expected, Expected> = {} as Expected;

Playground Link

We believe that the change which caused IsEqual to not be first here causes the type to be distributed early, and the IsEqual check suddenly fails because it distributes to Exact<A, Expected> | Exact<B, Expected> which doesn't make any sense.

isEqual used to be first, which is why this worked previously, so I think moving it first again could fix this issue.

cc @zorji

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • The funding will be given to active contributors.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
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 a pull request may close this issue.

1 participant