microsoft / microsoft/TypeScript
Function's attached JSDoc is not preserved when using OmitThisParameter
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.4k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
Bug Report
🔎 Search Terms
JSDoc, types with docs, preserve docs, OmitThisParameter, bind, inherit description
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about "Something to do with
this" and "Strong typing ofFunctionmemberscall/bind/apply"
⏯ Playground Link
Playground link with relevant code
💻 Code
/**
* This description is lost
*
* @param p As well as this decription
*/
function func(this: {}, p: string): void {}
const f = func as OmitThisParameter<typeof func>;
const g = func.bind({});
🙁 Actual behavior
Hovering over f (or g) shows the type but not the descriptions that were attached to func.
🙂 Expected behavior
f and g to inherit the descriptions of func.
Clarification
The problem mainly lies with OmitThisParameter as bind's declaration uses it.
I'm also not sure if this is considered a bug or a missing feature, so I apologize in advance if this is not the right way to report it.
Might be related to #50715
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 provided Playground reproduction and inspect how OmitThisParameter is declared and applied to func, including the bind declaration that uses it. The issue is done when hovering over f and g preserves func's description and @param documentation, with the existing behavior checked against the related #50715 discussion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100