Bug Report
You can destructure or use bracket notation on never type, but you can't access props using the dot notation. It should disallow all forms of property access.
🔎 Search Terms
never destructuring destructure bracket dot notation
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ ✔️
⏯ Playground Link
Playground link
🙁 Actual behavior
const { prop } = ({} as never); // does not error
const prop2 = ({} as never)["prop"]; // does not error
🙂 Expected behavior
TS should not allow this, same as you can't access props using the dot notation:
const prop = ({} as never).prop; // error
Bug Report
You can destructure or use bracket notation on
nevertype, but you can't access props using the dot notation. It should disallow all forms of property access.🔎 Search Terms
never destructuring destructure bracket dot notation
🕗 Version & Regression Information
⏯ Playground Link
Playground link
🙁 Actual behavior
🙂 Expected behavior
TS should not allow this, same as you can't access props using the dot notation: