Closed
Description
type Bool = 'true' | 'false'
type Or<A extends Bool, B extends Bool> = A extends 'true' ? 'true' : B;
type And<A extends Bool, B extends Bool> = A extends 'true' ? B extends 'true' ? 'true' : 'false' : 'false';
type Not<T extends Bool> = T extends 'true' ? 'false' : 'true';
type Test = Not<'true'>
type Test1 = Not<'false'>
type Test3 = Not<Or<'true', 'false'>>
type Test4 = And<Not<'true'>, Not<'false'>>
function test(a: Bool): Not <typeof a> {
switch (a) {
case 'false': return 'false';
case 'true': return 'true';
}
}
The test function is supposed to return 'true' for input 'false' and vice-versa. But I don't get a error for the above implementation.