Advanced
TypeScript
Q92 / 100
What is the effect of "exactOptionalPropertyTypes" compiler option?
Correct! Well done.
Incorrect.
The correct answer is B) It distinguishes between a property being absent versus explicitly set to undefined when the property is marked optional
B
Correct Answer
It distinguishes between a property being absent versus explicitly set to undefined when the property is marked optional
Explanation
With exactOptionalPropertyTypes, "prop?: string" means the property can be omitted entirely but cannot be explicitly assigned the value undefined unless "| undefined" is included in the type.
Progress
92/100