mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
88d31a45dd
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: DanielRosenwasser <[email protected]>
49 lines
2.1 KiB
Plaintext
49 lines
2.1 KiB
Plaintext
declarationEmitForMixinsWithStaticAccessors1.ts(26,11): error TS2417: Class static side 'typeof C' incorrectly extends base class static side 'typeof A & typeof B'.
|
|
Types of property 'prototype' are incompatible.
|
|
Type 'C' is not assignable to type 'A & B'.
|
|
Property 'y' is missing in type 'C' but required in type 'B'.
|
|
declarationEmitForMixinsWithStaticAccessors1.ts(26,21): error TS2510: Base constructors must all have the same return type.
|
|
|
|
|
|
==== declarationEmitForMixinsWithStaticAccessors1.ts (2 errors) ====
|
|
// Regression test: when a class extends a mixin that returns an intersection,
|
|
// the class's anonymous constructor type inherits static accessor properties from the
|
|
// intersection. These synthetic properties can have a nil parent symbol when the
|
|
// constituent accessor declarations differ. Declaration emit must not crash when
|
|
// serializing these properties.
|
|
|
|
function mix<T extends new (...args: any[]) => any, U extends new (...args: any[]) => any>(
|
|
base1: T, base2: U
|
|
): T & U {
|
|
return null as any;
|
|
}
|
|
|
|
class A {
|
|
static get shared(): number { return 1; }
|
|
static set shared(v: number) { }
|
|
x: string = "";
|
|
}
|
|
|
|
class B {
|
|
static get shared(): number { return 2; }
|
|
static set shared(v: number) { }
|
|
y: number = 0;
|
|
}
|
|
|
|
function make() {
|
|
class C extends mix(A, B) {
|
|
~
|
|
!!! error TS2417: Class static side 'typeof C' incorrectly extends base class static side 'typeof A & typeof B'.
|
|
!!! error TS2417: Types of property 'prototype' are incompatible.
|
|
!!! error TS2417: Type 'C' is not assignable to type 'A & B'.
|
|
!!! error TS2417: Property 'y' is missing in type 'C' but required in type 'B'.
|
|
!!! related TS2728 declarationEmitForMixinsWithStaticAccessors1.ts:22:5: 'y' is declared here.
|
|
~~~~~~~~~
|
|
!!! error TS2510: Base constructors must all have the same return type.
|
|
z: boolean = true;
|
|
}
|
|
return C;
|
|
}
|
|
|
|
export const MixedClass = make();
|
|
|