diff --git a/types/intercept-stdout/index.d.ts b/types/intercept-stdout/index.d.ts new file mode 100644 index 0000000000..8e66444bac --- /dev/null +++ b/types/intercept-stdout/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for intercept-stdout 0.1 +// Project: https://github.com/sfarthin/intercept-stdout +// Definitions by: Paulo Castro +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +type hookFunction = (txt: string) => string | void; +type unhookFunction = () => void; + +declare function intercept( + stdoutIntercept: hookFunction, + stderrIntercept?: hookFunction, +): unhookFunction; + +export = intercept; diff --git a/types/intercept-stdout/intercept-stdout-tests.ts b/types/intercept-stdout/intercept-stdout-tests.ts new file mode 100644 index 0000000000..f94e421897 --- /dev/null +++ b/types/intercept-stdout/intercept-stdout-tests.ts @@ -0,0 +1,9 @@ +import intercept = require('intercept-stdout'); + +const stdoutHook = (data: string) => { + return data; +}; + +const unhookIntercept = intercept(stdoutHook); + +unhookIntercept(); diff --git a/types/intercept-stdout/tsconfig.json b/types/intercept-stdout/tsconfig.json new file mode 100644 index 0000000000..7c36d572dd --- /dev/null +++ b/types/intercept-stdout/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", + "intercept-stdout-tests.ts" + ] +} diff --git a/types/intercept-stdout/tslint.json b/types/intercept-stdout/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/intercept-stdout/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }