microsoft / microsoft/TypeScript
Typedef of object with generic property fails since 5.1
Open
@sandersn is already working on this.
Since Jun 12, 2023.
Needs Investigation
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.4k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
Bug Report
🔎 Search Terms
generic typedef object
🕗 Version & Regression Information
- This changed between versions 5.0.4 and 5.1.3
⏯ Playground Link
Playground link with relevant code
💻 Code
/**
* @typedef {Object} O
* @property {Array<T>} a Array of T
* @template T
*/
🙁 Actual behavior
Templated properties produce an error since upgrading TS to 5.1.3
🙂 Expected behavior
Generic properties should work as in 5.0.4
This still works, but it should be functionally equivalent to the typedef above. Though the syntax with @property is preferable as each property can be documented with a description.
/**
* @typedef {{a: Array<T>}} O
* @template T
*/
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.