TypeScript/tests/cases/conformance/salsa/typeFromPropertyAssignment10_1.ts
Wenlu Wang 7c50bccec2 nullish coalescing commit (#32883)
* migrate nullish coalescing commit

* add more test case

* add branch type check test

* add more tests

* fix nullish precedence

* update public api

* add rescan question question token to fix regression

* update public api baseline

* Added tests that emit for nullish coalescing operator conforming with grammar restrictions when assertions are used.

* Fixed emit to hoist temporary variables (they previously went undeclared).
Added tests to ensure calls and property accesses are only called once.

* use not equal to null

* rename factory

* add grammar check

* fix more cases

* Fix handling of nullish coalescing oprator in expando objects.

* Fixed classifier to support ?? operator.

* update baseline

* accept baseline

* fix review

* update emitter and more testcase

* update control flow

* make linter happy

* update libs

* avoid unnecessary assert

* fix typooo

* Fixes for control-flow analysis
2019-09-30 15:33:50 -07:00

49 lines
1 KiB
TypeScript

// @noEmit: true
// @allowJs: true
// @checkJs: true
// @target: esnext
// @Filename: module.js
var Outer = Outer ?? {};
Outer.app = Outer.app ?? {};
// @Filename: someview.js
Outer.app.SomeView = (function () {
var SomeView = function() {
var me = this;
}
return SomeView;
})();
Outer.app.Inner = class {
constructor() {
/** @type {number} */
this.y = 12;
}
}
var example = new Outer.app.Inner();
example.y;
/** @param {number} k */
Outer.app.statische = function (k) {
return k ** k;
}
// @Filename: application.js
Outer.app.Application = (function () {
/**
* Application main class.
* Will be instantiated & initialized by HTML page
*/
var Application = function () {
var me = this;
me.view = new Outer.app.SomeView();
};
return Application;
})();
// @Filename: main.js
var app = new Outer.app.Application();
var inner = new Outer.app.Inner();
inner.y;
/** @type {Outer.app.Inner} */
var x;
x.y;
Outer.app.statische(101); // Infinity, duh