microsoft / microsoft/TypeScript
Comment is not infered correctly when using generic type
Open
Nobody has claimed this yet.
Awaiting More Feedback
Domain: LS: Quick Info
Suggestion
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.4k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
Bug Report
🔎 Search Terms
generic comment
🕗 Version & Regression Information
4.4.2
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
⏯ Playground Link
💻 Code
interface User {
/**
* My Comment Here...
*/
name: string
}
// Expected
// When cursor is on 'name', comment of 'name' appeared
function func1(user: User) {}
func1({
name: 'XXX'
})
// Unexpected
// When cursor is on 'name', no comment appeared
function func2<T extends User>(user: T) {}
func2({
name: 'XXX'
})
🙁 Actual behavior
No comment for func2

🙂 Expected behavior
Show comment for func2

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.
Research direction
Start with the linked TypeScript 4.4.2 Playground repro and compare comment inference for func1 and generic func2. Trace the comment lookup for the name property in both examples, then verify that the generic call shows “My Comment Here...” as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100