Merge pull request #31338 from BendingBender/npm-name

Add types for npm-name
This commit is contained in:
Nathan Shively-Sanders
2018-12-17 10:28:00 -08:00
committed by GitHub
4 changed files with 48 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
// Type definitions for npm-name 5.0
// Project: https://github.com/sindresorhus/npm-name#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = npmName;
declare function npmName(name: string): Promise<boolean>;
declare namespace npmName {
function many<T extends string>(names: T[]): Promise<Map<T, boolean>>;
}
+12
View File
@@ -0,0 +1,12 @@
import npmName = require('npm-name');
// $ExpectType Promise<boolean>
npmName('chalk');
npmName.many(['chalk', '@sindresorhus/is', 'abc123']).then(result => {
// $ExpectType Map<"chalk" | "@sindresorhus/is" | "abc123", boolean>
result;
// $ExpectType boolean | undefined
result.get('chalk');
});
+23
View File
@@ -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"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }