Closed
Description
Bug Report
π Version & Regression Information
ts stable & nightly
β― 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
.