Use better context scope for class constructor implementation signatures - #58168
Conversation
Jake Bailey (jakebailey)
left a comment
There was a problem hiding this comment.
TypeScript Bot (@typescript-bot) test it
|
Hey Jake Bailey (@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. |
|
Jake Bailey (@jakebailey) Here are the results of running the user tests comparing Everything looks good! |
|
Jake Bailey (@jakebailey) Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Wesley Wigham (@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);
}
} |
|
michaelm (@MichaelMitchell-at) handled~ TypeScript Bot (@typescript-bot) test it |
|
Nice, that did the trick, thank you |
|
Hey Wesley Wigham (@weswigham), the results of running the DT tests are ready. Everything looks the same! |
|
Wesley Wigham (@weswigham) Here are the results of running the user tests comparing Everything looks good! |
|
Wesley Wigham (@weswigham) Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Wesley Wigham (@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
getImplementationSignaturecall, 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