Skip to content

Commit

Permalink
test: address failures
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe committed Apr 3, 2021
1 parent d0b39ac commit 2564b3e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
5 changes: 5 additions & 0 deletions types/yargs/v16/helpers.d.ts
@@ -0,0 +1,5 @@
import * as Parser from 'yargs-parser';

export function applyExtends(config: Record<string, any>, cwd: string, mergeExtends: boolean): Record<string, any>;
export function hideBin(argv: string[]): string[];
export { Parser };
12 changes: 10 additions & 2 deletions types/yargs/v16/tsconfig.json
Expand Up @@ -8,9 +8,17 @@
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"baseUrl": "../../",
"paths": {
"yargs": [
"yargs/v16"
],
"yargs/*": [
"yargs/v16/*"
]
},
"typeRoots": [
"../"
"../../"
],
"types": [],
"noEmit": true,
Expand Down
20 changes: 20 additions & 0 deletions types/yargs/v16/yargs-tests.ts
@@ -1,6 +1,7 @@
/// <reference types="node" />

import yargs = require('yargs');
import yargsHelpers = require('yargs/helpers');
import yargsSingleton = require('yargs/yargs');

import * as fs from 'fs';
Expand Down Expand Up @@ -1307,3 +1308,22 @@ function Argv$strictCommands() {
const argv1 = yargs.strictCommands().command('foo', 'foo command').argv;
const argv2 = yargs.strictCommands(true).command('foo', 'foo command').argv;
}

function Argv$applyExtendsHelper() {
// $ExpectType Record<string, any>
const arvg = yargsHelpers.applyExtends(
{ extends: './package.json', apple: 'red' },
process.cwd(),
true
);
}

function Argv$hideBinHelper() {
// $ExpectType string[]
const arvg = yargsHelpers.hideBin(process.argv);
}

function Argv$ParserHelper() {
// $ExpectType Arguments
const argv = yargsHelpers.Parser('--foo --bar=99');
}

0 comments on commit 2564b3e

Please sign in to comment.