What will TypeScript infer as the type of `let x = 5`?

TypeScript Associate Easy

TypeScript Associate — Easy

What will TypeScript infer as the type of `let x = 5`?

Key points

  • TypeScript infers types based on the assigned value
  • Numeric literals are inferred as the `number` type
  • Type inference helps catch errors early in development

Ready to go further?

Related questions