Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Commit

Permalink
uses ruleArguments instead of getOptions()
Browse files Browse the repository at this point in the history
  • Loading branch information
bowenni committed Sep 29, 2017
1 parent 571c61f commit 688e168
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/rules/noUnnecessaryTypeAssertionRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ export class Rule extends Lint.Rules.TypedRule {
public static FAILURE_STRING = "This assertion is unnecessary since it does not change the type of the expression.";

public applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[] {
return this.applyWithWalker(new Walker(sourceFile, this.ruleName, this.getOptions(), program.getTypeChecker()));
return this.applyWithWalker(new Walker(sourceFile, this.ruleName, this.ruleArguments, program.getTypeChecker()));
}
}

class Walker extends Lint.AbstractWalker<Lint.IOptions> {
constructor(sourceFile: ts.SourceFile, ruleName: string, options: Lint.IOptions, private readonly checker: ts.TypeChecker) {
class Walker extends Lint.AbstractWalker<string[]> {
constructor(sourceFile: ts.SourceFile, ruleName: string, options: string[], private readonly checker: ts.TypeChecker) {
super(sourceFile, ruleName, options);
}

Expand All @@ -67,7 +67,7 @@ class Walker extends Lint.AbstractWalker<Lint.IOptions> {
}

private verifyCast(node: ts.TypeAssertion | ts.NonNullExpression | ts.AsExpression) {
if (isAssertionExpression(node) && this.options.ruleArguments.indexOf(node.type.getText(this.sourceFile)) !== -1) {
if (isAssertionExpression(node) && this.options.indexOf(node.type.getText(this.sourceFile)) !== -1) {
return;
}
const castType = this.checker.getTypeAtLocation(node);
Expand Down

0 comments on commit 688e168

Please sign in to comment.