mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-22 08:26:35 +08:00
[meow] Upgrade types for version 4 (#23350)
* [meow] Upgrade types for version 4 * Use ES6 import style
This commit is contained in:
16
types/meow/index.d.ts
vendored
16
types/meow/index.d.ts
vendored
@@ -1,11 +1,13 @@
|
||||
// Type definitions for meow 3.6
|
||||
// Type definitions for meow 4.x
|
||||
// Project: https://github.com/sindresorhus/meow
|
||||
// Definitions by: KnisterPeter <https://github.com/KnisterPeter>
|
||||
// Definitions by: KnisterPeter <https://github.com/KnisterPeter>, Lindsey Smith <https://github.com/praxxis>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import * as minimist from 'minimist';
|
||||
import * as buildOptions from "minimist-options";
|
||||
|
||||
declare function meow(options: string | string[] | meow.Options, minimistOptions?: minimist.Opts): meow.Result;
|
||||
declare function meow(helpMessage: string | string[], options: meow.Options): meow.Result;
|
||||
declare function meow(options: string | string[] | meow.Options): meow.Result;
|
||||
declare namespace meow {
|
||||
interface Options {
|
||||
description?: string | boolean;
|
||||
@@ -14,14 +16,18 @@ declare namespace meow {
|
||||
pkg?: any;
|
||||
argv?: string[];
|
||||
inferType?: boolean;
|
||||
flags?: buildOptions.Options;
|
||||
autoHelp?: boolean;
|
||||
autoVersion?: boolean;
|
||||
}
|
||||
|
||||
interface Result {
|
||||
input: string[];
|
||||
flags: { [name: string]: any };
|
||||
pkg: any;
|
||||
pkg: object;
|
||||
help: string;
|
||||
showHelp(code?: number): void;
|
||||
showVersion(): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,39 @@
|
||||
import meow = require('meow');
|
||||
import Options = meow.Options;
|
||||
|
||||
const options: Options = {};
|
||||
options.description = true;
|
||||
options.description = 'string';
|
||||
options.help = true;
|
||||
options.help = 'string';
|
||||
options.version = true;
|
||||
options.version = 'string';
|
||||
options.argv = ['string', 'string'];
|
||||
options.inferType = true;
|
||||
const cli = meow("Help text",
|
||||
{
|
||||
flags: {
|
||||
unicorn: {
|
||||
type: 'boolean',
|
||||
alias: 'u'
|
||||
},
|
||||
fooBar: {
|
||||
type: 'string',
|
||||
default: 'foo'
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
meow(options);
|
||||
meow('Usage text', {
|
||||
alias: {
|
||||
opt: 'opt'
|
||||
}
|
||||
const cli2 = meow("Help text");
|
||||
|
||||
const cli3 = meow({
|
||||
description: "version string",
|
||||
help: "help string",
|
||||
version: "1.0.0",
|
||||
pkg: {},
|
||||
argv: ['foo', 'bar'],
|
||||
inferType: true,
|
||||
autoHelp: true,
|
||||
autoVersion: true,
|
||||
flags: {
|
||||
unicorn: {
|
||||
type: 'boolean',
|
||||
alias: 'u'
|
||||
},
|
||||
fooBar: {
|
||||
type: 'string',
|
||||
default: 'foo'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user