microsoft / microsoft/TypeScript
Vanilla JS: Mixins break inherited type hints
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.4k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.84.2
- OS Version: Windows 10
The issue is quite simple, as shown below, mixins break inherited type hints. exampleMethod() below should have hint references for this.myStr and this.propIsHinted but does not.
Apologies if this belongs somewhere else like the typescript repo, it's vanilla JS but it's probably related to typescript/JSDoc functionality.
function NumberMixin( Base ) {
return class NumberMixin extends Base {
/** @type {number} */
myNum;
};
}
function StringMixin( Base ) {
return class StringMixin extends Base {
/** @type {string} */
myStr;
};
}
class MyBase {
/** @type {boolean} */
propIsHinted;
}
class SuperClass extends NumberMixin(StringMixin(MyBase)) {
exampleMethod() {
// Hinted
this.myNum;
// Not hinted
this.myStr;
// Not hinted
this.propIsHinted;
}
}
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
Run the provided JavaScript mixin example in the TypeScript or VS Code context to reproduce the missing hints. Start by tracing JSDoc type inference for inherited classes and nested mixins; done means exampleMethod() provides hints for myNum, myStr, and propIsHinted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100