What does the TypeScript ‘?’ symbol mean when used in an interface property like ‘name?: string’?

TypeScript Associate Medium

TypeScript Associate — Medium

What does the TypeScript ‘?’ symbol mean when used in an interface property like ‘name?: string’?

Key points

  • The '?' symbol makes a property optional in TypeScript interfaces
  • It allows the property to be omitted or left undefined
  • This is useful for scenarios where a property is not always required

Ready to go further?

Related questions