Add types for intercept-stdout (#38373)

This commit is contained in:
Paulo Castro
2019-09-24 14:29:51 -07:00
committed by Ben Lichtman
parent 0a665aaaf8
commit 68721e9fb7
4 changed files with 47 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
// Type definitions for intercept-stdout 0.1
// Project: https://github.com/sfarthin/intercept-stdout
// Definitions by: Paulo Castro <https://github.com/pdcastro>
// 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;
@@ -0,0 +1,9 @@
import intercept = require('intercept-stdout');
const stdoutHook = (data: string) => {
return data;
};
const unhookIntercept = intercept(stdoutHook);
unhookIntercept();
+23
View File
@@ -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"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }