e2318217fb
* Properly strip nullable types from this type in optional chain calls * Add regression test
40 lines
1.3 KiB
Plaintext
40 lines
1.3 KiB
Plaintext
=== tests/cases/conformance/expressions/optionalChaining/callChain/callChainInference.ts ===
|
|
// Repro from #42404
|
|
|
|
interface Y {
|
|
>Y : Symbol(Y, Decl(callChainInference.ts, 0, 0))
|
|
|
|
foo<T>(this: T, arg: keyof T): void;
|
|
>foo : Symbol(Y.foo, Decl(callChainInference.ts, 2, 13))
|
|
>T : Symbol(T, Decl(callChainInference.ts, 3, 8))
|
|
>this : Symbol(this, Decl(callChainInference.ts, 3, 11))
|
|
>T : Symbol(T, Decl(callChainInference.ts, 3, 8))
|
|
>arg : Symbol(arg, Decl(callChainInference.ts, 3, 19))
|
|
>T : Symbol(T, Decl(callChainInference.ts, 3, 8))
|
|
|
|
a: number;
|
|
>a : Symbol(Y.a, Decl(callChainInference.ts, 3, 40))
|
|
|
|
b: string;
|
|
>b : Symbol(Y.b, Decl(callChainInference.ts, 4, 14))
|
|
}
|
|
|
|
declare const value: Y | undefined;
|
|
>value : Symbol(value, Decl(callChainInference.ts, 8, 13))
|
|
>Y : Symbol(Y, Decl(callChainInference.ts, 0, 0))
|
|
|
|
if (value) {
|
|
>value : Symbol(value, Decl(callChainInference.ts, 8, 13))
|
|
|
|
value?.foo("a");
|
|
>value?.foo : Symbol(Y.foo, Decl(callChainInference.ts, 2, 13))
|
|
>value : Symbol(value, Decl(callChainInference.ts, 8, 13))
|
|
>foo : Symbol(Y.foo, Decl(callChainInference.ts, 2, 13))
|
|
}
|
|
|
|
value?.foo("a");
|
|
>value?.foo : Symbol(Y.foo, Decl(callChainInference.ts, 2, 13))
|
|
>value : Symbol(value, Decl(callChainInference.ts, 8, 13))
|
|
>foo : Symbol(Y.foo, Decl(callChainInference.ts, 2, 13))
|
|
|