microsoft / microsoft/TypeScript

[bug] declaration files have invalid class member generics with mixin & multiple layer inheritance

Đang mở
#60,697 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

@weswigham đang làm issue này rồi.

Từ ngày 6/12/2024.

Bug Domain: Declaration Emit
Ngôn ngữ chính
Go
Star
111k
Fork
14.4k
Merge trung bình
1 ngày 19 giờ
Pull request đã merge (30 ngày)
117

Mô tả

🔎 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

https://www.typescriptlang.org/play/?#code/MYGwhgzhAEBCkFMA8AVAfNA3gKGn6EArgA4IBOAsggLYBG50AvFgL7STQrYvbAD2AOwgAXaBQCWAD3ECm0JABEwwsABpoAYXBRoCScIQCAJjAEIA7tAAUAOjtHlYAFzsBATwDaAXQCUTDPAQyEoqaGi4+FYAyiTkLlqQEH6MGKCJuvqGJtAxpGRYEfj41FIyVHQMzACMhdAsQA

💻 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.