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.