TypeScript/tests/cases/conformance/salsa/constructorFunctions3.ts
Nathan Shively-Sanders dca3a94f88
Print js-constructor function type names (#23089)
* Print js-constructor function type names

Instead of printing them as a type literal, which is scary.

* Use assigned name for functions and classes

That otherwise have no name. This helps quick info for javascript a
*lot*. Typescript mainly benefits when printing the type of class
expressions.

* Improve names of functions in binding elements

Also fix some fourslash baselines
2018-04-04 15:43:41 -07:00

39 lines
573 B
TypeScript

// @noEmit: true
// @allowJs: true
// @checkJs: true
// @noImplicitAny: true
// @Filename: a.js
function Instance() {
this.i = 'simple'
}
var i = new Instance();
Instance;
i;
function StaticToo() {
this.i = 'more complex'
}
StaticToo.property = 'yep'
var s = new StaticToo();
s;
StaticToo;
// Both!
function A () {
this.x = 1
/** @type {1} */
this.second = 1
}
/** @param {number} n */
A.prototype.z = function f(n) {
return n + this.x
}
/** @param {number} m */
A.t = function g(m) {
return m + 1
}
var a = new A()
a.z(3)
A.t(2)
a.second = 1