diff --git a/types/npm-name/index.d.ts b/types/npm-name/index.d.ts new file mode 100644 index 0000000000..e4830f377e --- /dev/null +++ b/types/npm-name/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for npm-name 5.0 +// Project: https://github.com/sindresorhus/npm-name#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = npmName; + +declare function npmName(name: string): Promise; + +declare namespace npmName { + function many(names: T[]): Promise>; +} diff --git a/types/npm-name/npm-name-tests.ts b/types/npm-name/npm-name-tests.ts new file mode 100644 index 0000000000..cb8283699c --- /dev/null +++ b/types/npm-name/npm-name-tests.ts @@ -0,0 +1,12 @@ +import npmName = require('npm-name'); + +// $ExpectType Promise +npmName('chalk'); + +npmName.many(['chalk', '@sindresorhus/is', 'abc123']).then(result => { + // $ExpectType Map<"chalk" | "@sindresorhus/is" | "abc123", boolean> + result; + + // $ExpectType boolean | undefined + result.get('chalk'); +}); diff --git a/types/npm-name/tsconfig.json b/types/npm-name/tsconfig.json new file mode 100644 index 0000000000..c60a7df652 --- /dev/null +++ b/types/npm-name/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", + "npm-name-tests.ts" + ] +} diff --git a/types/npm-name/tslint.json b/types/npm-name/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/npm-name/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }