Closed
Description
π Search Terms
5.5 Control Flow Narrowing for Constant Indexed Accesses
π Version & Regression Information
- This is a crash - No
- This changed in commit
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about
β― Playground Link
π» Code
type K = 'x' | 'y'
type O = {
x: number
}
declare const k: K
declare const o: O
if (k in o) {
// Element implicitly has an 'any' type because expression of type 'K' can't be used to index type 'O'.
// Property 'y' does not exist on type 'O'.(7053)
console.log(o[k])
}
π Actual behavior
The error is present in the v5.5.1-rc. The error text:
Element implicitly has an 'any' type because expression of type 'K' can't be used to index type 'O'. Property 'y' does not exist on type 'O'.(7053)
π Expected behavior
The error should've been resolved in the TypeScript 5.5
Additional information about the issue
No response
Metadata
Metadata
Assignees
Labels
No labels