# override

> The `override` keyword in TypeScript marks a class member that overrides a member of the base class.

## What does the override keyword do in TypeScript?

The keyword that explicitly marks a method or property as overriding a member of the base class. TS reports an error if the base class has no such member, and the `noImplicitOverride` option makes the keyword mandatory.

- Topic: Classes
- Type: keyword

## Example

Wrong:

```ts
class Doc extends Base {
  save() {
    super.save();
  }
}
```

Right:

```ts
class Doc extends Base {
  override save() {
    super.save();
  }
}
```

With `override`, renaming or removing `Base.save` becomes a compile error instead of a silent new method.

## Common mistakes

- Renaming a base method silently leaves the old subclass method as dead code without `override`.

## Key points

- `noImplicitOverride` is enabled, so every overriding member must be marked `override`.
- Every overriding method and property carries `override`, and methods that do not override the base do not.

## Interview questions

### Is the override keyword required?

Only with `noImplicitOverride`. Without that option it is optional but still checked when present.

### Does override appear in the compiled JavaScript?

No, it is erased. It only tells the compiler to check that the base member exists.

## Related cards

- [Method Overriding](https://wonderium.dev/ts/method-overriding.md)
- [abstract](https://wonderium.dev/ts/abstract.md)
- [class](https://wonderium.dev/ts/class.md)
- [Compiler Options](https://wonderium.dev/ts/compiler-options.md)
- [Access Modifiers](https://wonderium.dev/ts/access-modifiers.md)

---

- Level: [TypeScript](https://wonderium.dev/ts.md)
- HTML version: https://wonderium.dev/ts/override
- Last updated: 2026-11-25
