Skip to content

TS4116: Type is not included in the union

Error message

                Type 'X' is not included in the union type of the discriminant property.
              

Quick summary

Your switch case value doesn't match any union member's discriminant property value.

Why this happens

  • Switch case value doesn't match any union member's discriminant

  • Typo in the case value

  • New union member added but switch not updated

Minimal example

✗ Broken code
type Shape = { kind: 'circle' } | { kind: 'square' };
function area(s: Shape) {
  switch (s.kind) {
    case 'circle': return 0;
    case 'square': return 0;
    case 'triangle': return 0; // TS4116
  }
}
✓ Fixed code
type Shape = { kind: 'circle' } | { kind: 'square' };
function area(s: Shape) {
  switch (s.kind) {
    case 'circle': return 0;
    case 'square': return 0;
  }
}

Remove the case that doesn't match any union member.

How to diagnose

  • Check the discriminant property values in the union type

  • Compare against the switch case values

How to fix

  • Fix the case value to match a valid union member

  • Remove the case if it's not needed

  • Add the new member to the union type if it's a new case

← Back to language