angular-docs-cn/dev-infra/tslint-rules
Paul Gschwendtner 04642e7985 feat(dev-infra): add lint rule to enforce no-implicit-override abstract members (#42512)
TypeScript introduced a new flag called `noImplicitOverride` as part
of TypeScript v4.3. This flag introduces a new keyword called `override`
that can be applied to members which override declarations from a base
class. This helps with code health as TS will report an error if e.g.
the base class changes the method name but the override would still
have the old method name. Similarly, if the base class removes the method
completely, TS would complain that the memeber with `override` no longer
overrides any method.

A similar concept applies to abstract methods, with the exception that
TypeScript's builtin `noImplicitOverride` option does not flag members
which are implemented as part of an abstract class. We want to enforce
this as a best-practice in the repository as adding `override` to such
implemented members will cause TS to complain if an abstract member is
removed, but still implemented by derived classes.

More details: https://github.com/microsoft/TypeScript/issues/44457.

PR Close #42512
2021-07-12 13:11:16 -07:00
..
BUILD.bazel feat(dev-infra): add lint rule to enforce no-implicit-override abstract members (#42512) 2021-07-12 13:11:16 -07:00
noImplicitOverrideAbstractRule.ts feat(dev-infra): add lint rule to enforce no-implicit-override abstract members (#42512) 2021-07-12 13:11:16 -07:00