diff --git a/README.md b/README.md index b2149c5cb..d07776600 100755 --- a/README.md +++ b/README.md @@ -199,6 +199,7 @@ List of Definitions * [mCustomScrollbar](https://github.com/malihu/malihu-custom-scrollbar-plugin) (by [Sarah Williams](https://github.com/flurg)) * [Meteor](https://www.meteor.com) (by [Dave Allen](https://github.com/fullflavedave)) * [Microsoft Live Connect](http://msdn.microsoft.com/en-us/library/live/hh243643.aspx) (by [John Vilk](https://github.com/jvilk)) +* [minimist](https://github.com/substack/minimist) (by [Bart van der Schoor](https://github.com/Bartvds)) * [Modernizr](http://modernizr.com/) (by [Boris Yankov](https://github.com/borisyankov) and [Theodore Brown](https://github.com/theodorejb/)) * [Moment.js](https://github.com/timrwood/moment) (by [Michael Lakerveld](https://github.com/Lakerfield)) * [MongoDB](http://mongodb.github.io/node-mongodb-native/) (from TypeScript samples, updated by [Niklas Mollenhauer](https://github.com/nikeee)) diff --git a/minimist/minimist-tests.ts b/minimist/minimist-tests.ts new file mode 100644 index 000000000..b96b7d13a --- /dev/null +++ b/minimist/minimist-tests.ts @@ -0,0 +1,27 @@ +/// + +import minimist = require('minimist'); +import Opts = minimist.Opts; + +var num: string; +var str: string; +var strArr: string[]; +var args: string[]; +var obj: Object; +var opts: Opts; + +opts.string = strArr; +opts.boolean = strArr; +opts.alias = { + foo: strArr +}; +opts.default = { + foo: str +}; +opts.default = { + foo: num +}; + +obj = minimist(); +obj = minimist(strArr); +obj = minimist(strArr, opts); diff --git a/minimist/minimist.d.ts b/minimist/minimist.d.ts new file mode 100644 index 000000000..2d65e3aac --- /dev/null +++ b/minimist/minimist.d.ts @@ -0,0 +1,26 @@ +// Type definitions for minimist 0.0.8 +// Project: https://github.com/substack/minimist +// Definitions by: Bart van der Schoor +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'minimist' { + function minimist(args?: string[], opts?: minimist.Opts):Object; + + module minimist { + export interface Opts { + // a string or array of strings argument names to always treat as strings + // string?: string; + string?: string[]; + // a string or array of strings to always treat as booleans + // boolean?: string; + boolean?: string[]; + // an object mapping string names to strings or arrays of string argument names to use + // alias?: {[key:string]: string}; + alias?: {[key:string]: string[]}; + // an object mapping string argument names to default values + default?: {[key:string]: any}; + } + } + + export = minimist; +}