Skip to content
This repository has been archived by the owner on Jun 14, 2022. It is now read-only.

Add typings #11

Merged
merged 1 commit into from
Mar 20, 2018
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
26 changes: 26 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
declare module "tslint-webpack-plugin" {
import { Plugin } from "webpack";
import { Options as TslintOptions } from "tslint/lib/runner";

// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/9f4c75126167d0d8af759f58405d53d983e94ad0/types/react-redux/index.d.ts#L33-L34
type Diff<T extends string, U extends string> = ({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T];
type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>;

type OmittedOptions = {
files: string[];
exclude: string[];
}

// tslint-webpack-plugin is more liberal with the options than tslint's runner is, thus tweak the interface
interface Options extends Omit<TslintOptions, keyof OmittedOptions> {
files: string | string[];
exclude?: string[];
format?: string;
}

class TslintWebpackPlugin extends Plugin {
constructor(options?: Options);
}

export = TslintWebpackPlugin;
}