Closed
Description
Bug Report
π Search Terms
narrow {} custom type guard type assertion Record<string,any>
π Version & Regression Information
- This changed between versions 4.8.0-dev.20220715 and 4.8.0-dev.20220716
β― Playground Link
π» Code
function isObject(o: unknown): o is Record<string, any> {
return true;
}
function assertObject(o: unknown): asserts o is Record<string, any> {
}
let value: {} = null!;
if(isObject(value)) {
value.aything // error since 4.8.0-dev.20220716
}
assertObject(value)
value.aything // error since 4.8.0-dev.20220716
π Actual behavior
value.aything
is an error even after the custom type assertions/guards. value
still apears as {}
instead of Record<string, any>
π Expected behavior
Should be able to access value.aything
after custom assertion/guard and value
should be of type Record<string, any>
in if
, after assertion.
Metadata
Metadata
Assignees
Labels
No labels