What does the `?` operator do when used in an object type property like `{ name?: string }`?

TypeScript Associate Easy

TypeScript Associate — Easy

What does the `?` operator do when used in an object type property like `{ name?: string }`?

Key points

  • The `?` operator signifies optional properties in TypeScript.
  • Optional properties can be present or absent in an object.
  • This feature enhances the adaptability of object structures in TypeScript.

Ready to go further?

Related questions