From 0bbce8856bb940df317ca948bb07d66f16a4a001 Mon Sep 17 00:00:00 2001 From: Klaus Meinhardt Date: Fri, 24 Mar 2017 08:55:34 +0100 Subject: [PATCH] Fix type parameter of applyWithFunction 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);