diff --git a/chalk/chalk-tests.ts b/chalk/chalk-tests.ts new file mode 100644 index 000000000..208709e5b --- /dev/null +++ b/chalk/chalk-tests.ts @@ -0,0 +1,30 @@ +/// + +import chalk = require('chalk'); + +var str: string; +var bool: boolean; + +chalk.enabled = bool; +str = chalk.stripColor(str); + +bool = chalk.supportsColor; +bool = chalk.hasColor(str); + +// style a string +console.log( chalk.blue('Hello world!') ); + +// combine styled and normal strings +console.log( chalk.blue('Hello'), 'World' + chalk.red('!') ); + +// compose multiple styles using the chainable API +console.log( chalk.blue.bgRed.bold('Hello world!') ); + +// pass in multiple arguments +console.log( chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz') ); + +// nest styles +console.log( chalk.red('Hello', chalk.underline.bgBlue('world') + '!') ); + +// nest styles of the same type even (color, underline, background) +console.log( chalk.green('I am a green line ' + chalk.blue('with a blue substring') + ' that becomes green again!') ); diff --git a/chalk/chalk.d.ts b/chalk/chalk.d.ts new file mode 100644 index 000000000..5cceb9514 --- /dev/null +++ b/chalk/chalk.d.ts @@ -0,0 +1,92 @@ +// Type definitions for chalk v0.4.0 +// Project: https://github.com/sindresorhus/chalk +// Definitions by: Diullei Gomes , Bart van der Schoor +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module Chalk { + export interface ChalkModule extends ChalkStyle { + enabled: boolean; + supportsColor: boolean; + styles: ChalkStyleMap; + + stripColor(value: string): any; + hasColor(str: string): boolean; + } + + export interface ChalkChain extends ChalkStyle { + (...text: string[]): ChalkChain; + } + + export interface ChalkStyleElement { + open: string; + close: string; + } + + export interface ChalkStyle { + // General + reset: ChalkChain; + bold: ChalkChain; + italic: ChalkChain; + underline: ChalkChain; + inverse: ChalkChain; + strikethrough: ChalkChain; + + // Text colors + black: ChalkChain; + red: ChalkChain; + green: ChalkChain; + yellow: ChalkChain; + blue: ChalkChain; + magenta: ChalkChain; + cyan: ChalkChain; + white: ChalkChain; + gray: ChalkChain; + + // Background colors + bgBlack: ChalkChain; + bgRed: ChalkChain; + bgGreen: ChalkChain; + bgYellow: ChalkChain; + bgBlue: ChalkChain; + bgMagenta: ChalkChain; + bgCyan: ChalkChain; + bgWhite: ChalkChain; + } + + export interface ChalkStyleMap { + // General + reset: ChalkStyleElement; + bold: ChalkStyleElement; + italic: ChalkStyleElement; + underline: ChalkStyleElement; + inverse: ChalkStyleElement; + strikethrough: ChalkStyleElement; + + // Text colors + black: ChalkStyleElement; + red: ChalkStyleElement; + green: ChalkStyleElement; + yellow: ChalkStyleElement; + blue: ChalkStyleElement; + magenta: ChalkStyleElement; + cyan: ChalkStyleElement; + white: ChalkStyleElement; + gray: ChalkStyleElement; + + // Background colors + bgBlack: ChalkStyleElement; + bgRed: ChalkStyleElement; + bgGreen: ChalkStyleElement; + bgYellow: ChalkStyleElement; + bgBlue: ChalkStyleElement; + bgMagenta: ChalkStyleElement; + bgCyan: ChalkStyleElement; + bgWhite: ChalkStyleElement; + } +} + +declare module "chalk" { + var ch: Chalk.ChalkModule; + export = ch; +} + diff --git a/flipsnap/flipsnap.d.ts b/flipsnap/flipsnap.d.ts index 55e601704..e763cfe17 100644 --- a/flipsnap/flipsnap.d.ts +++ b/flipsnap/flipsnap.d.ts @@ -1,6 +1,6 @@ // Type definitions for flipsnap.js // Project: http://pxgrid.github.io/js-flipsnap/ -// Definitions by: kubosho_ , gsino , Mayuki Sawatari +// Definitions by: kubosho , gsino , Mayuki Sawatari // Definitions: https://github.com/borisyankov/DefinitelyTyped interface IFlipsnap { diff --git a/glob-stream/glob-stream-tests.ts b/glob-stream/glob-stream-tests.ts index f6a0e4bf3..1f0cbd358 100644 --- a/glob-stream/glob-stream-tests.ts +++ b/glob-stream/glob-stream-tests.ts @@ -1,4 +1,4 @@ -/// +/// import gs = require('glob-stream'); diff --git a/glob/glob.d.ts b/glob/glob.d.ts index 46ab16e0a..a15417f72 100644 --- a/glob/glob.d.ts +++ b/glob/glob.d.ts @@ -21,6 +21,7 @@ declare module "glob" { var Glob:IGlobStatic; interface IOptions extends minimatch.IOptions { + cwd?: string; sync?: boolean; nomount?: boolean; matchBase?:any; diff --git a/hammerjs/hammerjs.d.ts b/hammerjs/hammerjs.d.ts index f2dff3046..6f4c0d4ce 100644 --- a/hammerjs/hammerjs.d.ts +++ b/hammerjs/hammerjs.d.ts @@ -1,7 +1,6 @@ // Type definitions for Hammer.js 1.1.3 // Project: http://eightmedia.github.com/hammer.js/ -// Definitions by: Boris Yankov -// Drew Noakes +// Definitions by: Boris Yankov , Drew Noakes // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/noble/noble-tests.ts b/noble/noble-tests.ts index 46851ab52..4b1d39656 100644 --- a/noble/noble-tests.ts +++ b/noble/noble-tests.ts @@ -33,10 +33,17 @@ peripheral.advertisement = { manufacturerData: new Buffer(1), serviceUuids: ["0x180a", "0x180d"] }; +peripheral.connect(); peripheral.connect((error: string): void => {}); +peripheral.disconnect(); peripheral.disconnect((): void => {}); +peripheral.updateRssi(); +peripheral.updateRssi((error: string, rssi: number): void => {}); +peripheral.discoverServices(["180d"]); peripheral.discoverServices(["180d"], (error: string, services: noble.Service[]): void => {}); +peripheral.discoverAllServicesAndCharacteristics(); peripheral.discoverAllServicesAndCharacteristics((error: string, services: noble.Service[], characteristics: noble.Characteristic[]): void => {}); +peripheral.discoverSomeServicesAndCharacteristics(["180d"], ["2a38"]); peripheral.discoverSomeServicesAndCharacteristics(["180d"], ["2a38"], (error: string, services: noble.Service[], characteristics: noble.Characteristic[]): void => {}); peripheral.readHandle(new Buffer(1), (error: string, data: NodeBuffer): void => {}); peripheral.writeHandle(new Buffer(1), new Buffer(1), true, (error: string): void => {}); @@ -50,7 +57,9 @@ service.uuid = "180a"; service.name = ""; service.type = ""; service.includedServiceUuids = ["180d"]; +service.discoverIncludedServices(["180d"]); service.discoverIncludedServices(["180d"], (error: string, includedServiceUuids: string[]): void => {}); +service.discoverCharacteristics(["2a38"]); service.discoverCharacteristics(["2a38"], (error: string, characteristics: noble.Characteristic[]): void => {}); service.on("includedServicesDiscover", (includedServiceUuids: string[]): void => {}); service.on("characteristicsDiscover", (characteristics: noble.Characteristic[]): void => {}); @@ -60,10 +69,15 @@ characteristic.uuid = "2a37"; characteristic.name = ""; characteristic.type = ""; characteristic.properties = ["read", "notify"]; +characteristic.read(); characteristic.read((error: string, data: NodeBuffer): void => {}); +characteristic.write(new Buffer(1), true); characteristic.write(new Buffer(1), true, (error: string): void => {}); +characteristic.broadcast(true); characteristic.broadcast(true, (error: string): void => {}); +characteristic.notify(true); characteristic.notify(true, (error: string): void => {}); +characteristic.discoverDescriptors(); characteristic.discoverDescriptors((error: string, descriptors: noble.Descriptor[]): void => {}); characteristic.on("read", (data: NodeBuffer, isNotification: boolean): void => {}); characteristic.on("write", true, (error: string): void => {}); @@ -75,7 +89,9 @@ var descriptor: noble.Descriptor = new noble.Descriptor(); descriptor.uuid = ""; descriptor.name = ""; descriptor.type = ""; +descriptor.readValue(); descriptor.readValue((error: string, data: NodeBuffer): void => {}); +descriptor.writeValue(new Buffer(1)); descriptor.writeValue(new Buffer(1), (error: string): void => {}); descriptor.on("valueRead", (error: string, data: NodeBuffer): void => {}); descriptor.on("valueWrite", (error: string): void => {}); diff --git a/noble/noble.d.ts b/noble/noble.d.ts index f9c833bd1..fb0a7a491 100644 --- a/noble/noble.d.ts +++ b/noble/noble.d.ts @@ -25,11 +25,12 @@ declare module "noble" { rssi: number; services: string[]; - connect(callback: (error: string) => void): void; - disconnect(callback: () => void): void; - discoverServices(serviceUUIDs: string[], listener: (error: string, services: Service[]) => void): void; - discoverAllServicesAndCharacteristics(callback: (error: string, services: Service[], characteristics: Characteristic[]) => void): void; - discoverSomeServicesAndCharacteristics(serviceUUIDs: string[], characteristicUUIDs: string[], callback: (error: string, services: Service[], characteristics: Characteristic[]) => void): void; + connect(callback?: (error: string) => void): void; + disconnect(callback?: () => void): void; + updateRssi(callback?: (error: string, rssi: number) => void): void; + discoverServices(serviceUUIDs: string[], callback?: (error: string, services: Service[]) => void): void; + discoverAllServicesAndCharacteristics(callback?: (error: string, services: Service[], characteristics: Characteristic[]) => void): void; + discoverSomeServicesAndCharacteristics(serviceUUIDs: string[], characteristicUUIDs: string[], callback?: (error: string, services: Service[], characteristics: Characteristic[]) => void): void; readHandle(handle: NodeBuffer, callback: (error: string, data: NodeBuffer) => void): void; writeHandle(handle: NodeBuffer, data: NodeBuffer, withoutResponse: boolean, callback: (error: string) => void): void; @@ -57,8 +58,8 @@ declare module "noble" { includedServiceUuids: string[]; characteristics: Characteristic[]; - discoverIncludedServices(serviceUUIDs: string[], callback: (error: string, includedServiceUuids: string[]) => void): void; - discoverCharacteristics(characteristicUUIDs: string[], callback: (error: string, characteristics: Characteristic[]) => void): void; + discoverIncludedServices(serviceUUIDs: string[], callback?: (error: string, includedServiceUuids: string[]) => void): void; + discoverCharacteristics(characteristicUUIDs: string[], callback?: (error: string, characteristics: Characteristic[]) => void): void; toString(): string; on(event: string, listener: Function): events.EventEmitter; @@ -73,11 +74,11 @@ declare module "noble" { properties: string[]; descriptors: Descriptor[]; - read(callback: (error: string, data: NodeBuffer) => void): void; - write(data: NodeBuffer, notify: boolean, callback: (error: string) => void): void; - broadcast(broadcast: boolean, callback: (error: string) => void): void; - notify(notify: boolean, callback: (error: string) => void): void; - discoverDescriptors(callback: (error: string, descriptors: Descriptor[]) => void): void; + read(callback?: (error: string, data: NodeBuffer) => void): void; + write(data: NodeBuffer, notify: boolean, callback?: (error: string) => void): void; + broadcast(broadcast: boolean, callback?: (error: string) => void): void; + notify(notify: boolean, callback?: (error: string) => void): void; + discoverDescriptors(callback?: (error: string, descriptors: Descriptor[]) => void): void; toString(): string; on(event: string, listener: Function): events.EventEmitter; @@ -94,8 +95,8 @@ declare module "noble" { name: string; type: string; - readValue(callback: (error: string, data: NodeBuffer) => void): void; - writeValue(data: NodeBuffer, callback: (error: string) => void): void; + readValue(callback?: (error: string, data: NodeBuffer) => void): void; + writeValue(data: NodeBuffer, callback?: (error: string) => void): void; toString(): string; on(event: string, listener: Function): events.EventEmitter; diff --git a/node/node.d.ts b/node/node.d.ts index d0ffa5445..bfe4754cb 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -763,7 +763,7 @@ declare module "dgram" { export function createSocket(type: string, callback?: Function): Socket; interface Socket extends events.EventEmitter { - send(buf: Buffer, offset: number, length: number, port: number, address: string, callback?: (error: Error, bytes: number)): void; + send(buf: Buffer, offset: number, length: number, port: number, address: string, callback?: (error: Error, bytes: number) => void): void; bind(port: number, address?: string, callback?: () => void): void; close(): void; address: { address: string; family: string; port: number; }; diff --git a/sockjs-node/sockjs-node.d.ts b/sockjs-node/sockjs-node.d.ts index 99e4663b7..e054fe2eb 100644 --- a/sockjs-node/sockjs-node.d.ts +++ b/sockjs-node/sockjs-node.d.ts @@ -1,7 +1,7 @@ // Type definitions for sockjs-node 0.3.x // Project: https://github.com/sockjs/sockjs-node // Definitions by: Phil McCloghry-Laing -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped ///