🔎 Search Terms
- asserts
- assertion function
- type guard
- record
🕗 Version & Regression Information
Worked on 4.9, broken since 5.0
Probably introduced by #52984
⏯ Playground Link
Playground link with relevant code
💻 Code
declare function isObject(o: unknown): o is Record<string, any>
declare function assertObject(o: unknown): asserts o is Record<string, any>
let value: {} = null!;
if(isObject(value)) {
value.anything // error since 5.0.2
}
assertObject(value)
value.anything // error since 5.0.2
🙁 Actual behavior
Property 'anything' does not exist on type '{}'.(2339)
🙂 Expected behavior
No error, narrowing / assertion should work fine.
🔎 Search Terms
🕗 Version & Regression Information
Worked on 4.9, broken since 5.0
Probably introduced by #52984
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
Property 'anything' does not exist on type '{}'.(2339)🙂 Expected behavior
No error, narrowing / assertion should work fine.