Merge pull request #23576 from ajafff/npm-packlist

Add types for npm-packlist
This commit is contained in:
Daniel Rosenwasser
2018-02-13 11:40:22 -08:00
committed by GitHub
4 changed files with 55 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
// Type definitions for npm-packlist 1.1
// Project: https://github.com/npm/npm-packlist
// Definitions by: Klaus Meinhardt <https://github.com/ajafff>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
declare function packlist(options?: packlist.Options): Promise<string[]>;
declare function packlist<T>(options: packlist.Options | undefined, callback: (result: string[]) => T): Promise<T>;
declare namespace packlist {
interface Options {
/** Directory to walk recusively. Defaults to `process.cwd()`. */
path?: string;
}
function sync(options?: Options): string[];
}
export = packlist;
+14
View File
@@ -0,0 +1,14 @@
import packlist = require('npm-packlist');
let result: string[] = packlist.sync();
result = packlist.sync({});
result = packlist.sync({path: 'foo'});
(async () => {
result = await packlist();
result = await packlist({});
result = await packlist({path: 'foo'});
packlist(undefined, (r) => result = r);
packlist({path: 'foo'}, (r) => result = r);
})();
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"esModuleInterop": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"npm-packlist-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }