-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationRelates to JSDoc parsing and type generationDomain: JavaScriptThe issue relates to JavaScript specificallyThe issue relates to JavaScript specifically
Milestone
Description
/**
* @constructor
* @template {string} K
* @template V
*/
function Multimap() {
/** @type {Object<string, V>} TODO: Remove the prototype from the fresh object */
this._map = {};
};
var Ns = {}
/** @type {Multimap<"a" | "b", number>} */
const map = new Multimap();
const n = map._map['hi']
Expected behavior:
n: number
Actual behavior:
n: any
in 3.0; n: V
in 3.1-dev.
Types resolved from functions are never properly generic, even that function has @template
-specified type parameters; they're only special-cased in a few places to produce a specific instantiation of a type. They should use the normal generic type machinery that Typescript does.
brendankenny, schpet, zfeher, que-etc, jt-helsinki and 19 more
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationRelates to JSDoc parsing and type generationDomain: JavaScriptThe issue relates to JavaScript specificallyThe issue relates to JavaScript specifically