TypeScript/tests/baselines/reference/callChain.2.js
Ron Buckton fcd9334f57
Add support for Optional Chaining (#33294)
* Add support for Optional Chaining

* Add grammar error for invalid tagged template, more tests

* Prototype

* PR feedback

* Add errors for invalid assignments and a trailing '?.'

* Add additional signature help test, fix lint warnings

* Fix to insert text for completions

* Add initial control-flow analysis for optional chains

* PR Feedback and more tests

* Update to control flow

* Remove mangled smart quotes in comments

* Fix lint, PR feedback

* Updates to control flow

* Switch to FlowCondition for CFA of optional chains

* Fix ?. insertion for completions on type variables

* Accept API baseline change

* Clean up types

* improve control-flow debug output

* Revert Debug.formatControlFlowGraph helper
2019-09-30 12:33:28 -07:00

16 lines
441 B
TypeScript

//// [callChain.2.ts]
declare const o1: undefined | (() => number);
o1?.();
declare const o2: undefined | { b: () => number };
o2?.b();
declare const o3: { b: (() => { c: string }) | undefined };
o3.b?.().c;
//// [callChain.2.js]
var _a, _b, _c, _d;
(_a = o1) === null || _a === void 0 ? void 0 : _a();
(_b = o2) === null || _b === void 0 ? void 0 : _b.b();
(_d = (_c = o3).b) === null || _d === void 0 ? void 0 : _d.call(_c).c;