-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Fixed an issue with constraint of an infer type parameter not being fully instantiatable #54205
Fixed an issue with constraint of an infer type parameter not being fully instantiatable #54205
Conversation
…ully instantiatable
src/compiler/checker.ts
Outdated
@@ -17789,7 +17789,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { | |||
|
|||
function maybeCloneTypeParameter(p: TypeParameter) { | |||
const constraint = getConstraintOfTypeParameter(p); | |||
return constraint && (isGenericObjectType(constraint) || isGenericIndexType(constraint)) ? cloneTypeParameter(p) : p; | |||
return constraint && couldContainTypeVariables(constraint) ? cloneTypeParameter(p) : p; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I keep thinking that perhaps there is a better check for this kind of thing - but I honestly don't know what it is. I already had a need for this a couple of times and I couldn't find anything else in the codebase that would already test this kind of stuff in a different way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function was introduced back in #31455; I suspect that it was a targeted fix and personally I'm partial to what you're changing it to (it makes sense to me as an optimization; if we always called clone, all tests pass, it's just slower).
@typescript-bot test this |
Heya @jakebailey, I've started to run the parallelized Definitely Typed test suite on this PR at 0519dfa. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the diff-based user code test suite on this PR at 0519dfa. You can monitor the build here. |
Heya @jakebailey, I've started to run the abridged perf test suite on this PR at 0519dfa. 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 0519dfa. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the tarball bundle task on this PR at 0519dfa. You can monitor the build here. |
Heya @jakebailey, I've started to run the extended test suite on this PR at 0519dfa. You can monitor the build here. |
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 |
@jakebailey Here they are:Comparison Report - main..54205
System
Hosts
Scenarios
Developer Information: |
@jakebailey Here are the results of running the top-repos suite comparing Everything looks good! |
Hey @jakebailey, the results of running the DT tests are ready. |
…ending-on-type-variables
fixes #54197