From f03c1ad62d9a00a88477b186c3670a399f7bfbae Mon Sep 17 00:00:00 2001 From: Klaus Meinhardt Date: Fri, 31 Mar 2017 17:04:20 +0200 Subject: [PATCH] Fix type parameter of applyWithFunction (#2396) Type of `options` should not be used to infer type parameter `T`. Refs: https://github.com/Microsoft/TypeScript/issues/14829 --- src/language/rule/abstractRule.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/language/rule/abstractRule.ts b/src/language/rule/abstractRule.ts index a31168c1d81..09e821ed46f 100644 --- a/src/language/rule/abstractRule.ts +++ b/src/language/rule/abstractRule.ts @@ -49,8 +49,16 @@ export abstract class AbstractRule implements IRule { } protected applyWithFunction(sourceFile: ts.SourceFile, walkFn: (ctx: WalkContext) => void): RuleFailure[]; - protected applyWithFunction(sourceFile: ts.SourceFile, walkFn: (ctx: WalkContext) => void, options: T): RuleFailure[]; - protected applyWithFunction(sourceFile: ts.SourceFile, walkFn: (ctx: WalkContext) => void, options?: T): RuleFailure[] { + protected applyWithFunction( + sourceFile: ts.SourceFile, + walkFn: (ctx: WalkContext) => void, + options: U, + ): RuleFailure[]; + protected applyWithFunction( + sourceFile: ts.SourceFile, + walkFn: (ctx: WalkContext) => void, + options?: U, + ): RuleFailure[] { const ctx = new WalkContext(sourceFile, this.ruleName, options); walkFn(ctx); return this.filterFailures(ctx.failures);