Skip to content

Unable to make class generic with JSDoc #18135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JoelEinbinder opened this issue Aug 30, 2017 · 3 comments
Closed

Unable to make class generic with JSDoc #18135

JoelEinbinder opened this issue Aug 30, 2017 · 3 comments
Assignees
Labels
Bug A bug in TypeScript Domain: JSDoc Relates to JSDoc parsing and type generation Fixed A PR has been merged for this issue

Comments

@JoelEinbinder
Copy link
Contributor

TypeScript Version: 2.6.0-dev.20170829

/**
 * @template T
 */
class MyArray {
  constructor() {
    /** @type {Array<T>} */
    this.array = [];
  }
}
/** @type {MyArray<string>} */
let x = new MyArray();

Expected behavior:
x should contain an array of strings.

Actual behavior:
[js] Cannot find name 'T'.
[js] Type 'MyArray' is not generic.

@JoelEinbinder JoelEinbinder changed the title Unable to make Unable to make class generic with JSDoc Aug 30, 2017
@kitsonk
Copy link
Contributor

kitsonk commented Aug 30, 2017

Could this be a duplicate of #17140?

@sandersn
Copy link
Member

Just to make sure, this is in a .js file, right?

@JoelEinbinder
Copy link
Contributor Author

Yes, this is in a .js file.

My compilerOptions:

{
    "noEmit": true,
    "allowJs": true,
    "checkJs": true,
    "target": "es2017"
}

@mhegazy mhegazy added Bug A bug in TypeScript Domain: JSDoc Relates to JSDoc parsing and type generation Salsa labels Aug 30, 2017
@mhegazy mhegazy added this to the TypeScript 2.6 milestone Aug 30, 2017
@mhegazy mhegazy modified the milestones: TypeScript 2.7, TypeScript 2.8 Jan 9, 2018
@mhegazy mhegazy modified the milestones: TypeScript 2.8, TypeScript 2.9 Mar 9, 2018
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Apr 19, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Domain: JSDoc Relates to JSDoc parsing and type generation Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants