-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Improve logic that chooses co- vs. contra-variant inferences #52123
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
Conversation
@typescript-bot test this |
Heya @jakebailey, I've started to run the tarball bundle task on this PR at 26902df. You can monitor the build here. |
Heya @jakebailey, I've started to run the parallelized Definitely Typed test suite on this PR at 26902df. You can monitor the build here. |
Heya @jakebailey, I've started to run the extended test suite on this PR at 26902df. You can monitor the build here. |
Heya @jakebailey, I've started to run the diff-based user code test suite on this PR at 26902df. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the perf test suite on this PR at 26902df. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the diff-based top-repos suite on this PR at 26902df. You can monitor the build here. Update: The results are in! |
Hey @jakebailey, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running There is also a playground for this build and an npm module you can use via |
I can confirm that this fixes all of my cast/assert issues on the SFT branch. Wonderful! |
@jakebailey Here are the results of running the user test suite comparing Everything looks good! |
Heya @jakebailey, I've run the RWC suite on this PR - assuming you're on the TS core team, you can view the resulting diff here. |
@jakebailey Here are the results of running the top-repos suite comparing Everything looks good! |
@jakebailey Here they are:
CompilerComparison Report - main..52123
System
Hosts
Scenarios
TSServerComparison Report - main..52123
System
Hosts
Scenarios
StartupComparison Report - main..52123
System
Hosts
Scenarios
Developer Information: |
Another example that I didn't realize was affected is this: interface A {
a: string;
}
interface B extends A {
b: string;
}
interface C extends A {
c: string
} Then: declare function isC(x: A): x is C;
declare function every<T, U extends T>(array: readonly T[], callback: (element: T, index: number) => element is U): array is readonly U[];
declare function every<T, U extends T>(array: readonly T[] | undefined, callback: (element: T, index: number) => element is U): array is readonly U[] | undefined;
declare function every<T>(array: readonly T[] | undefined, callback: (element: T, index: number) => boolean): boolean;
function foo(arr: readonly B[] | readonly C[] | undefined) {
if (every(arr, isC)) {
arr;
}
} In TS 4.9, this code errors because it picks (I may send a PR for this test case too.) |
I have another followup case that turned out to not be fixed (I also didn't catch it in the SFT branch in the same way as the above fixed case); I'll file a new issue. |
Fixes #52111.