1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
// @strict: true
// @declaration: true
// Repro from #47996
type Equals<A, B> = (<T>() => T extends B ? 1 : 0) extends (<T>() => T extends A ? 1 : 0) ? true : false;
declare class State<TContext> {
_context: TContext;
_value: string;
matches<TSV extends string>(stateValue: TSV): this is State<TContext> & { value: TSV };
}
function f1(state: State<{ foo: number }>) {
if (state.matches('a') && state.matches('a.b')) {
state; // never
type T1 = Equals<typeof state, never>; // true
type T2 = Equals<never, never>; // true
}
}
|