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

Fix type parameter of applyWithFunction #2396

Merged
merged 1 commit into from
Mar 31, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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