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

Commit

Permalink
Fix type parameter of applyWithFunction (#2396)
Browse files Browse the repository at this point in the history
Type of `options` should not be used to infer type parameter `T`.
Refs: microsoft/TypeScript#14829
  • Loading branch information
ajafff authored and jkillian committed Mar 31, 2017
1 parent b55a9f9 commit f03c1ad
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/language/rule/abstractRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,16 @@ export abstract class AbstractRule implements IRule {
}

protected applyWithFunction(sourceFile: ts.SourceFile, walkFn: (ctx: WalkContext<void>) => void): RuleFailure[];
protected applyWithFunction<T>(sourceFile: ts.SourceFile, walkFn: (ctx: WalkContext<T>) => void, options: T): RuleFailure[];
protected applyWithFunction<T>(sourceFile: ts.SourceFile, walkFn: (ctx: WalkContext<T | void>) => void, options?: T): RuleFailure[] {
protected applyWithFunction<T, U extends T>(
sourceFile: ts.SourceFile,
walkFn: (ctx: WalkContext<T>) => void,
options: U,
): RuleFailure[];
protected applyWithFunction<T, U extends T>(
sourceFile: ts.SourceFile,
walkFn: (ctx: WalkContext<T | void>) => void,
options?: U,
): RuleFailure[] {
const ctx = new WalkContext(sourceFile, this.ruleName, options);
walkFn(ctx);
return this.filterFailures(ctx.failures);
Expand Down

0 comments on commit f03c1ad

Please sign in to comment.