Bug Report
🕗 Version & Regression Information
ts stable & nightly
⏯ Playground Link
Playground Link
💻 Code
function Narrow<T>(value: any): asserts value is T {}
function test(foo: any, bar: any) {
Narrow<number>(foo), Narrow<string>(bar);
foo; // foo: number;
bar; // bar: any;
}
🙁 Actual behavior
foo is asserted as number, bar is asserted as string.
The type of foo becomes number, but the type of bar is still any.
🙂 Expected behavior
Type of bar to be narrowed to string.
Bug Report
🕗 Version & Regression Information
ts stable & nightly
⏯ Playground Link
Playground Link
💻 Code
🙁 Actual behavior
foois asserted asnumber,baris asserted asstring.The type of
foobecomesnumber, but the type ofbaris stillany.🙂 Expected behavior
Type of
barto be narrowed tostring.