declare function isString(v: any): v is string;
declare function isNumber(v: any): v is number;
declare let value: number;
// this condition will probably always be false, otherwise you have some really messed up code
if (isString(value)) {
value.charAt(0);
}
// typeguard is useless because `value` is already `number` or a subtype thereof
if (isNumber(value)) {
value.toFixed(0);
}
This needs type relationship APIs to detect if the typeguard type is not assignable to the original type.
This needs type relationship APIs to detect if the typeguard type is not assignable to the original type.