Merge remote-tracking branch 'upstream/types-2.0' into types-2.0

This commit is contained in:
Philip Ottesen
2016-11-16 10:21:50 -05:00
30 changed files with 1130 additions and 77 deletions
+3 -3
View File
@@ -1,8 +1,8 @@
import AnalyticsNode = require("analytics-node");
var analytics: AnalyticsNode.Analytics;
import Analytics = require("analytics-node");
var analytics: Analytics;
function testConfig(): void {
analytics = new AnalyticsNode.Analytics('YOUR_WRITE_KEY', {
analytics = new Analytics('YOUR_WRITE_KEY', {
flushAt: 20,
flushAfter: 10000
});
+1 -1
View File
@@ -3,7 +3,7 @@
// Definitions by: Andrew Fong <https://github.com/fongandrew>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = AnalyticsNode;
export = AnalyticsNode.Analytics;
declare namespace AnalyticsNode {
+1 -1
View File
@@ -107,7 +107,7 @@ declare module 'angular' {
interface IComponentControllerService {
// TBinding is an interface exposed by a component as per John Papa's style guide
// https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#accessible-members-up-top
<T, TBinding>(componentName: string, locals: { $scope: IScope, [key: string]: any }, bindings?: TBinding, ident?: string): T;
<T, TBinding>(componentName: string, locals: { $scope?: IScope, [key: string]: any }, bindings?: TBinding, ident?: string): T;
}
+46
View File
@@ -9,6 +9,7 @@ import {
ipcMain,
Menu,
MenuItem,
net,
powerMonitor,
powerSaveBlocker,
protocol,
@@ -732,6 +733,51 @@ Menu.buildFromTemplate([
{ label: '3', position: 'endof=numbers' }
]);
// net
// https://github.com/electron/electron/blob/master/docs/api/net.md
app.on('ready', () => {
const request = net.request('https://github.com')
request.setHeader('Some-Custom-Header-Name', 'Some-Custom-Header-Value');
let header = request.getHeader('Some-Custom-Header-Name');
request.removeHeader('Some-Custom-Header-Name');
request.on('response', (response) => {
console.log(`Status code: ${response.statusCode}`);
console.log(`Status message: ${response.statusMessage}`);
console.log(`Headers: ${JSON.stringify(response.headers)}`);
console.log(`Http version: ${response.httpVersion}`);
console.log(`Major Http version: ${response.httpVersionMajor}`);
console.log(`Minor Http version: ${response.httpVersionMinor}`);
response.on('data', (chunk) => {
console.log(`BODY: ${chunk}`);
})
response.on('end', () => {
console.log('No more data in response.');
})
response.on('error', () => {
console.log('"error" event emitted');
});
response.on('aborted', () => {
console.log('"aborted" event emitted');
});
})
request.on('login', (authInfo, callback) => {
callback('username', 'password');
});
request.on('finish', () => {
console.log('"finish" event emitted');
});
request.on('abort', () => {
console.log('"abort" event emitted');
});
request.on('error', () => {
console.log('"error" event emitted');
});
request.write('Hello World!', 'utf-8', () => { });
request.end('Hello World!', 'utf-8', () => { });
request.abort();
})
// power-monitor
// https://github.com/atom/electron/blob/master/docs/api/power-monitor.md
+244 -2
View File
@@ -1,6 +1,6 @@
// Type definitions for Electron v1.4.2
// Type definitions for Electron v1.4.5
// Project: http://electron.atom.io/
// Definitions by: jedmao <https://github.com/jedmao/>, rhysd <https://rhysd.github.io>, Milan Burda <https://github.com/miniak/>
// Definitions by: jedmao <https://github.com/jedmao/>, rhysd <https://rhysd.github.io>, Milan Burda <https://github.com/miniak/>, aliib <https://github.com/aliib>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
@@ -2687,6 +2687,247 @@ declare namespace Electron {
isTemplateImage(): boolean;
}
// https://github.com/electron/electron/blob/master/docs/api/net.md
/**
* The net module is a client-side API for issuing HTTP(S) requests.
* It is similar to the HTTP and HTTPS modules of Node.js but uses Chromium’s native
* networking library instead of the Node.js implementation, offering better support
* for web proxies.
* The following is a non-exhaustive list of why you may consider using the net module
* instead of the native Node.js modules:
* - Automatic management of system proxy configuration, support of the wpad protocol
* and proxy pac configuration files.
* - Automatic tunneling of HTTPS requests.
* - Support for authenticating proxies using basic, digest, NTLM, Kerberos or negotiate
* authentication schemes.
* - Support for traffic monitoring proxies: Fiddler-like proxies used for access control
* and monitoring.
*
* The net module API has been specifically designed to mimic, as closely as possible,
* the familiar Node.js API. The API components including classes, methods,
* properties and event names are similar to those commonly used in Node.js.
*
* The net API can be used only after the application emits the ready event.
* Trying to use the module before the ready event will throw an error.
*/
interface Net extends NodeJS.EventEmitter {
/**
* @param options The ClientRequest constructor options.
* @param callback A one time listener for the response event.
*
* @returns a ClientRequest instance using the provided options which are directly
* forwarded to the ClientRequest constructor.
*/
request(options: string | RequestOptions, callback?: (response: IncomingMessage) => void): ClientRequest;
}
/**
* The RequestOptions interface allows to define various options for an HTTP request.
*/
interface RequestOptions {
/**
* The HTTP request method. Defaults to the GET method.
*/
method?: string;
/**
* The request URL. Must be provided in the absolute form with the protocol
* scheme specified as http or https.
*/
url?: string;
/**
* The Session instance with which the request is associated.
*/
session?: Session;
/**
* The name of the partition with which the request is associated.
* Defaults to the empty string. The session option prevails on partition.
* Thus if a session is explicitly specified, partition is ignored.
*/
partition?: string;
/**
* The protocol scheme in the form ‘scheme:’. Currently supported values are ‘http:’ or ‘https:’.
* Defaults to ‘http:’.
*/
Protocol?: 'http:' | 'https:';
/**
* The server host provided as a concatenation of the hostname and the port number ‘hostname:port’.
*/
host?: string;
/**
* The server host name.
*/
hostname?: string;
/**
* The server’s listening port number.
*/
port?: number;
/**
* The path part of the request URL.
*/
path?: string;
/**
* A map specifying extra HTTP header name/value.
*/
headers?: { [key: string]: any };
}
/**
* The ClientRequest class represents an HTTP request.
*/
class ClientRequest extends NodeJS.EventEmitter {
/**
* Emitted when an HTTP response is received for the request.
*/
on(event: 'response', listener: (response: IncomingMessage) => void): this;
/**
* Emitted when an authenticating proxy is asking for user credentials.
* The callback function is expected to be called back with user credentials.
* Providing empty credentials will cancel the request and report an authentication
* error on the response object.
*/
on(event: 'login', listener: (authInfo: LoginAuthInfo, callback: (username?: string, password?: string) => void) => void): this;
/**
* Emitted just after the last chunk of the request’s data has been written into
* the request object.
*/
on(event: 'finish', listener: () => void): this;
/**
* Emitted when the request is aborted. The abort event will not be fired if the
* request is already closed.
*/
on(event: 'abort', listener: () => void): this;
/**
* Emitted when the net module fails to issue a network request.
* Typically when the request object emits an error event, a close event will
* subsequently follow and no response object will be provided.
*/
on(event: 'error', listener: (error: Error) => void): this;
/**
* Emitted as the last event in the HTTP request-response transaction.
* The close event indicates that no more events will be emitted on either the
* request or response objects.
*/
on(event: 'close', listener: () => void): this;
on(event: string, listener: Function): this;
/**
* A Boolean specifying whether the request will use HTTP chunked transfer encoding or not.
* Defaults to false. The property is readable and writable, however it can be set only before
* the first write operation as the HTTP headers are not yet put on the wire.
* Trying to set the chunkedEncoding property after the first write will throw an error.
*
* Using chunked encoding is strongly recommended if you need to send a large request
* body as data will be streamed in small chunks instead of being internally buffered
* inside Electron process memory.
*/
chunkedEncoding: boolean;
/**
* @param options If options is a String, it is interpreted as the request URL.
* If it is an object, it is expected to be a RequestOptions.
* @param callback A one time listener for the response event.
*/
constructor(options: string | RequestOptions, callback?: (response: IncomingMessage) => void);
/**
* Adds an extra HTTP header. The header name will issued as it is without lowercasing.
* It can be called only before first write. Calling this method after the first write
* will throw an error.
* @param name An extra HTTP header name.
* @param value An extra HTTP header value.
*/
setHeader(name: string, value: string): void;
/**
* @param name Specify an extra header name.
* @returns The value of a previously set extra header name.
*/
getHeader(name: string): string;
/**
* Removes a previously set extra header name. This method can be called only before first write.
* Trying to call it after the first write will throw an error.
* @param name Specify an extra header name.
*/
removeHeader(name: string): void;
/**
* Adds a chunk of data to the request body. The first write operation may cause the
* request headers to be issued on the wire.
* After the first write operation, it is not allowed to add or remove a custom header.
* @param chunk A chunk of the request body’s data. If it is a string, it is converted
* into a Buffer using the specified encoding.
* @param encoding Used to convert string chunks into Buffer objects. Defaults to ‘utf-8’.
* @param callback Called after the write operation ends.
*/
write(chunk: string | Buffer, encoding?: string, callback?: Function): boolean;
/**
* Sends the last chunk of the request data. Subsequent write or end operations will not be allowed.
* The finish event is emitted just after the end operation.
* @param chunk A chunk of the request body’s data. If it is a string, it is converted into
* a Buffer using the specified encoding.
* @param encoding Used to convert string chunks into Buffer objects. Defaults to ‘utf-8’.
* @param callback Called after the write operation ends.
*
*/
end(chunk?: string | Buffer, encoding?: string, callback?: Function): boolean;
/**
* Cancels an ongoing HTTP transaction. If the request has already emitted the close event,
* the abort operation will have no effect.
* Otherwise an ongoing event will emit abort and close events.
* Additionally, if there is an ongoing response object,it will emit the aborted event.
*/
abort(): void
}
/**
* An IncomingMessage represents an HTTP response.
*/
interface IncomingMessage extends NodeJS.ReadableStream {
/**
* The data event is the usual method of transferring response data into applicative code.
*/
on(event: 'data', listener: (chunk: Buffer) => void): this;
/**
* Indicates that response body has ended.
*/
on(event: 'end', listener: () => void): this;
/**
* Emitted when a request has been canceled during an ongoing HTTP transaction.
*/
on(event: 'aborted', listener: () => void): this;
/**
* Emitted when an error was encountered while streaming response data events.
* For instance, if the server closes the underlying while the response is still
* streaming, an error event will be emitted on the response object and a close
* event will subsequently follow on the request object.
*/
on(event: 'error', listener: (error: Error) => void): this;
on(event: string, listener: Function): this;
/**
* An Integer indicating the HTTP response status code.
*/
statusCode: number;
/**
* A String representing the HTTP status message.
*/
statusMessage: string;
/**
* An object representing the response HTTP headers. The headers object is formatted as follows:
* - All header names are lowercased.
* - Each header name produces an array-valued property on the headers object.
* - Each header value is pushed into the array associated with its header name.
*/
headers: Headers;
/**
* A string indicating the HTTP protocol version number. Typical values are ‘1.0’ or ‘1.1’.
*/
httpVersion: string;
/**
* An integer-valued read-only property that returns the HTTP major version number.
*/
httpVersionMajor: number;
/**
* An integer-valued read-only property that returns the HTTP minor version number.
*/
httpVersionMinor: number;
}
// https://github.com/electron/electron/blob/master/docs/api/power-monitor.md
/**
@@ -5565,6 +5806,7 @@ declare namespace Electron {
globalShortcut: Electron.GlobalShortcut;
Menu: typeof Electron.Menu;
MenuItem: typeof Electron.MenuItem;
net: Electron.Net;
powerMonitor: Electron.PowerMonitor;
powerSaveBlocker: Electron.PowerSaveBlocker;
protocol: Electron.Protocol;
+33 -12
View File
@@ -1,19 +1,13 @@
/**
* howler-tests.ts
* Created by xperiments on 02/09/14.
*/
import * as howler from "howler";
Howler.codecs('ogg');
Howler.iOSAutoEnable = true;
var sound = new Howl({
urls: ['sound.mp3']
}).play();
src: ['sound.mp3']
});
sound.play();
var sound = new Howl({
urls: ['sound.mp3', 'sound.ogg', 'sound.wav'],
src: ['sound.webm', 'sound.mp3', 'sound.wav'],
autoplay: true,
loop: true,
volume: 0.5,
@@ -23,7 +17,7 @@ var sound = new Howl({
});
var sound = new Howl({
urls: ['sounds.mp3', 'sounds.ogg'],
src: ['sounds.webm', 'sounds.mp3'],
sprite: {
blast: [0, 1000],
laser: [2000, 3000],
@@ -31,5 +25,32 @@ var sound = new Howl({
}
});
// shoot the laser!
// Shoot the laser!
sound.play('laser');
var sound = new Howl({
src: ['sound.webm', 'sound.mp3']
});
// Clear listener after first call.
sound.once('load', function(){
sound.play();
});
// Fires when the sound finishes playing.
sound.on('end', function(){
console.log('Finished!');
});
var sound = new Howl({
src: ['sound.webm', 'sound.mp3']
});
// Play returns a uniqe Sound ID that can be passed
// into any method on Howl to control that specific sound.
var id1 = sound.play();
var id2 = sound.play();
// Fade out the first sound and speed up the second.
sound.fade(1, 0, 1000, id1);
sound.rate(1.5, id2);
+87 -53
View File
@@ -1,73 +1,107 @@
// Type definitions for howler.js v1.1.29
// Type definitions for howler.js v2.0.0
// Project: https://github.com/goldfire/howler.js
// Definitions by: Pedro Casaubon <https://github.com/xperiments/>
// Definitions by: Pedro Casaubon <https://github.com/xperiments/>, Todd Dukart <https://github.com/tdukart/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare class HowlerGlobal {
mute(muted: boolean): HowlerGlobal;
interface HowlerGlobal {
mute(muted: boolean): void;
volume(): number;
volume(volume: number): HowlerGlobal;
codecs(extension: string): boolean;
iOSAutoEnable: boolean;
volume(volume: number): this;
codecs(ext: string): boolean;
unload(): void;
usingWebAudio: boolean;
noAudio: boolean;
mobileAudioEnable: boolean;
autoSuspend: boolean;
ctx: AudioContext;
masterGain: GainNode;
}
declare var Howler: HowlerGlobal;
declare let Howler: HowlerGlobal;
interface IHowlSoundSpriteDefinition {
[name: string]: number[];
[name: string]: [number, number]|[number, number, boolean]
}
declare type HowlPos3d = [number, number, number]|[number, number, number, number];
interface IHowlProperties {
autoplay?: boolean;
buffer?: boolean;
duration?: number;
format?: string;
loop?: boolean;
sprite?: IHowlSoundSpriteDefinition;
src?: string;
pos3d?: HowlPos3d;
src: string|string[];
volume?: number;
urls?: string[];
html5?: boolean;
loop?: boolean;
preload?: boolean;
autoplay?: boolean;
mute?: boolean;
sprite?: IHowlSoundSpriteDefinition;
rate?: number;
model?: 'equalpower'|'HRTF';
onend?: Function;
onload?: Function;
onloaderror?: Function;
onpause?: Function;
onplay?: Function;
pool?: number;
format?: string[] | string;
onload?: () => void;
onloaderror?: (soundId: number, error: any) => void;
onplay?: (soundId: number) => void;
onend?: (soundId: number) => void;
onpause?: (soundId: number) => void;
onstop?: (soundId: number) => void;
onmute?: (soundId: number) => void;
onvolume?: (soundId: number) => void;
onrate?: (soundId: number) => void;
onseek?: (soundId: number) => void;
onfade?: (soundId: number) => void;
}
interface Howl {
autoplay: Boolean;
buffer: Boolean;
format: string;
rate: number;
model: string;
onend: Function;
onload: Function;
onloaderror: Function;
onpause: Function;
onplay: Function;
load(): Howl;
play(sprite?: string, callback?: (soundId: string) => void): Howl;
play(callback?: (soundId: string) => void): Howl;
pause(soundId?: string): Howl;
stop(soundId?: string): Howl;
mute(muted?: boolean, soundId?: string): Howl;
fade(from: number, to: number, duration: number, callback?: Function, soundId?: string): Howl;
loop(): boolean;
loop(loop: boolean): Howl;
pos(position?: number, soundId?: string): number;
pos3d(x: number, y: number, z: number, soundId?: string): any;
sprite(definition?: IHowlSoundSpriteDefinition): IHowlSoundSpriteDefinition;
play(spriteOrId?: string|number): number; // .play() is not chainable; the other methods are
pause(id?: number): this;
stop(id?: number): this;
mute(): boolean;
mute(muted: boolean, id?: number): this;
volume(): number;
volume(volume?: number, soundId?: string): Howl;
urls(): string[];
urls(urls: string[]): Howl;
on(event: string, listener?: Function): Howl;
off(event: string, listener?: Function): Howl;
volume(idOrSetVolume: number): this | number;
volume(volume: number, id: number): this;
fade(from: number, to: number, duration: number, id?: number): this;
rate(): number;
rate(idOrSetRate: number): this | number;
rate(rate: number, id: number): this;
seek(seek?: number, id?: number): this;
loop(loop?: boolean, id?: number): this;
playing(id?: number): boolean;
duration(id?: number): number;
on(event: 'load', callback: () => void, id?: number): this;
on(event: 'loaderror', callback: (soundId: number, error: any) => void, id?: number): this;
on(event: 'play', callback: (soundId: number) => void, id?: number): this;
on(event: 'end', callback: (soundId: number) => void, id?: number): this;
on(event: 'pause', callback: (soundId: number) => void, id?: number): this;
on(event: 'stop', callback: (soundId: number) => void, id?: number): this;
on(event: 'mute', callback: (soundId: number) => void, id?: number): this;
on(event: 'volume', callback: (soundId: number) => void, id?: number): this;
on(event: 'rate', callback: (soundId: number) => void, id?: number): this;
on(event: 'seek', callback: (soundId: number) => void, id?: number): this;
on(event: 'fade', callback: (soundId: number) => void, id?: number): this;
on(event: string, callback: Function, id?: number): this;
once(event: 'load', callback: () => void, id?: number): this;
once(event: 'loaderror', callback: (soundId: number, error: any) => void, id?: number): this;
once(event: 'play', callback: (soundId: number) => void, id?: number): this;
once(event: 'end', callback: (soundId: number) => void, id?: number): this;
once(event: 'pause', callback: (soundId: number) => void, id?: number): this;
once(event: 'stop', callback: (soundId: number) => void, id?: number): this;
once(event: 'mute', callback: (soundId: number) => void, id?: number): this;
once(event: 'volume', callback: (soundId: number) => void, id?: number): this;
once(event: 'rate', callback: (soundId: number) => void, id?: number): this;
once(event: 'seek', callback: (soundId: number) => void, id?: number): this;
once(event: 'fade', callback: (soundId: number) => void, id?: number): this;
once(event: string, callback: Function, id?: number): this;
off(event: string, callback?: Function, id?: number): this;
state(): 'unloaded' | 'loading' | 'loaded';
load(): void;
unload(): void;
}
+19
View File
@@ -0,0 +1,19 @@
import human = require('humanparser');
let parsedName = human.parseName("Mr. William R. Hearst, III");
parsedName.firstName;
parsedName.lastName;
parsedName.fullName;
parsedName.suffix;
parsedName.middleName;
parsedName.salutation;
let parsedAddress = human.parseAddress("123 Happy Street, Honolulu, HI 65780");
parsedAddress.address;
parsedAddress.state;
parsedAddress.fullAddress;
parsedAddress.zip;
parsedAddress.city;
let parsedFullName = human.getFullestName("John & Peggy Sue");
parsedFullName.fullName;
+37
View File
@@ -0,0 +1,37 @@
// Type definitions for humanparser 1.1.1
// Project: https://github.com/chovy/humanparser
// Definitions by: Michał Podeszwa <https://github.com/MichalPodeszwa/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace humanparser {
interface NameOutput {
firstName: string;
lastName: string;
fullName: string;
suffix?: string;
middleName?: string;
salutation?: string;
}
interface FullerNameOutput {
fullName: string;
}
interface AddressOutput {
address: string;
state: string;
fullAddress: string;
zip: string;
city: string;
}
interface HumanparserStatic {
parseName (name: string): NameOutput;
getFullestName (name: string): FullerNameOutput;
parseAddress (address: string): AddressOutput;
}
}
declare const humanparser: humanparser.HumanparserStatic;
export = humanparser;
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"humanparser-tests.ts"
]
}
+2 -2
View File
@@ -1032,7 +1032,7 @@ declare namespace __MaterialUI {
export class List extends React.Component<ListProps, {}> {
}
interface ListItemProps extends React.HTMLAttributes<{}>, React.Props<ListItem> {
interface ListItemProps extends EnhancedButtonProps {
// <EnhancedButton/> is the element that get the 'other' properties
autoGenerateNestedIndicator?: boolean;
disableKeyboardFocus?: boolean;
@@ -1099,7 +1099,7 @@ declare namespace __MaterialUI {
export class Menu extends React.Component<MenuProps, {}> {
}
interface MenuItemProps extends React.HTMLAttributes<{}>, React.Props<MenuItem> {
interface MenuItemProps extends List.ListItemProps {
// <ListItem/> is the element that get the 'other' properties
animation?: React.ComponentClass<Popover.PopoverAnimationProps>;
checked?: boolean;
+10
View File
@@ -0,0 +1,10 @@
// Type definitions for metric-suffix.js 0.0.3
// Project: https://github.com/mstdokumaci/metric-suffix.js
// Definitions by: David Muller <https://github.com/davidm77>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export as namespace metric_suffix;
export = metric_suffix;
declare function metric_suffix(value: number, precision?: number): string;
@@ -0,0 +1,22 @@
import metric_suffix = require('metric-suffix');
metric_suffix(42) // 42
metric_suffix(999) // 999
metric_suffix(1000) // 1.0k
metric_suffix(1234, 2) // 1.2k
metric_suffix(12345, 2) // 12k
metric_suffix(123456, 2) // 123k
metric_suffix(1234, 3) // 1.23k
metric_suffix(12345, 3) // 12.3k
metric_suffix(123456, 3) // 123k
metric_suffix(1234, 4) // 1.234k
metric_suffix(12345, 4) // 12.35k
metric_suffix(123456, 4) // 123.5k
metric_suffix(986725) // 987k
metric_suffix(986725, 4) // 986.7k
metric_suffix(986725123) // 987M
metric_suffix(986725123, 5) // 986.73M
+20
View File
@@ -0,0 +1,20 @@
metric_suffix(42) // 42
metric_suffix(999) // 999
metric_suffix(1000) // 1.0k
metric_suffix(1234, 2) // 1.2k
metric_suffix(12345, 2) // 12k
metric_suffix(123456, 2) // 123k
metric_suffix(1234, 3) // 1.23k
metric_suffix(12345, 3) // 12.3k
metric_suffix(123456, 3) // 123k
metric_suffix(1234, 4) // 1.234k
metric_suffix(12345, 4) // 12.35k
metric_suffix(123456, 4) // 123.5k
metric_suffix(986725) // 987k
metric_suffix(986725, 4) // 986.7k
metric_suffix(986725123) // 987M
metric_suffix(986725123, 5) // 986.73M
+20
View File
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"metric-suffix-tests.ts",
"metric-suffix-external-tests.ts"
]
}
+37
View File
@@ -0,0 +1,37 @@
// Type definitions for msgpack5 v3.4.0
// Project: https://github.com/mcollina/msgpack5/
// Definitions by: Wonshik Kim <https://github.com/wokim/>, Kei Son <https://github.com/heycalmdown/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import stream = require('stream');
import bl = require('bl');
interface MsgPackOptions {
forceFloat64?: boolean;
compatibilityMode?: boolean;
}
declare namespace msgpack5 {
interface EncodeDecodeOptions {
header?: boolean;
}
class Base extends stream.Transform {}
class Encoder extends Base {}
class Decoder extends Base {}
interface MessagePack {
encode(obj: any): bl;
decode(buf: Buffer): any;
decode(buf: bl): any;
register<T>(type: number, $constructor: any, encode: (obj: T) => Buffer, decode: (data: Buffer) => T): MessagePack;
registerEncoder<T>(check: (obj: T) => boolean, encode: (obj: T) => Buffer): MessagePack;
registerDecoder(type: number, decode: (data: Buffer) => any): MessagePack;
encoder(opts?: EncodeDecodeOptions): Encoder;
decoder(opts?: EncodeDecodeOptions): Decoder;
}
}
declare function msgpack5(opts?: MsgPackOptions): msgpack5.MessagePack;
export = msgpack5;
+33
View File
@@ -0,0 +1,33 @@
import * as msgpack from 'msgpack5';
// msgpack()
let packer = msgpack();
packer = msgpack({ forceFloat64: true });
packer = msgpack({ compatibilityMode: true });
class InputType {
number: number;
string: string;
constructor() {
this.number = 1;
this.string = '1';
}
}
// msgpack().encode, msgpack().decode()
const IN: InputType = new InputType();
const encoded = packer.encode(IN);
const OUT: InputType = packer.decode(encoded);
// msgpack().registerEncoder(), msgpack().registerDecoder()
packer = packer.registerEncoder((o: InputType) => true, (o: InputType) => new Buffer(''));
packer = packer.registerDecoder(0x01, (data) => ({ content: { number: 1, string: '1' }}));
// msgpack().register()
packer = packer.register<InputType>(0x01, InputType, (obj: InputType) => new Buffer(''), (data: Buffer) => (new InputType()));
// msgpack().encoder(), msgpack().decoder()
const encoder = packer.encoder();
const decoder = packer.decoder();
encoder.pipe(decoder);
+20
View File
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"msgpack5-test.ts"
]
}
+278
View File
@@ -0,0 +1,278 @@
// Type definitions for node-neo4j 2.0.0
// Project: https://github.com/thingdom/node-neo4j
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="request" />
import { Request } from "request";
type ResultCallback = (error: any, result: any) => void;
type DoneCallback = (error: any) => void;
/**
* Authentication information.
* @interface
*/
export interface Authentication {
password: string;
username: string;
}
/**
* Password options.
* @interface
*/
export interface ChangePasswordOptions {
password: string;
}
/**
* Constraint options.
* @interface
*/
export interface ConstraintOptions {
label?: any;
property?: any;
}
/**
* Cypher request options.
* @interface
*/
export interface CypherOptions {
commit?: {};
headers?: {};
lean?: {};
params?: {};
query?: {};
}
/**
* Database options.
* @interface
*/
export interface GraphDatabaseOptions {
/**
* HTTP agent.
* @type {any}
*/
agent: any;
/**
* Authentication information.
* @type {string|Authentication}
*/
auth: string | Authentication;
/**
* HTTP headers.
* @type {Object}
*/
headers: {};
/**
* Proxy address.
* @type {string}
*/
proxy: string;
/**
* URL connection.
* @type {string}
*/
url: string;
}
/**
* HTTP options.
* @interface
*/
export interface HttpOptions {
headers: {};
method: string;
path: string;
body: any;
raw: any;
}
/**
* Index options.
* @interface
*/
export interface IndexOptions {
label?: any;
property?: any;
}
/**
* Transaction.
* @interface
*/
export interface Transaction {
expiresAt: Date;
expiresIn: Date | number;
state: string;
commit(callback: DoneCallback): void;
cypher(options: CypherOptions, callback: ResultCallback): Request;
renew(callback: DoneCallback): void;
rollback(callback: DoneCallback): void;
}
/**
* Database.
* @class
*/
export class GraphDatabase {
/**
* Constructor.
* @constructor
* @param {string} url A URL connection.
*/
constructor(url: string);
/**
* Constructor.
* @constructor
* @param {GraphDatabaseOptions} options Connection options.
*/
constructor(options: GraphDatabaseOptions);
/**
* Agent.
* @type {any}
*/
agent: any;
/**
* Credentials.
* @type {Authentication}
*/
auth: Authentication;
/**
* Headers.
* @type {Object}
*/
headers: {};
/**
* Proxy.
* @type {any}
*/
proxy: any;
/**
* URL connection.
* @type {string}
*/
url: string;
/**
* Makes multiple queries, across multiple network requests, all within a single transaction.
* @return {Transaction} The transaction.
*/
beginTransaction(): Transaction;
/**
* Changes password.
* @param {ChangePasswordOptions} options Options.
* @param {DoneCallback} callback A callback.
*/
changePassword(options: ChangePasswordOptions, callback: DoneCallback): void;
/**
* Checks if the password must be changed.
* @param {Function} callback A callback.
*/
checkPasswordChangeNeeded(callback: (error: any, changed: boolean) => void): void;
/**
* Creates a constraint.
* @param {ConstraintOptions} options Options.
* @param {ResultCallback} callback A callback.
*/
createConstraint(options: ConstraintOptions, callback: ResultCallback): void;
/**
* Makes simple, parametrized Cypher queries.
* @param {CypherOptions} options Options.
* @param {ResultCallback} callback A callback.
*/
cypher(options: CypherOptions, callback: ResultCallback): Request;
/**
* Drops a constraint.
* @param {ConstraintOptions} options Options.
* @param {DoneCallback} callback A callback.
*/
dropConstraint(options: ConstraintOptions, callback: DoneCallback): void;
/**
* Drop an index.
* @param {IndexOptions} options Options.
* @param {DoneCallback} callback A callback.
*/
dropIndex(options: IndexOptions, callback: DoneCallback): void;
/**
* Gets constraints.
* @param {ConstraintOptions} options Options or callback.
* @param {ResultCallback} callback A callback.
*/
getConstraints(options: ConstraintOptions, callback?: ResultCallback): void;
/**
* Gets indexes.
* @param {ResultCallback} callback A callback.
*/
getIndexes(callback?: ResultCallback): void;
/**
* Gets indexes.
* @param {IndexOptions} options Options.
* @param {ResultCallback} callback A callback.
*/
getIndexes(options: IndexOptions, callback: ResultCallback): void;
/**
* Get labels.
* @param {ResultCallback} callback A callback.
*/
getLabels(callback: ResultCallback): void;
/**
* Gets property keys.
* @param {ResultCallback} callback A callback.
*/
getPropertyKeys(callback: ResultCallback): void;
/**
* Gets relationship types.
* @param {ResultCallback} callback A callback.
*/
getRelationshipTypes(callback: ResultCallback): void;
/**
* Determines if a constraint exists.
* @param {ConstraintOptions} options Options.
* @param {Function} callback A callback.
*/
hasConstraint(options: ConstraintOptions, callback: (error: any, exists: boolean) => void): void;
/**
* Determines if an index exists.
* @param {IndexOptions} options Options.
* @param {Function} callback A callback.
*/
hasIndex(options: IndexOptions, callback: (error: any, exists: boolean) => void): void;
/**
* Makes arbitrary HTTP request to the REST API.
* @param {HttpOptions} options Options.
* @param {ResultCallback} callback A callback.
* @return {Request} The HTTP request.
*/
http(options: HttpOptions, callback: ResultCallback): Request;
}
+55
View File
@@ -0,0 +1,55 @@
import * as neo4j from "neo4j";
let db = new neo4j.GraphDatabase("http://localhost:7474");
db = new neo4j.GraphDatabase({
url: 'http://localhost:7474',
auth: {
password: "",
username: ""
},
headers: {},
proxy: "",
agent: null
});
/** Password */
db.checkPasswordChangeNeeded((error: any, changed: boolean) => { });
db.changePassword({ password: "" }, (error: any) => { });
/** Query */
db.cypher({ query: 'MATCH (u:User {email: {email}}) RETURN u', params: { email: 'alice@example.com' } }, (error: any, results: any) => { });
/** Constraint */
db.createConstraint({ label: "", property: "" }, (error: any, constraint: any) => { });
db.dropConstraint({ label: "", property: "" }, (error: any) => { });
db.getConstraints({ label: "", property: "" }, (error: any, constraints: any) => { });
db.hasConstraint({ label: "", property: "" }, (error: any, exists: boolean) => { });
/** Index */
db.dropIndex({ label: "", property: "" }, (error: any) => { });
db.getIndexes((error: any, indexes: any) => { });
db.getIndexes({ label: "", property: "" }, (error: any, indexes: any) => { });
db.hasIndex({ label: "", property: "" }, (error: any, exists: boolean) => { });
/** Labels */
db.getLabels((error: any, labels: any) => { });
/** Property keys */
db.getPropertyKeys((error: any, keys: any) => { });
/** Relationship */
db.getRelationshipTypes((error: any, types: any) => { });
/** HTTP */
db.http({ method: "", path: "", headers: {}, body: "", raw: "" }, (error: any, body: any) => { });
/** Transaction */
const transaction: neo4j.Transaction = db.beginTransaction();
transaction.rollback((error: any) => { });
transaction.commit((error: any) => { });
transaction.renew((error: any) => { });
transaction.cypher({ query: 'MATCH (u:User {email: {email}}) RETURN u', params: { email: 'alice@example.com' } }, (error: any, results: any) => { });
const expiresIn: Date | number = transaction.expiresIn;
const expiresAt: Date = transaction.expiresAt;
const state: string = transaction.state
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"neo4j-tests.ts"
]
}
+1 -1
View File
@@ -15,7 +15,7 @@
"node": ">= 6.9.1"
},
"scripts": {
"test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed"
"test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed --nProcesses 1"
},
"devDependencies": {
"types-publisher": "Microsoft/types-publisher#production"
+17
View File
@@ -0,0 +1,17 @@
// Type definitions for react-hot-loader 3.0
// Project: https://github.com/gaearon/react-hot-loader
// Definitions by: Jacek Jagiello <https://github.com/jacekjagiello/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as React from "react"
interface ErrorReporterProps {
error: any
}
export interface AppContainerProps {
children?: React.ReactElement<any>,
errorReporter?: React.ComponentClass<ErrorReporterProps> | React.StatelessComponent<ErrorReporterProps>
}
export class AppContainer extends React.Component<AppContainerProps, {}> {}
@@ -0,0 +1,29 @@
import * as React from 'react'
import { AppContainer } from 'react-hot-loader'
interface ErrorReporterProps {
error: any
}
class ErrorReporterComponent extends React.Component<ErrorReporterProps, any> {
public render() {
return <p>{this.props.error.message}</p>
}
}
const DummyComponent = () => <p>Dummy component</p>
const ErrorReporter = ({ error } : ErrorReporterProps) => <ErrorReporterComponent error={error} />
class AppContainerTest extends React.Component<any, any> {
public render() {
return (
<div>
<AppContainer errorReporter={ErrorReporterComponent}>
<DummyComponent />
</AppContainer>
</div>
)
}
}
export default AppContainerTest
+20
View File
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"jsx": "react",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"react-hot-loader-tests.tsx"
]
}
+2 -2
View File
@@ -20,9 +20,9 @@ declare namespace ReactSelectClass {
export interface Option {
/** Text for rendering */
label: string;
label?: string;
/** Value for searching */
value: string | number;
value?: string | number;
/**
* Allow this option to be cleared
* @default true
+1
View File
@@ -53,6 +53,7 @@ interface VideoJSPlayer {
addRemoteTextTrack(options : {}) : HTMLTrackElement;
removeRemoteTextTrack(track : HTMLTrackElement) : void;
poster(val?: string) : string|VideoJSPlayer;
playbackRate(rate?: number) : number;
}
interface VideoJSStatic {
+18
View File
@@ -0,0 +1,18 @@
// Type definitions for voronoi-diagram 1.0.1
// Project: https://github.com/mikolalysenko/voronoi-diagram
// Definitions by: Michael Neu <https://github.com/michaelneu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace voronoi {
type Point = number[];
type Cell = number[];
interface VoronoiDiagram {
cells: Cell[];
positions: Point[];
}
}
declare function voronoi(points: voronoi.Point[]) : voronoi.VoronoiDiagram;
export = voronoi;
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"voronoi-diagram-tests.ts"
]
}
+17
View File
@@ -0,0 +1,17 @@
/// <reference path="index.d.ts" />
import voronoi = require("voronoi-diagram");
const x: voronoi.Point = [1, 2];
let points: voronoi.Point[] = [
x,
[1, 1],
[2, 2],
[3, 3]
];
let diagram = voronoi(points);
let firstCell = diagram.cells[0],
firstPosition = diagram.positions[0];