From 53f681836afd1f4935378c1dea6820320c0ed417 Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Tue, 25 Dec 2018 20:21:51 +0100 Subject: [PATCH] [git-username] Add types --- types/git-username/git-username-tests.ts | 5 +++++ types/git-username/index.d.ts | 20 ++++++++++++++++++++ types/git-username/tsconfig.json | 23 +++++++++++++++++++++++ types/git-username/tslint.json | 1 + 4 files changed, 49 insertions(+) create mode 100644 types/git-username/git-username-tests.ts create mode 100644 types/git-username/index.d.ts create mode 100644 types/git-username/tsconfig.json create mode 100644 types/git-username/tslint.json diff --git a/types/git-username/git-username-tests.ts b/types/git-username/git-username-tests.ts new file mode 100644 index 0000000000..1ee150ef0b --- /dev/null +++ b/types/git-username/git-username-tests.ts @@ -0,0 +1,5 @@ +import username = require('git-username'); + +username('some/path'); // $ExpectType string | null +username({ cwd: 'some/path' }); // $ExpectType string | null +username({ strict: true }); // $ExpectType string diff --git a/types/git-username/index.d.ts b/types/git-username/index.d.ts new file mode 100644 index 0000000000..f2da948fb8 --- /dev/null +++ b/types/git-username/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for git-username 1.0 +// Project: https://github.com/jonschlinkert/git-username +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = gitUsername; + +declare function gitUsername(options: gitUsername.StrictOptions): string; +declare function gitUsername(options?: string | gitUsername.BaseOptions): string | null; + +declare namespace gitUsername { + interface BaseOptions { + cwd?: string; + strict?: boolean; + } + + interface StrictOptions extends BaseOptions { + strict: true; + } +} diff --git a/types/git-username/tsconfig.json b/types/git-username/tsconfig.json new file mode 100644 index 0000000000..b49ccd7e47 --- /dev/null +++ b/types/git-username/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "git-username-tests.ts" + ] +} diff --git a/types/git-username/tslint.json b/types/git-username/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/git-username/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }