microsoft / microsoft/TypeScript
[bug] declaration files have invalid class member generics with mixin & multiple layer inheritance
Open
@weswigham is already working on this.
Since Dec 6, 2024.
Bug
Domain: Declaration Emit
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
🔎 Search Terms
declaration .d.ts invalid class member field generic mixin inherit
🕗 Version & Regression Information
- This changed between versions ______ and _______
- This changed in commit or PR _______
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
- I was unable to test this on prior versions because _______
⏯ Playground Link
💻 Code
class Base<T> {
superMember = {} as T
}
const Mixin = <Data, Class extends new (...data: any[]) => Base<Data>>
(Super: Class) => class extends Super {
mixinMember = 1
}
🙁 Actual behavior
declare class Base<T> {
superMember: T;
}
declare const Mixin: <Data, Class extends new (...data: any[]) => Base<Data>>(Super: Class) => {
new (...data: any[]): {
mixinMember: number;
superMember: T; // invalid generic variable in .d.ts
};
} & Class;
🙂 Expected behavior
tsc generates completely valid .d.ts files with mixin inheritance.
Additional information about the issue
No response
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.