TypeScript/tests/cases/conformance/salsa/typeFromPropertyAssignment18.ts
Nathan Shively-Sanders 5be8f1f9f9
Better handling of circular JS containers in getTypeOfVariableOrParameterOrProperty (#24732)
* avoid circularity in getTypeOfVariableOrParameterOrProperty

Modify getTypeOfVariableOrParameterOrProperty to get the type of the
variable declaration before widening it. This essentially avoids some
circularities by (1) setting the type of the variable declaration to the
unwidened type (2) updating the type of the variable declaration to the
widened one.

You will still get a circular noImplicitAny in (1), for expressions that
actually are circular, but not in (2), for the containers of things that
are not themselves circular.

* Stop checking js init object literals via checkObjectLiteral

* checkBinaryExpression: new code for special assignments

* Chained lookup for js initializer type

* Check for JS-specific types only once

Also make sure to respect the type annotation if there is one.

* Accept API changes
2018-06-12 09:42:26 -07:00

15 lines
201 B
TypeScript

// @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: a.js
var GLOBSTAR = m.GLOBSTAR = {}
function m() {
}
GLOBSTAR.p = 1
m.GLOBSTAR.q = 2
GLOBSTAR.p
GLOBSTAR.q
m.GLOBSTAR.p
m.GLOBSTAR.q