diff --git a/types/ignore-styles/ignore-styles-tests.ts b/types/ignore-styles/ignore-styles-tests.ts new file mode 100644 index 0000000000..1a7dbc74c1 --- /dev/null +++ b/types/ignore-styles/ignore-styles-tests.ts @@ -0,0 +1,15 @@ +import register, { DEFAULT_EXTENSIONS, oldHandlers, noOp, restore } from 'ignore-styles'; + +register(['.css'], (module, filename) => {}); // $ExpectType void +register(['.css']); // $ExpectType void +register(undefined, (module, filename) => {}); // $ExpectType void +register([1], (module, filename) => {}); // $ExpectError +register(['.css'], 1); // $ExpectError + +DEFAULT_EXTENSIONS[0]; // $ExpectType string + +oldHandlers['.css']; // $ExpectType Handler + +noOp(); // $ExpectType void + +restore(); // $ExpectType void diff --git a/types/ignore-styles/index.d.ts b/types/ignore-styles/index.d.ts new file mode 100644 index 0000000000..2eab90b591 --- /dev/null +++ b/types/ignore-styles/index.d.ts @@ -0,0 +1,24 @@ +// Type definitions for ignore-styles 5.0 +// Project: https://github.com/bkonkle/ignore-styles +// Definitions by: Taiju Muto +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +/// + +export type Handler = (m: NodeModule, filename: string) => any; + +export const DEFAULT_EXTENSIONS: string[]; + +export let oldHandlers: { + [ext: string]: Handler +}; + +export function noOp(): void; + +export function restore(): void; + +export default function register( + extensions?: string[], + handler?: Handler +): void; diff --git a/types/ignore-styles/tsconfig.json b/types/ignore-styles/tsconfig.json new file mode 100644 index 0000000000..aed3487cf4 --- /dev/null +++ b/types/ignore-styles/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "ignore-styles-tests.ts" + ] +} diff --git a/types/ignore-styles/tslint.json b/types/ignore-styles/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/ignore-styles/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }