added definitions for minimist

This commit is contained in:
Bart van der Schoor 2014-04-01 00:49:55 +02:00
parent f354504a25
commit 69f04bbab6
3 changed files with 54 additions and 0 deletions

View File

@ -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))

View File

@ -0,0 +1,27 @@
/// <reference path="minimist.d.ts" />
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);

26
minimist/minimist.d.ts vendored Normal file
View File

@ -0,0 +1,26 @@
// Type definitions for minimist 0.0.8
// Project: https://github.com/substack/minimist
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
// 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;
}