diff --git a/lib/compat-shim.ts b/lib/compat-shim.ts index 131c98e3..ba10ac9f 100644 --- a/lib/compat-shim.ts +++ b/lib/compat-shim.ts @@ -1,12 +1,14 @@ import type * as Tslint from "tslint"; +type LinterTslintV3 = (filePath: string, text: string, configuration: Tslint.ILinterOptions) => { lint: () => Tslint.LintResult[] } + /** * Shim for TSLint v3 interoperability * @param {Function} Linter TSLint v3 linter * @return {Function} TSLint v4-compatible linter */ -export function shim(Linter: Function): typeof Tslint.Linter { - function LinterShim(options) { +export function shim(Linter: LinterTslintV3): typeof Tslint.Linter { + function LinterShim(options: Tslint.ILinterOptions) { this.options = options; this.results = {}; } @@ -17,9 +19,9 @@ export function shim(Linter: Function): typeof Tslint.Linter { // Assign instance methods LinterShim.prototype = { ...Linter.prototype, - lint(filePath, text, configuration) { - const options = { ...this.options, configuration }; - const linter = new Linter(filePath, text, options); + lint(filePath: string, text: string, configuration: Tslint.ILinterOptions) { + const options : Tslint.ILinterOptions = { ...this.options, configuration }; + const linter = new Linter(filePath, text, options) as ReturnType; this.results = linter.lint(); }, getResult() {