Skip to content

Commit

Permalink
Merge pull request #2 from heaths/tsd
Browse files Browse the repository at this point in the history
Add mod types to enable packaging
  • Loading branch information
heaths committed Jan 17, 2016
2 parents 929c40c + 181878c commit c3f47cb
Show file tree
Hide file tree
Showing 8 changed files with 136 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
out
npm-debug.log
npm-debug.log
**/*.vsix
3 changes: 2 additions & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ test/**
src/**
**/*.map
.gitignore
tsconfig.json
tsconfig.json
tsd.json
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"node-uuid": "^1.4.7"
},
"devDependencies": {
"tsd": "^0.6.5",
"typescript": "^1.6.2",
"vscode": "0.10.x"
},
Expand Down
18 changes: 18 additions & 0 deletions tsd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": "v4",
"repo": "borisyankov/DefinitelyTyped",
"ref": "master",
"path": "typings",
"bundle": "typings/tsd.d.ts",
"installed": {
"node-uuid/node-uuid-base.d.ts": {
"commit": "70bf7e2bfeb0d5b1b651ef3219bcc65c8eec117e"
},
"node-uuid/node-uuid-cjs.d.ts": {
"commit": "70bf7e2bfeb0d5b1b651ef3219bcc65c8eec117e"
},
"node-uuid/node-uuid.d.ts": {
"commit": "70bf7e2bfeb0d5b1b651ef3219bcc65c8eec117e"
}
}
}
52 changes: 52 additions & 0 deletions typings/node-uuid/node-uuid-base.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Type definitions for node-uuid.js
// Project: https://github.com/broofa/node-uuid
// Definitions by: Jeff May <https://github.com/jeffmay>
// Definitions: https://github.com/borisyankov/DefinitelyTyped

/** Common definitions for all environments */
declare namespace __NodeUUID {
interface UUIDOptions {

/**
* Node id as Array of 6 bytes (per 4.1.6).
* Default: Randomly generated ID. See note 1.
*/
node?: any[];

/**
* (Number between 0 - 0x3fff) RFC clock sequence.
* Default: An internally maintained clockseq is used.
*/
clockseq?: number;

/**
* (Number | Date) Time in milliseconds since unix Epoch.
* Default: The current time is used.
*/
msecs?: number|Date;

/**
* (Number between 0-9999) additional time, in 100-nanosecond units. Ignored if msecs is unspecified.
* Default: internal uuid counter is used, as per 4.2.1.2.
*/
nsecs?: number;
}

interface UUID {
v1(options?: UUIDOptions): string;
v1(options?: UUIDOptions, buffer?: number[], offset?: number): number[];

v2(options?: UUIDOptions): string;
v2(options?: UUIDOptions, buffer?: number[], offset?: number): number[];

v3(options?: UUIDOptions): string;
v3(options?: UUIDOptions, buffer?: number[], offset?: number): number[];

v4(options?: UUIDOptions): string;
v4(options?: UUIDOptions, buffer?: number[], offset?: number): number[];

parse(id: string, buffer?: number[], offset?: number): number[];

unparse(buffer: number[], offset?: number): string;
}
}
15 changes: 15 additions & 0 deletions typings/node-uuid/node-uuid-cjs.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Type definitions for node-uuid.js
// Project: https://github.com/broofa/node-uuid
// Definitions by: Jeff May <https://github.com/jeffmay>
// Definitions: https://github.com/borisyankov/DefinitelyTyped

/// <reference path="./node-uuid-base.d.ts" />

/**
* Expose as CommonJS module
* For use in node environment or browser environment (using webpack or other module loaders)
*/
declare module "node-uuid" {
var uuid: __NodeUUID.UUID;
export = uuid;
}
43 changes: 43 additions & 0 deletions typings/node-uuid/node-uuid.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Type definitions for node-uuid.js
// Project: https://github.com/broofa/node-uuid
// Definitions by: Jeff May <https://github.com/jeffmay>
// Definitions: https://github.com/borisyankov/DefinitelyTyped

/// <reference path="./node-uuid-base.d.ts" />
/// <reference path="./node-uuid-cjs.d.ts" />

/**
* Definitions for use in node environment
*
* !! For browser enviroments, use node-uuid-global or node-uuid-cjs
*/
declare module __NodeUUID {
/**
* Overloads for node environment
* We need to duplicate some declarations because
* interface merging doesn't work with overloads
*/
interface UUID {
v1(options?: UUIDOptions): string;
v1(options?: UUIDOptions, buffer?: number[], offset?: number): number[];
v1(options?: UUIDOptions, buffer?: Buffer, offset?: number): Buffer;

v2(options?: UUIDOptions): string;
v2(options?: UUIDOptions, buffer?: number[], offset?: number): number[];
v2(options?: UUIDOptions, buffer?: Buffer, offset?: number): Buffer;

v3(options?: UUIDOptions): string;
v3(options?: UUIDOptions, buffer?: number[], offset?: number): number[];
v3(options?: UUIDOptions, buffer?: Buffer, offset?: number): Buffer;

v4(options?: UUIDOptions): string;
v4(options?: UUIDOptions, buffer?: number[], offset?: number): number[];
v4(options?: UUIDOptions, buffer?: Buffer, offset?: number): Buffer;

parse(id: string, buffer?: number[], offset?: number): number[];
parse(id: string, buffer?: Buffer, offset?: number): Buffer;

unparse(buffer: number[], offset?: number): string;
unparse(buffer: Buffer, offset?: number): string;
}
}
3 changes: 3 additions & 0 deletions typings/tsd.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/// <reference path="node-uuid/node-uuid-base.d.ts" />
/// <reference path="node-uuid/node-uuid-cjs.d.ts" />
/// <reference path="node-uuid/node-uuid.d.ts" />

0 comments on commit c3f47cb

Please sign in to comment.