-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Lint rule for definite assignment assertions with immediate initialization #21207
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
Comments
@DanielRosenwasser I just tried
That means there is no need for a lint rule for declarations with initializer. I'm currently only linting for assertions that are unnecessary because the type is an undefined union: let foo!: string | undefined; // unnecessary assertion class Foo {
prop!: string; // unnecessary assertion
constructor() {
this.prop = 1;
}
} To detect if a definite assignment assertion is unnecessary because the property is initialized in the constructor (see above), we'd need a new API (similar to #20221 but specialized for properties) |
Marking as |
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed. |
Seems like a weird construct. In #20117 we said we should write a lint rule for this.
The text was updated successfully, but these errors were encountered: