mirror of
https://github.com/swc-project/swc.git
synced 2024-12-22 21:21:31 +03:00
28 lines
503 B
TypeScript
28 lines
503 B
TypeScript
// @strict: true
|
|
|
|
// Test cases for parameter variances affected by conditional types.
|
|
|
|
// Repro from #30047
|
|
|
|
interface Foo<T> {
|
|
prop: T extends unknown ? true : false;
|
|
}
|
|
|
|
const foo = { prop: true } as const;
|
|
const x: Foo<1> = foo;
|
|
const y: Foo<number> = foo;
|
|
const z: Foo<number> = x;
|
|
|
|
|
|
// Repro from #30118
|
|
|
|
class Bar<T extends string> {
|
|
private static instance: Bar<string>[] = [];
|
|
|
|
cast(_name: ([T] extends [string] ? string : string)) { }
|
|
|
|
pushThis() {
|
|
Bar.instance.push(this);
|
|
}
|
|
}
|