mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
28 lines
549 B
TypeScript
28 lines
549 B
TypeScript
//// [tests/cases/conformance/expressions/optionalChaining/callChain/callChainInference.ts] ////
|
|
|
|
//// [callChainInference.ts]
|
|
// Repro from #42404
|
|
|
|
interface Y {
|
|
foo<T>(this: T, arg: keyof T): void;
|
|
a: number;
|
|
b: string;
|
|
}
|
|
|
|
declare const value: Y | undefined;
|
|
|
|
if (value) {
|
|
value?.foo("a");
|
|
}
|
|
|
|
value?.foo("a");
|
|
|
|
|
|
//// [callChainInference.js]
|
|
"use strict";
|
|
// Repro from #42404
|
|
if (value) {
|
|
value === null || value === void 0 ? void 0 : value.foo("a");
|
|
}
|
|
value === null || value === void 0 ? void 0 : value.foo("a");
|