Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add declare to class fields in child class that overrides a base clas… #2673

Merged
merged 3 commits into from
Nov 6, 2024

Conversation

bjaspan
Copy link
Contributor

@bjaspan bjaspan commented Nov 5, 2024

…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.

}

…s field without explicitly reinitializing the field
@bjaspan bjaspan requested a review from a team as a code owner November 5, 2024 18:57
Copy link
Member

@pokey pokey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to me. Any idea how we could catch this one in CI?

@pokey pokey added this pull request to the merge queue Nov 6, 2024
Merged via the queue into cursorless-dev:main with commit 4362f67 Nov 6, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants