* Add unmeasurable variance kind for marking types whose variance result is unreliable * Remove now-unneeded nongeneric checks * Add rule allowing `Readonly<any>` to be `any` instead of `{readonly [index: string]: any}` * All Unmeasurable variances to still shortcut structural comparisons in some cases * Separate unmeasurable from unreliable to reduce the impact of this change, for now * Fix lint * Remove Readonly<any> -> any callout * Add fix for circularity error triggered by deep signature return type comparisons with `this` types
19 lines
397 B
TypeScript
19 lines
397 B
TypeScript
// @strict: true
|
|
class A<T> {
|
|
unmeasurableUsage!: {[K in keyof T]-?: T[K]};
|
|
}
|
|
|
|
class B<T> extends A<T> {
|
|
method(): string | (this extends C ? undefined : null) {
|
|
return "";
|
|
}
|
|
}
|
|
|
|
class C<T = any> extends B<T> {
|
|
marker!: string;
|
|
}
|
|
|
|
const x = new C<{}>();
|
|
|
|
const y = x.method(); // usage flags `method` in `B` as circular and marks `y` as the error-any type
|