Skip to content

Unable to make class generic with JSDoc #18135

@JoelEinbinder

Description

@JoelEinbinder

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.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions