TypeScript · Senior · Question 63 of 75
What is { id: string } & { id: number }?
- ✓Correct answer: An object type whose
idisstring & number, i.e.never, so no value can satisfy it - 2
{ id: string | number } - 3A compile error at declaration
Explanation
Conflicting intersections don't fail immediately; errors appear later in confusing places. Prefer interface extends, which reports conflicts at once.