TS2416
TypeScript Programming Language
Severity: ModerateWhat Does This Error Mean?
A class method or property you overrode is not compatible with the base class version. TypeScript enforces the Liskov Substitution Principle — subclasses must be usable wherever the base class is. Fix the overriding method's signature to match or extend the base type.
Affected Models
- TypeScript 5.x
- TypeScript 4.x
- React + TypeScript
- Node.js + TypeScript
Common Causes
- Overriding a method with a narrower parameter type than the base class method
- Returning a type in an override that is not compatible with the base return type
- Implementing an interface method with a signature that does not match the interface
- Changing a method to accept fewer arguments than the base class method
- Using a completely different type in an overridden property
How to Fix It
-
Find the base class or interface method that your override is conflicting with.
Hold Ctrl and click the method name in VS Code to jump to the base definition.
-
Make your overriding method's parameter types at least as broad as the base type.
If the base accepts Animal, your override must also accept Animal — not a narrower subtype like Dog.
-
Make your return type at least as specific as the base type.
If the base returns Animal, your override can return Dog (a subtype). It cannot return a completely different type.
-
Use a union type in the override to accept both the base type and any additional types you need.
Example: if base takes string, override can take string | number to be broader.
-
If the base class design is wrong, refactor the base method to use a more flexible type from the start.
Using a generic type parameter on the base class method is a clean solution when subclasses genuinely differ.
When to Call a Professional
TS2416 is a design-level type error. You can fix it yourself by aligning the override signature. If the class hierarchy is deeply complex, a code review helps ensure the fix does not break callers.
Frequently Asked Questions
What is the Liskov Substitution Principle and why does TypeScript enforce it?
It says a subclass must be usable anywhere the base class is used. If an override narrows types, code that works with the base class may break when given a subclass. TypeScript catches this at compile time to prevent subtle runtime bugs.
Can I use @ts-ignore to bypass this error?
You can, but it hides a real design problem. Code that passes a base class instance to a function will fail at runtime if the subclass override cannot handle the same inputs. Fix the signatures instead.
What is the override keyword and should I use it?
The override keyword (TypeScript 4.3+) marks that a method intentionally overrides a base class method. TypeScript then errors if the base class method is removed — catching accidental orphaned overrides. It is good practice to use override on every method you intend to replace.