-
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
Use better context scope for class constructor implementation signatures #58168
Use better context scope for class constructor implementation signatures #58168
Conversation
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.
@typescript-bot test it
Hey @jakebailey, the results of running the DT tests are ready. Everything looks the same! |
Hm, the repro I provided in #58158 is fixed now, but I'm still seeing the issue in our codebase. I'll have to update the repro to more closely resemble our actual code. |
@jakebailey Here are the results of running the user tests comparing Everything looks good! |
@jakebailey Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
@weswigham here's another regressed case that doesn't yet pass type Assign<T, U> = Omit<T, keyof U> & U;
class Base<T> {
constructor(public t: T) {}
}
export class Foo<T > extends Base<T> {
update(): Foo<Assign<T, {x: number}>> {
const v: Assign<T, {x: number}> = Object.assign(this.t, {x: 1});
return new Foo(v);
}
} |
@MichaelMitchell-at handled~ @typescript-bot test it |
Nice, that did the trick, thank you |
Hey @weswigham, the results of running the DT tests are ready. Everything looks the same! |
@weswigham Here are the results of running the user tests comparing Everything looks good! |
@weswigham Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
@weswigham Here are the results of running the top 400 repos comparing Everything looks good! |
Since those type parameters are reachable anywhere in the body of the class, not just the constructor itself.
Honestly, we could always do the
getImplementationSignature
call, it doesn't have to be conditional, but we like trying to cut down on the type parameter copying we do, where possible. And certainly, as long as you only ever use the signature externally to the scope within which its' type parameters are internally reachable, you don't need to copy it.Fixes #58074