-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issueenhancementNew feature or requestNew feature or requestpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin
Description
Repro
{
"rules": {
"@typescript-eslint/no-unnecessary-type-assertion": ["error"]
}
}
export class A {
data?: unknown;
}
export async function test(): Promise<unknown> {
let a: A = new A();
return a.data!;
}
Expected Result
no errors
Actual Result
This assertion is unnecessary since it does not change the type of the expression. eslint(@typescript-eslint/no-unnecessary-type-assertion)
Additional Info
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin |
2.3.3 |
@typescript-eslint/parser |
2.3.3 |
TypeScript |
3.6.3 |
ESLint |
6.5.1 |
node |
12.10.0 |
npm |
6.10.3 |
ab-pm, lddubeau, spudly, tomrav and vpzomtrrfrt
Metadata
Metadata
Assignees
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issueenhancementNew feature or requestNew feature or requestpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin