From 097370070296cf994805ec36dbfb65c6216cfc41 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Fri, 14 Jun 2019 07:00:03 +0200 Subject: [PATCH] Add types for the "npm-run"-module (#36042) * Add types for the "npm-run"-module * Fix the code according to tslint --- types/npm-run/index.d.ts | 22 ++++++++++++++++++++++ types/npm-run/npm-run-tests.ts | 8 ++++++++ types/npm-run/tsconfig.json | 23 +++++++++++++++++++++++ types/npm-run/tslint.json | 1 + 4 files changed, 54 insertions(+) create mode 100644 types/npm-run/index.d.ts create mode 100644 types/npm-run/npm-run-tests.ts create mode 100644 types/npm-run/tsconfig.json create mode 100644 types/npm-run/tslint.json diff --git a/types/npm-run/index.d.ts b/types/npm-run/index.d.ts new file mode 100644 index 0000000000..0dbd89cf90 --- /dev/null +++ b/types/npm-run/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for npm-run 5.0 +// Project: https://github.com/timoxley/npm-run +// Definitions by: Manuel Thalmann +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 +/// + +import { exec, execSync, spawnSync, spawn } from "child_process"; + +type ExecFunction = typeof exec; + +interface Runner extends ExecFunction { + exec: ExecFunction; + sync: typeof execSync; + execSync: typeof execSync; + spawnSync: typeof spawnSync; + spawn: typeof spawn; +} + +declare let npmRun: Runner; + +export = npmRun; diff --git a/types/npm-run/npm-run-tests.ts b/types/npm-run/npm-run-tests.ts new file mode 100644 index 0000000000..857d35e192 --- /dev/null +++ b/types/npm-run/npm-run-tests.ts @@ -0,0 +1,8 @@ +import npmRun = require("npm-run"); + +npmRun(""); +npmRun.exec(""); +npmRun.execSync(""); +npmRun.spawn("", []); +npmRun.spawnSync("", []); +npmRun.sync(""); diff --git a/types/npm-run/tsconfig.json b/types/npm-run/tsconfig.json new file mode 100644 index 0000000000..7812f8a96e --- /dev/null +++ b/types/npm-run/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", + "npm-run-tests.ts" + ] +} diff --git a/types/npm-run/tslint.json b/types/npm-run/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/npm-run/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }