TypeScript/tests/cases/conformance/salsa/typeFromPropertyAssignment24.ts
Nathan Shively-Sanders 30994c86e4
Improve valueDeclaration for js module merges (#24707)
Nearly everything in a merge of JS special assignments looks like a
valueDeclaration. This commit ensures that intermediate "module
declarations" are not used when a better valueDeclaration is available:

```js
// File1.js
var X = {}
X.Y.Z = class { }

// File2.js
X.Y = {}
```

In the above example, the `Y` in `X.Y.Z = class { }` was used as the
valueDeclaration for `Y` because it appeared before `X.Y = {}` in the
compilation.

This change exposed a bug in binding, #24703, that required a change in
typeFromPropertyAssignmentOutOfOrder. The test still fails for the
original reason it was created, and the new bug #24703 contains a repro.
2018-06-06 11:11:15 -07:00

22 lines
369 B
TypeScript

// @noEmit: true
// @checkJs: true
// @allowJs: true
// @Filename: usage.js
// note that usage is first in the compilation
Outer.Inner.Message = function() {
};
var y = new Outer.Inner()
y.name
/** @type {Outer.Inner} should be instance type, not static type */
var x;
x.name
// @Filename: def.js
var Outer = {}
Outer.Inner = class {
name() {
return 'hi'
}
}