Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save charlypoly/9f45873c4b72e3e7d8a192b5ae2cc071 to your computer and use it in GitHub Desktop.
Save charlypoly/9f45873c4b72e3e7d8a192b5ae2cc071 to your computer and use it in GitHub Desktop.
TypeScript Force checking index accesses (2)
let myPrices: number[] = [1, 2.4, 2.0]
const defaultPrice = myPrices[40]
// `defaultPrice` is of type `number | undefined`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment