Commit 4362f67
Add declare to class fields in child class that overrides a base clas… (#2673)
…s field without explicitly reinitializing the field
According to an internal Google audit of TS code: When public class
fields are enabled and target output is set to ES2022, TypeScript
reports the following error -
```
class A {
x: SomeType = new SomeType();
}
class B extends A {
override x!: NarrowType; // Property 'x' will overwrite the base property in 'A'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration.
}
```
---------
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>1 parent 2444d72 commit 4362f67
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
215 | | - | |
| 215 | + | |
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
| |||
0 commit comments