Deep Property Conflicts
In this lesson, you'll learn how conflicts in nested properties create surprising types and how to identify and resolve them.
The Nested Conflict Problem
When intersecting object types with nested properties, TypeScript doesn't just give up at the first level—it pushes conflicts all the way down. If two types disagree about a nested property's type, the result can be a deeply buried never type that's hard to spot.
type ConfigA = {
settings: {
timeout: number;
};
};
type ConfigB = {
settings: {
timeout: string;
};
};
type MergedConfig = ConfigA & ConfigB;
// Result: { settings: { timeout: never } }
The settings property exists in both types, so TypeScript intersects its value. Inside, timeout becomes number & string, which is never.
Debugging Strategies
Look for the never: When you get cryptic errors assigning values, check if hovering over properties reveals never deep in the structure.
Use smaller intersections: Build complex intersections piece by piece to catch conflicts early.
Test with assignments: Try assigning a literal object to your intersection type—TypeScript will complain at the exact conflicting property.
const config: MergedConfig = {
settings: {
timeout: 100 // Error: Type 'number' is not assignable to 'never'
}
};
Key Takeaway: Conflicts in nested properties propagate inward as never types, making intersection types unusable—always verify deep property compatibility when combining complex object types.