| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
I should mention that with this PR, the check time for this repro drops from ~10s to about 0.4s. |
Sorry, something went wrong.
|
TypeScript Bot (@typescript-bot) test this |
Sorry, something went wrong.
|
Heya Andrew Branch (@andrewbranch), I've started to run the inline community code test suite on this PR at 75ab347. You can monitor the build here. Update: The results are in! |
Sorry, something went wrong.
|
Heya Andrew Branch (@andrewbranch), I've started to run the extended test suite on this PR at 75ab347. You can monitor the build here. |
Sorry, something went wrong.
|
Heya Andrew Branch (@andrewbranch), I've started to run the parallelized Definitely Typed test suite on this PR at 75ab347. You can monitor the build here. |
Sorry, something went wrong.
|
Heya Andrew Branch (@andrewbranch), I've started to run the tarball bundle task on this PR at 75ab347. You can monitor the build here. |
Sorry, something went wrong.
|
Heya Andrew Branch (@andrewbranch), I've started to run the perf test suite on this PR at 75ab347. You can monitor the build here. Update: The results are in! |
Sorry, something went wrong.
|
Hurray, I helped find something maybe useful! |
Sorry, something went wrong.
|
Andrew Branch (@andrewbranch) |
Sorry, something went wrong.
| var x: T | null = Math.random() > 0.5 ? null : t; | ||
| onlyNullablePlease(x); // should work | ||
| ~ | ||
| !!! error TS2345: Argument of type 'T | null' is not assignable to parameter of type 'null extends T | null ? any : never'. |
There was a problem hiding this comment.
This one is interesting - is this actually a distributive conditional type? Why is it deferred?
Sorry, something went wrong.
There was a problem hiding this comment.
We always defer if either of the check and extends types contains generics. This is somewhat of a blunt instrument, and we could possibly do better in cases like this.
Sorry, something went wrong.
There was a problem hiding this comment.
And by "contains generics" I mean we defer when isGenericType returns true for either of the check and extends types.
Sorry, something went wrong.
This is impossible in the general case - any condition with an infer has to be deferred so the infer can be instantiated with every possible input (since an infer result can't stand on its own) - if we don't reason about branch reachability in relationship checking, we can never handle conditional types that both filter and transform simultaneously like T extends () => infer I ? I : never. We knew that adding constraint checks on branch reachability would be expensive - but it's the typespace equivalent of doing control flow on genetics, which we also do wherever we can now. |
Sorry, something went wrong.
|
Andrew Branch (@andrewbranch) Comparison Report - main..46429
System
Hosts
Scenarios
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sorry, something went wrong.
|
TypeScript Bot (@typescript-bot) test this |
Sorry, something went wrong.
|
Heya Anders Hejlsberg (@ahejlsberg), I've started to run the extended test suite on this PR at 75ab347. You can monitor the build here. |
Sorry, something went wrong.
|
Heya Anders Hejlsberg (@ahejlsberg), I've started to run the parallelized community code test suite on this PR at 75ab347. You can monitor the build here. |
Sorry, something went wrong.
|
Heya Anders Hejlsberg (@ahejlsberg), I've started to run the tarball bundle task on this PR at 75ab347. You can monitor the build here. |
Sorry, something went wrong.
|
Heya Anders Hejlsberg (@ahejlsberg), I've started to run the parallelized Definitely Typed test suite on this PR at 75ab347. You can monitor the build here. |
Sorry, something went wrong.
Agreed, and so be it. But it does seem like there are classes of cases where we ought to do better in conditional type construction. Both of the test cases that revert back to failing with this PR seem quite trivial--for example, checking if the check and extends types are identical, or if the extends type is a union that contains the check type, would cause us to resolve the conditional type to the true case. |
Sorry, something went wrong.
|
Hey Anders Hejlsberg (@ahejlsberg), I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so: {
"devDependencies": {
"typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/113306/artifacts?artifactName=tgz&fileId=A263304AC84860808E706B7F5590B0AA3616661B50F7CE35CED050B21FF1B0C802&fileName=/typescript-4.5.0-insiders.20211019.tgz"
}
}
and then running npm install. There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/pr-build@4.5.0-pr-46429-17".; |
Sorry, something went wrong.
|
I think I can say with a high degree of certainty that whatever is going on in Andrew Casey (@amcasey)'s example is unrelated. I removed all of the logic having to do with assignability to conditional types (i.e. both #30639 and this PR), and the example still blows up with an instantiation depth error. |
Sorry, something went wrong.
|
Please, no more plot twists, my heart can't handle it anymore. |
Sorry, something went wrong.
|
Yeah, if the real world code is fast then I’m happy. Just wanted to make sure it was checked against the latest changes. |
Sorry, something went wrong.
|
is there an example of a type that is no longer allowed as of this PR? the typescript 4.5 blog post mentions this PR
but i can't seem to find a minimal example of what this means exactly |
Sorry, something went wrong.
|
DetachHead good news (??), we found one: #47127 (comment) |
Sorry, something went wrong.
This is a BAD news for me. I deeply dependency this feature. Because of this breaking change, I cant update TypeScript, it's so bad for me, could you add a compiler option to support it as a migrate plan? |
Sorry, something went wrong.
…osoft#46429) * Simplify relationship check for conditional type on target side * Accept new baselines * Better support for non-distribution-dependent types * Accept new API baselines * Accept new baselines
| Back | FazBrowse Home | New Git URL |
This PR simplifies our relationship checking logic for conditional types on the target side. With this PR, a source type S is assignable to a target type A extends B ? C : D when
The PR revises some of the logic that was added in #30639, specifically the logic that determines if A is referenced in C or D in a distributive conditional type. There are no baseline changes as a result of this PR, but it fixes the performance degradation reported in #44851.
Fixes #44851.