You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TypeScript Version: 2.2.2 (VSCode 1.11.1 on macOS 10.12.4)
Code
// JavaScript./** * @param {T} a * @returns {function(): T} * @template T */functiong(a){return()=>a;}leth=g(1)();
Expected behavior: The type of h is inferred as number.
Actual behavior: The type of h is inferred as T...?
The text was updated successfully, but these errors were encountered:
kennytm
changed the title
JSDoc @template: Generates in return type of returned function is not evaluated.
JSDoc @template: Generics in return type of returned function is not evaluated.
Apr 13, 2017
When we check whether a type parameter is in scope, the code currently only checks for Typescript type parameters, not for @template tags in the JSDoc. Since the compiler doesn't know T is in scope for instantiation, it just leaves it instead of mapping it to number. I'll have a fix up shortly.
TypeScript Version: 2.2.2 (VSCode 1.11.1 on macOS 10.12.4)
Code
Expected behavior: The type of
h
is inferred asnumber
.Actual behavior: The type of
h
is inferred asT
...?The text was updated successfully, but these errors were encountered: