mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #31338 from BendingBender/npm-name
Add types for npm-name
This commit is contained in:
Vendored
+12
@@ -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>>;
|
||||
}
|
||||
@@ -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');
|
||||
});
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user