You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First seen in 4.1.2, reproduced in 4.4.3 and 4.5.0-dev.20210919.
This is the behavior in every version I tried, and I reviewed the FAQ for entries about "Type System Behavior", "Type Guards", "Things That Don't Work"
Bug Report
🔎 Search Terms
const assertion
const narrow
assertion narrow
🕗 Version & Regression Information
First seen in 4.1.2, reproduced in 4.4.3 and 4.5.0-dev.20210919.
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
TypeScript is not able to narrow
test[constField]
fromundefined|number
tonumber
🙂 Expected behavior
TypeScript infers that
test[constField]
is simplynumber
in theif
blockThe text was updated successfully, but these errors were encountered: