mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 15:50:13 +00:00
Add types for npm-list-author-packages
This commit is contained in:
25
types/npm-list-author-packages/index.d.ts
vendored
Normal file
25
types/npm-list-author-packages/index.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
// Type definitions for npm-list-author-packages 2.0
|
||||
// Project: https://github.com/kgryte/npm-list-author-packages#readme
|
||||
// Definitions by: Florian Keller <https://github.com/ffflorian>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace list {
|
||||
interface Options {
|
||||
/** registry port. Default: 443 (HTTPS) or 80 (HTTP). */
|
||||
port?: 443 | 80;
|
||||
/** registry protocol. Default: 'https'. */
|
||||
protocol?: 'http' | 'https';
|
||||
/** registry. Default: 'registry.npmjs.org'. */
|
||||
registry?: string;
|
||||
/** author username (required). */
|
||||
username: string;
|
||||
}
|
||||
|
||||
type Callback = (error: Error | null, data: string[]) => void;
|
||||
|
||||
function factory(opts: Options, callback: Callback): () => void;
|
||||
}
|
||||
|
||||
declare function list(opts: list.Options, callback: list.Callback): void;
|
||||
|
||||
export = list;
|
||||
@@ -0,0 +1,18 @@
|
||||
import list = require('npm-list-author-packages');
|
||||
|
||||
const opts: list.Options = {
|
||||
port: 80,
|
||||
protocol: 'http',
|
||||
registry: 'my.favorite.npm/registry',
|
||||
username: 'kgryte',
|
||||
};
|
||||
|
||||
list(opts, (error, data) => {
|
||||
data; // $ExpectType string[]
|
||||
});
|
||||
|
||||
const get = list.factory({ username: 'kgryte' }, (error, data) => {
|
||||
data; // $ExpectType string[]
|
||||
});
|
||||
|
||||
get();
|
||||
23
types/npm-list-author-packages/tsconfig.json
Normal file
23
types/npm-list-author-packages/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"npm-list-author-packages-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/npm-list-author-packages/tslint.json
Normal file
1
types/npm-list-author-packages/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user