Let's say I have a union type as such, and want to implement a type guard, I can lie within the typeguard:
type A = {
on: false,
powered: false,
}
type B = {
on: true,
powered: true
}
type C = {
on: false,
powered: true
}
type AllStates = A | B | C
function isA(state: AllStates): state is A {
return state.on === false // but actually this could also be C
}
Is there a way to ensure that I can't accidentally do this?