TypeScript/tests/cases/conformance/salsa/typeFromPrototypeAssignment2.ts
Nathan Shively-Sanders c9f190283e
Fix non-toplevel prototype assignment (#27096)
* Fix non-toplevel prototype assignment

binder was using the wrong node to lookup the containing class type for
prototype assignment, so it incorrectly put the prototype declaration on
the class' symbol.

This correction to the binder in turn required a change in
getJSClassType in the checker. It now has to look at the "prototype"
property for the prototype instead of looking on the class symbol's exports
(which makes no sense).

* Refactor per PR suggestion
2018-09-17 13:07:05 -07:00

47 lines
821 B
TypeScript

// @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: a.js
// @strict: true
// non top-level:
// all references to _map, set, get, addon should be ok
(function container() {
/** @constructor */
var Multimap = function() {
this._map = {};
this._map
this.set
this.get
this.addon
};
Multimap.prototype = {
set: function() {
this._map
this.set
this.get
this.addon
},
get() {
this._map
this.set
this.get
this.addon
}
}
Multimap.prototype.addon = function () {
this._map
this.set
this.get
this.addon
}
var mm = new Multimap();
mm._map
mm.set
mm.get
mm.addon
});