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
Rewrite Equal
to use the equality check from ReadonlyEquivalent
exclusively
#21
Merged
Commits on Nov 28, 2022
-
Rewrite
Equal
to use the equality check fromReadonlyEquivalent
e……xclusively. This is a breaking change as I opted to remove the types that were no longer needed. They are exported though so it's likely some people depend on them. This took a lot of tinkering. This topic and this equality check is discussed extensively at microsoft/TypeScript#27024 The main three work-arounds this implementation added are: 1. Explicitly handling `any` separately 2. Supporting identity unions 3. Supporting identity intersections The only known issue is this case: ```ts // @ts-expect-error This is the bug. expectTypeOf<{foo: number} & {bar: string}>().toEqualTypeOf<{foo: number; bar: string}>() ``` @shicks and I could not find a tweak to the `Equality` check to make this work. Instead, I added a workaround in the shape of a new `.simplified` modifier that works similar to `.not`: ```ts // The workaround is the new optional .simplified modifier. expectTypeOf<{foo: number} & {bar: string}>().simplified.toEqualTypeOf<{foo: number; bar: string}>() ``` I'm not entirely sure what to do with documenting `.simplified` because it's something you should never use unless you need it. The simplify operation tends to lose information about the types being tested (e.g., functions become `{}` and classes lose their constructors). I'll definitely update this PR to reference the `.simplified` modifier but I wanted to get a review on this approach first. One option would be to keep around all the `DeepBrand` stuff and to have `.deepBranded` or something being the modifier instead. That would have the benefit of preserving all the exported types making this less of a breaking change.
Configuration menu - View commit details
-
Copy full SHA for 44d7f67 - Browse repository at this point
Copy the full SHA 44d7f67View commit details
Commits on Apr 8, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 27142ee - Browse repository at this point
Copy the full SHA 27142eeView commit details
Commits on Apr 13, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 8944ede - Browse repository at this point
Copy the full SHA 8944edeView commit details -
Configuration menu - View commit details
-
Copy full SHA for bd7275a - Browse repository at this point
Copy the full SHA bd7275aView commit details -
Configuration menu - View commit details
-
Copy full SHA for b39fe06 - Browse repository at this point
Copy the full SHA b39fe06View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3081e2e - Browse repository at this point
Copy the full SHA 3081e2eView commit details
Commits on May 10, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 5d5b1eb - Browse repository at this point
Copy the full SHA 5d5b1ebView commit details -
Configuration menu - View commit details
-
Copy full SHA for f4dab98 - Browse repository at this point
Copy the full SHA f4dab98View commit details -
Configuration menu - View commit details
-
Copy full SHA for 241e1e5 - Browse repository at this point
Copy the full SHA 241e1e5View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.