QuizNot attempted
Overriding a native prop
1–4 to choose, Enter to submit
Show answer & explanation
Correct answer:
- An intersection would combine both
valuetypes ((string | number | readonly string[]) & T) instead of replacing it
- Intersecting two object types intersects the types of a property they share, so
ComponentProps<'input'> & { value?: T }would demand avaluethat is both a native input value and aT(oftenneverin practice) Omitremoves the native key first so yours replaces it.- Not 'faster at runtime': types are erased.
- Not 'intersections can't contain optional properties': they can.
- Not 'T inferred as any': inference is unaffected
- the property type is the problem.