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

Commit f03c1ad

Browse files
ajafffjkillian
authored andcommitted
Fix type parameter of applyWithFunction (#2396)
Type of `options` should not be used to infer type parameter `T`. Refs: microsoft/TypeScript#14829
1 parent b55a9f9 commit f03c1ad

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/language/rule/abstractRule.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,16 @@ export abstract class AbstractRule implements IRule {
4949
}
5050

5151
protected applyWithFunction(sourceFile: ts.SourceFile, walkFn: (ctx: WalkContext<void>) => void): RuleFailure[];
52-
protected applyWithFunction<T>(sourceFile: ts.SourceFile, walkFn: (ctx: WalkContext<T>) => void, options: T): RuleFailure[];
53-
protected applyWithFunction<T>(sourceFile: ts.SourceFile, walkFn: (ctx: WalkContext<T | void>) => void, options?: T): RuleFailure[] {
52+
protected applyWithFunction<T, U extends T>(
53+
sourceFile: ts.SourceFile,
54+
walkFn: (ctx: WalkContext<T>) => void,
55+
options: U,
56+
): RuleFailure[];
57+
protected applyWithFunction<T, U extends T>(
58+
sourceFile: ts.SourceFile,
59+
walkFn: (ctx: WalkContext<T | void>) => void,
60+
options?: U,
61+
): RuleFailure[] {
5462
const ctx = new WalkContext(sourceFile, this.ruleName, options);
5563
walkFn(ctx);
5664
return this.filterFailures(ctx.failures);

0 commit comments

Comments
 (0)