From d7e55bc17b6bcd93ff308580a516579151c775b5 Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Fri, 19 Aug 2016 16:18:41 -0700 Subject: [PATCH] fix argv --- argv/argv-tests.ts | 1 - argv/argv.d.ts | 59 ---------------------------------------------- argv/index.d.ts | 59 ++++++++++++++++++++++++++++++++++++++++++++++ argv/tsconfig.json | 19 +++++++++++++++ 4 files changed, 78 insertions(+), 60 deletions(-) delete mode 100644 argv/argv.d.ts create mode 100644 argv/index.d.ts create mode 100644 argv/tsconfig.json diff --git a/argv/argv-tests.ts b/argv/argv-tests.ts index 6d73c53ec7..b9f8c47d59 100644 --- a/argv/argv-tests.ts +++ b/argv/argv-tests.ts @@ -1,4 +1,3 @@ -/// import argv = require('argv'); argv.version( 'v1.0' ); argv.info( 'Special script info' ); diff --git a/argv/argv.d.ts b/argv/argv.d.ts deleted file mode 100644 index 182ffde861..0000000000 --- a/argv/argv.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -// Type definitions for argv -// Project: https://www.npmjs.com/package/argv -// Definitions by: Hookclaw -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare module "argv" { - // argv module - type args = { - targets:string[], - options:{[key:string]:any} - }; - - type helpOption = { - name: string, - type: string, - short?: string, - description?: string, - example?: string - }; - - type module = { - mod: string, - description: string, - options: {[key:string]:helpOption} - }; - - type typeFunction = (value:any, ...arglist:any[]) => any; - - type argv = { - - // Runs the arguments parser - run: ( argv?:string[] ) => args, - - // Adding options to definitions list - option: ( mod:helpOption|helpOption[] ) => argv, - - // Creating module - mod: ( object:module|module[] ) => argv, - - // Creates custom type function - type: ( name:string|{[key:string]:typeFunction}, callback?:typeFunction ) => any, - - // Setting version number, and auto setting version option - version: ( v:string ) => argv, - - // Description setup - info: ( mod:string, description?:module ) => argv, - - // Cleans out current options - clear: () => argv, - - // Prints out the help doc - help: ( mod?:string ) => argv - - }; - - var argv:argv; - - export = argv; -} diff --git a/argv/index.d.ts b/argv/index.d.ts new file mode 100644 index 0000000000..9b355b33a3 --- /dev/null +++ b/argv/index.d.ts @@ -0,0 +1,59 @@ +// Type definitions for argv +// Project: https://www.npmjs.com/package/argv +// Definitions by: Hookclaw +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// argv module +type args = { + targets: string[], + options: { [key: string]: any } +}; + +type helpOption = { + name: string, + type: string, + short?: string, + description?: string, + example?: string +}; + +type module = { + mod: string, + description: string, + options: { [key: string]: helpOption } +}; + +type typeFunction = (value: any, ...arglist: any[]) => any; + +type argv = { + + // Runs the arguments parser + run: (argv?: string[]) => args, + + // Adding options to definitions list + option: (mod: helpOption | helpOption[]) => argv, + + // Creating module + mod: (object: module | module[]) => argv, + + // Creates custom type function + type: (name: string | { [key: string]: typeFunction }, callback?: typeFunction) => any, + + // Setting version number, and auto setting version option + version: (v: string) => argv, + + // Description setup + info: (mod: string, description?: module) => argv, + + // Cleans out current options + clear: () => argv, + + // Prints out the help doc + help: (mod?: string) => argv + +}; + +declare const argv: argv; + +export = argv; + diff --git a/argv/tsconfig.json b/argv/tsconfig.json new file mode 100644 index 0000000000..bd2065e5a2 --- /dev/null +++ b/argv/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "argv-tests.ts" + ] +} \ No newline at end of file