TypeScript/tests/baselines/reference/callChainInference.symbols
Anders Hejlsberg e2318217fb
Strip nullable types from 'this' type in inference with optional chain calls (#42536)
* Properly strip nullable types from this type in optional chain calls

* Add regression test
2021-02-03 13:50:23 -10:00

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))