Closed
Description
TypeScript Version:
1.8.0
Code
const enum AsNonBlank {}
export function isNonBlank(value: string) : value is string & AsNonBlank {
return !/^\s*$/g.test(value);
}
let value: string;
if (isNonBlank(value)) {
doThis(value); // expected value to be string & AsNonBlank, actual: string
} else {
doThat(value);
}
function doThis(value: string & AsNonBlank): void {
}
function doThat(value: string) : void {
}
Expected behavior:
value should either be string & AsNonBlank
or there must be a message saying that the type guard is invalid or something
Actual behavior:
value is a string
Metadata
Metadata
Assignees
Labels
No labels