You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rule no-unnecessary-type-assertion doesn't work if your tsconfig.json has "strict": true. It was made so that it only works if you have "strictNullChecks": true but should also work for "strict": true since that covers all strict rules.
Bug Report
Rule no-unnecessary-type-assertion doesn't work if your
tsconfig.jsonhas"strict": true. It was made so that it only works if you have"strictNullChecks": truebut should also work for"strict": truesince that covers all strict rules.Bug introduction: b836f28#diff-2237d1e758ab18614b7d976b89e56ea0R53
Strict rule explanation: https://www.typescriptlang.org/docs/handbook/compiler-options.html
Note, will fix this myself so PR incoming.
Reproduction using TSLint Playground
Playground doesn't allow you to change the tsconfig?
TypeScript code being linted
tsconfig.json
{ "compilerOptions": { /* Enable all strict type-checking options. */ "strict": true, /* Enable strict null checks. */ // "strictNullChecks": true } }Code
with
tslint.jsonconfiguration:{ "defaultSeverity": "error", "rules": { "no-unnecessary-type-assertion": true } }Actual behavior
No errors.
Expected behavior
An error!