Skip to content

Commit 4362f67

Browse files
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

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/cursorless-vscode/src/ScopeTreeProvider.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ function getSupportCategories(): SupportCategoryTreeItem[] {
212212
}
213213

214214
class ScopeSupportTreeItem extends TreeItem {
215-
public readonly label!: TreeItemLabel;
215+
public declare readonly label: TreeItemLabel;
216216

217217
/**
218218
* @param scopeTypeInfo The scope type info

0 commit comments

Comments
 (0)