mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-02-26 18:52:52 +00:00
yargs: fix fail API (#11757)
* yargs: fix --target es6 * yargs: fix fail API
This commit is contained in:
parent
384a4f4a5d
commit
afa8fc2002
@ -4,8 +4,9 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="yargs.d.ts" />
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
import yargs = require('yargs');
|
||||
import * as yargs from 'yargs';
|
||||
|
||||
// Examples taken from yargs website
|
||||
// https://github.com/chevex/yargs
|
||||
@ -343,3 +344,15 @@ function Argv$commandDirWithOptions() {
|
||||
})
|
||||
.argv
|
||||
}
|
||||
|
||||
// http://yargs.js.org/docs/#methods-failfn
|
||||
function Argv$fail() {
|
||||
var argv = yargs
|
||||
.fail(function (msg, err) {
|
||||
if (err) throw err // preserve stack
|
||||
console.error('You broke it!')
|
||||
console.error(msg)
|
||||
process.exit(1)
|
||||
})
|
||||
.argv
|
||||
}
|
||||
|
||||
2
yargs/yargs.d.ts
vendored
2
yargs/yargs.d.ts
vendored
@ -135,7 +135,7 @@ declare module "yargs" {
|
||||
count(key: string): Argv;
|
||||
count(keys: string[]): Argv;
|
||||
|
||||
fail(func: (msg: string) => any): void;
|
||||
fail(func: (msg: string, err: Error) => any): Argv;
|
||||
}
|
||||
|
||||
interface RequireDirectoryOptions {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user