Open
Description
openedon Feb 27, 2021
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
⏯ 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment