From 9e13e02ace794fba00f44bcf70f41cdca1a56b4e Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 15 Jun 2016 15:59:48 +0300 Subject: [PATCH 01/55] Updated definitions for wampy.js v3.0.x --- wampy/wampy-tests.ts | 5 +++-- wampy/wampy.d.ts | 22 +++++++++++++++++----- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/wampy/wampy-tests.ts b/wampy/wampy-tests.ts index f7dcf9fe52..c0ac8d6656 100644 --- a/wampy/wampy-tests.ts +++ b/wampy/wampy-tests.ts @@ -13,7 +13,8 @@ ws.options({ onConnect: function () { console.log('Yahoo! We are online!'); }, onClose: function () { console.log('See you next time!'); }, onError: function () { console.log('Breakdown happened'); }, - onReconnect: function () { console.log('Reconnecting...'); } + onReconnect: function () { console.log('Reconnecting...'); }, + onReconnectSuccess: function () { console.log('Successfully reconnected!'); } }); ws.connect(); @@ -93,7 +94,7 @@ var status = ws.getOpStatus(); ws.cancel(status.reqId); -var sqrt_f = function (x: number) { return x*x; }; +var sqrt_f = function (x: number, y: any) { return [{}, x*x]; }; ws.register('sqrt.value', sqrt_f); diff --git a/wampy/wampy.d.ts b/wampy/wampy.d.ts index 650a8a91a5..e068b97a25 100644 --- a/wampy/wampy.d.ts +++ b/wampy/wampy.d.ts @@ -1,4 +1,4 @@ -// Type definitions for wampy.js v2.0.1 +// Type definitions for wampy.js v3.0.x // Project: https://github.com/KSDaemon/wampy.js // Definitions by: Konstantin Burkalev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -12,10 +12,13 @@ declare module "wampy" { transportEncoding?: string; realm?: string; helloCustomDetails?: any; + onChallenge?: (auth_method: string, challenge_details: string) => string; + authid?: string; onConnect?: () => void; onClose?: () => void; onError?: () => void; onReconnect?: () => void; + onReconnectSuccess?: () => void; ws?: any; msgpackCoder?: any; } @@ -36,7 +39,7 @@ declare module "wampy" { } interface RegisterCallbacksHash extends SuccessErrorCallbacksHash { - rpc: (data: any) => any; + rpc: (data: any, options: any) => any[]; } interface CallSuccessErrorCallbacksHash { @@ -51,8 +54,17 @@ declare module "wampy" { disclose_me?: boolean; } - interface CallAdvancedOptions extends AdvancedOptions { + interface PublishAdvancedOptions extends AdvancedOptions { + exclude_authid?: string | string[]; + exclude_authrole?: string | string[]; + eligible_authid?: string | string[]; + eligible_authrole?: string | string[]; + } + + interface CallAdvancedOptions { + disclose_me?: boolean; receive_progress?: boolean; + timeout?: number; } interface CancelAdvancedOptions { @@ -71,7 +83,7 @@ declare module "wampy" { publish(topicURI: string, payload?: any, callbacks?: SuccessErrorCallbacksHash, - advancedOptions?: AdvancedOptions): Wampy; + advancedOptions?: PublishAdvancedOptions): Wampy; call(topicURI: string, payload?: any, callbacks?: (((data: any) => void) | CallSuccessErrorCallbacksHash), @@ -79,7 +91,7 @@ declare module "wampy" { cancel(reqId: number, callbacks?: ((() => void) | SuccessErrorCallbacksHash), advancedOptions?: CancelAdvancedOptions): Wampy; - register(topicURI: string, callbacks: (((data: any) => any) | RegisterCallbacksHash)): Wampy; + register(topicURI: string, callbacks: (((data: any, options: any) => any[]) | RegisterCallbacksHash)): Wampy; unregister(topicURI: string, callbacks?: ((() => void) | SuccessErrorCallbacksHash)): Wampy; } From b2e1844aba38db3f4181205cf4d49c7b769a56c5 Mon Sep 17 00:00:00 2001 From: efokschaner Date: Sat, 6 Aug 2016 23:26:19 -0700 Subject: [PATCH 02/55] Update definitions for msgpack-lite --- msgpack-lite/index.d.ts | 130 ++++++++++++++++++++++++----- msgpack-lite/msgpack-lite-tests.ts | 76 ++++++++++++++++- msgpack-lite/tsconfig.json | 2 +- 3 files changed, 183 insertions(+), 25 deletions(-) diff --git a/msgpack-lite/index.d.ts b/msgpack-lite/index.d.ts index 400d22b2e7..53ed592afa 100644 --- a/msgpack-lite/index.d.ts +++ b/msgpack-lite/index.d.ts @@ -1,14 +1,72 @@ -// Type definitions for msgpack-lite 0.1.20 +// Type definitions for msgpack-lite v0.1.26 // Project: https://github.com/kawanet/msgpack-lite -// Definitions by: Endel Dreyer +// Definitions by: Endel Dreyer , Edmund Fokschaner // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -declare module "msgpack-lite" { - import { Transform } from "stream"; +declare module 'msgpack-lite' { + import * as stream from 'stream'; namespace MsgpackLite { - interface BufferOptions { codec: any; } + /** + * encode from JS Object to MessagePack + */ + function encode(input: any, options?: EncoderOptions): Buffer; + + /** + * decode from MessagePack to JS Object + */ + function decode(input: Buffer | Uint8Array | Array, options?: DecoderOptions): any; + + /** + * create a stream that encodes from JS Object to MessagePack + */ + function createEncodeStream(options?: EncoderOptions & stream.TransformOptions ): EncodeStream; + + /** + * create a stream that decodes from MessagePack (Buffer) to JS Object + */ + function createDecodeStream(options?: DecoderOptions & stream.TransformOptions): DecodeStream; + + /** + * Codecs allow for Custom Extension Types + * Register a custom extension type number to serialize/deserialize your own class instances. + * https://github.com/kawanet/msgpack-lite#custom-extension-types-codecs + * If you wish to modify the default built-in codec, you can access it at msgpack.codec.preset + */ + function createCodec(options?: CodecOptions): Codec; + + /** + * The default built-in codec + */ + var codec: { + /** + * The default built-in codec + */ + preset: Codec; + }; + + interface Codec { + /** + * Register a custom extension to serialize your own class instances + * + * @param etype an integer within the range of 0 and 127 (0x0 and 0x7F) + * @param Class the constructor of the type you wish to serialize + * @param packer a function that converts an instance of T to bytes + */ + addExtPacker( + etype: number, + Class: new(...args: any[]) => T, + packer: (t: T) => Buffer | Uint8Array): void; + + /** + * Register a custom extension to deserialize your own class instances + * + * @param etype an integer within the range of 0 and 127 (0x0 and 0x7F) + * @param unpacker a function that converts bytes to an instance of T + */ + addExtUnpacker(etype: number, unpacker: (data: Buffer | Uint8Array) => T): void; + } interface Encoder { bufferish: any; @@ -42,29 +100,59 @@ declare module "msgpack-lite" { end: (chunk: any) => void; } - interface EncodeStream extends Transform { + interface EncodeStream extends stream.Transform { encoder: Encoder; } - interface DecodeStream extends Transform { + + interface DecodeStream extends stream.Transform { decoder: Decoder; } - interface Codec { - new (options?: any): Codec; - options: any; - init (): void; - addExtPacker (etype: number, Class: any, packer: (value: any) => any): void; - getExtPacker (value: any): (value: any) => any; - addExtUnpacker (etype: number, unpacker: (value: any) => any): void; - getExtUnpacker (etype: number): (value: any) => any; + interface CodecOptions { + /** + * It includes the preset extensions for JavaScript native objects. + * @see https://github.com/kawanet/msgpack-lite#extension-types + * @default false + */ + preset?: boolean; + /** + * It runs a validation of the value before writing it into buffer. + * This is the default behavior for some old browsers which do not support ArrayBuffer object. + * @default varies + */ + safe?: boolean; + /** + * It uses raw formats instead of bin and str. + * Set true for compatibility with msgpack's old spec. + * @see https://github.com/kawanet/msgpack-lite#compatibility-mode + * @default false + */ + raw?: boolean; + /** + * It decodes msgpack's int64/uint64 formats with int64-buffer object. + * int64-buffer is a cutom integer type with 64 bits of precision instead + * of the built-in IEEE-754 53 bits. See https://github.com/kawanet/int64-buffer + * @default false + */ + int64?: boolean; + /** + * It ties msgpack's bin format with ArrayBuffer object, instead of Buffer object. + * @default false + */ + binarraybuffer?: boolean; + /** + * It returns Uint8Array object when encoding, instead of Buffer object. + */ + uint8array?: boolean; } - export function encode(input: any, options?: BufferOptions): any; - export function decode(input: Buffer | Uint8Array | Array, options?: BufferOptions): any; - export function createEncodeStream (): EncodeStream; - export function createDecodeStream (): DecodeStream; - export function createCodec (options?: any): Codec; - export function codec (): { preset: Codec }; + interface EncoderOptions { + codec?: Codec + } + + interface DecoderOptions { + codec?: Codec + } } export = MsgpackLite; diff --git a/msgpack-lite/msgpack-lite-tests.ts b/msgpack-lite/msgpack-lite-tests.ts index f6d8725754..3608e6bfd9 100644 --- a/msgpack-lite/msgpack-lite-tests.ts +++ b/msgpack-lite/msgpack-lite-tests.ts @@ -1,5 +1,75 @@ +import * as msgpack from 'msgpack-lite'; -import * as msgpack from "msgpack-lite"; +// https://github.com/kawanet/msgpack-lite#encoding-and-decoding-messagepack +function encodingAndDecoding() { + // encode from JS Object to MessagePack (Buffer) + var buffer = msgpack.encode({"foo": "bar"}); -var encoded = msgpack.encode(""); -msgpack.decode(encoded); + // decode from MessagePack (Buffer) to JS Object + var data = msgpack.decode(buffer); // => {"foo": "bar"} +} + +// https://github.com/kawanet/msgpack-lite#writing-to-messagepack-stream +function writingToStream() { + var fs = require("fs"); + + var writeStream = fs.createWriteStream("test.msp"); + var encodeStream = msgpack.createEncodeStream(); + encodeStream.pipe(writeStream); + + // send multiple objects to stream + encodeStream.write({foo: "bar"}); + encodeStream.write({baz: "qux"}); + + // call this once you're done writing to the stream. + encodeStream.end(); +} + +// https://github.com/kawanet/msgpack-lite#reading-from-messagepack-stream +function readingFromStream() { + var fs = require("fs"); + var msgpack = require("msgpack-lite"); + + var readStream = fs.createReadStream("test.msp"); + var decodeStream = msgpack.createDecodeStream(); + + // show multiple objects decoded from stream + readStream.pipe(decodeStream).on("data", console.warn); +} + +// https://github.com/kawanet/msgpack-lite#decoding-messagepack-bytes-array +function decodingBytesArray() { + // decode() accepts Buffer instance per default + msgpack.decode(new Buffer([0x81, 0xA3, 0x66, 0x6F, 0x6F, 0xA3, 0x62, 0x61, 0x72])); + + // decode() also accepts Array instance + msgpack.decode([0x81, 0xA3, 0x66, 0x6F, 0x6F, 0xA3, 0x62, 0x61, 0x72]); + + // decode() accepts raw Uint8Array instance as well + msgpack.decode(new Uint8Array([0x81, 0xA3, 0x66, 0x6F, 0x6F, 0xA3, 0x62, 0x61, 0x72])); +} + +// https://github.com/kawanet/msgpack-lite#custom-extension-types-codecs +function customExtensionTypes() { + var codec = msgpack.createCodec(); + codec.addExtPacker(0x3F, MyVector, myVectorPacker); + codec.addExtUnpacker(0x3F, myVectorUnpacker); + + var data = new MyVector(1, 2); + var encoded = msgpack.encode(data, {codec: codec}); + var decoded = msgpack.decode(encoded, {codec: codec}); + + class MyVector { + constructor(public x: number, public y: number) {} + } + + function myVectorPacker(vector: MyVector) { + var array = [vector.x, vector.y]; + return msgpack.encode(array); // return Buffer serialized + } + + function myVectorUnpacker(buffer: Buffer | Uint8Array): MyVector { + var array = msgpack.decode(buffer); + return new MyVector(array[0], array[1]); // return Object deserialized + } +} diff --git a/msgpack-lite/tsconfig.json b/msgpack-lite/tsconfig.json index 39588c1eef..6070c69ece 100644 --- a/msgpack-lite/tsconfig.json +++ b/msgpack-lite/tsconfig.json @@ -4,7 +4,7 @@ "target": "es6", "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" From 0c28d885a4109aa79bff1267eeaf85297807e24d Mon Sep 17 00:00:00 2001 From: efokschaner Date: Sun, 1 Jan 2017 18:14:21 -0800 Subject: [PATCH 03/55] Add tslint.json to msgpack-lite --- msgpack-lite/index.d.ts | 8 ++++---- msgpack-lite/tslint.json | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 msgpack-lite/tslint.json diff --git a/msgpack-lite/index.d.ts b/msgpack-lite/index.d.ts index 53ed592afa..128be7fad1 100644 --- a/msgpack-lite/index.d.ts +++ b/msgpack-lite/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for msgpack-lite v0.1.26 +// Type definitions for msgpack-lite 0.1 // Project: https://github.com/kawanet/msgpack-lite // Definitions by: Endel Dreyer , Edmund Fokschaner // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -16,7 +16,7 @@ declare module 'msgpack-lite' { /** * decode from MessagePack to JS Object */ - function decode(input: Buffer | Uint8Array | Array, options?: DecoderOptions): any; + function decode(input: Buffer | Uint8Array | number[], options?: DecoderOptions): any; /** * create a stream that encodes from JS Object to MessagePack @@ -147,11 +147,11 @@ declare module 'msgpack-lite' { } interface EncoderOptions { - codec?: Codec + codec?: Codec; } interface DecoderOptions { - codec?: Codec + codec?: Codec; } } diff --git a/msgpack-lite/tslint.json b/msgpack-lite/tslint.json new file mode 100644 index 0000000000..2221e40e4a --- /dev/null +++ b/msgpack-lite/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } \ No newline at end of file From 261edf6ed5faf327a9f7977ee0c40a4277dd775c Mon Sep 17 00:00:00 2001 From: efokschaner Date: Sat, 7 Jan 2017 06:17:23 -0800 Subject: [PATCH 04/55] Fix no-single-declare-module lint error --- msgpack-lite/index.d.ts | 282 ++++++++++++++--------------- msgpack-lite/msgpack-lite-tests.ts | 1 - 2 files changed, 138 insertions(+), 145 deletions(-) diff --git a/msgpack-lite/index.d.ts b/msgpack-lite/index.d.ts index 128be7fad1..e451267dbc 100644 --- a/msgpack-lite/index.d.ts +++ b/msgpack-lite/index.d.ts @@ -4,156 +4,150 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -declare module 'msgpack-lite' { - import * as stream from 'stream'; +import * as stream from 'stream'; - namespace MsgpackLite { - /** - * encode from JS Object to MessagePack - */ - function encode(input: any, options?: EncoderOptions): Buffer; +/** + * encode from JS Object to MessagePack + */ +export function encode(input: any, options?: EncoderOptions): Buffer; - /** - * decode from MessagePack to JS Object - */ - function decode(input: Buffer | Uint8Array | number[], options?: DecoderOptions): any; +/** + * decode from MessagePack to JS Object + */ +export function decode(input: Buffer | Uint8Array | number[], options?: DecoderOptions): any; - /** - * create a stream that encodes from JS Object to MessagePack - */ - function createEncodeStream(options?: EncoderOptions & stream.TransformOptions ): EncodeStream; +/** + * create a stream that encodes from JS Object to MessagePack + */ +export function createEncodeStream(options?: EncoderOptions & stream.TransformOptions ): EncodeStream; - /** - * create a stream that decodes from MessagePack (Buffer) to JS Object - */ - function createDecodeStream(options?: DecoderOptions & stream.TransformOptions): DecodeStream; +/** + * create a stream that decodes from MessagePack (Buffer) to JS Object + */ +export function createDecodeStream(options?: DecoderOptions & stream.TransformOptions): DecodeStream; - /** - * Codecs allow for Custom Extension Types - * Register a custom extension type number to serialize/deserialize your own class instances. - * https://github.com/kawanet/msgpack-lite#custom-extension-types-codecs - * If you wish to modify the default built-in codec, you can access it at msgpack.codec.preset - */ - function createCodec(options?: CodecOptions): Codec; +/** + * Codecs allow for Custom Extension Types + * Register a custom extension type number to serialize/deserialize your own class instances. + * https://github.com/kawanet/msgpack-lite#custom-extension-types-codecs + * If you wish to modify the default built-in codec, you can access it at msgpack.codec.preset + */ +export function createCodec(options?: CodecOptions): Codec; - /** - * The default built-in codec - */ - var codec: { - /** - * The default built-in codec - */ - preset: Codec; - }; +/** + * The default built-in codec + */ +export var codec: { + /** + * The default built-in codec + */ + preset: Codec; +}; - interface Codec { - /** - * Register a custom extension to serialize your own class instances - * - * @param etype an integer within the range of 0 and 127 (0x0 and 0x7F) - * @param Class the constructor of the type you wish to serialize - * @param packer a function that converts an instance of T to bytes - */ - addExtPacker( - etype: number, - Class: new(...args: any[]) => T, - packer: (t: T) => Buffer | Uint8Array): void; +export interface Codec { + /** + * Register a custom extension to serialize your own class instances + * + * @param etype an integer within the range of 0 and 127 (0x0 and 0x7F) + * @param Class the constructor of the type you wish to serialize + * @param packer a function that converts an instance of T to bytes + */ + addExtPacker( + etype: number, + Class: new(...args: any[]) => T, + packer: (t: T) => Buffer | Uint8Array): void; - /** - * Register a custom extension to deserialize your own class instances - * - * @param etype an integer within the range of 0 and 127 (0x0 and 0x7F) - * @param unpacker a function that converts bytes to an instance of T - */ - addExtUnpacker(etype: number, unpacker: (data: Buffer | Uint8Array) => T): void; - } - - interface Encoder { - bufferish: any; - maxBufferSize: number; - minBufferSize: number; - offset: number; - start: number; - write: (chunk: any) => void; - fetch: () => void; - flush: () => void; - push: (chunk: any) => void; - pull: () => number; - read: () => number; - reserve: (length: number) => number; - send: (buffer: Buffer) => void; - encode: (chunk: any) => void; - end: (chunk: any) => void; - } - - interface Decoder { - bufferish: any; - offset: number; - fetch: () => void; - flush: () => void; - pull: () => number; - read: () => number; - write: (chunk: any) => void; - reserve: (length: number) => number; - decode: (chunk: any) => void; - push: (chunk: any) => void; - end: (chunk: any) => void; - } - - interface EncodeStream extends stream.Transform { - encoder: Encoder; - } - - interface DecodeStream extends stream.Transform { - decoder: Decoder; - } - - interface CodecOptions { - /** - * It includes the preset extensions for JavaScript native objects. - * @see https://github.com/kawanet/msgpack-lite#extension-types - * @default false - */ - preset?: boolean; - /** - * It runs a validation of the value before writing it into buffer. - * This is the default behavior for some old browsers which do not support ArrayBuffer object. - * @default varies - */ - safe?: boolean; - /** - * It uses raw formats instead of bin and str. - * Set true for compatibility with msgpack's old spec. - * @see https://github.com/kawanet/msgpack-lite#compatibility-mode - * @default false - */ - raw?: boolean; - /** - * It decodes msgpack's int64/uint64 formats with int64-buffer object. - * int64-buffer is a cutom integer type with 64 bits of precision instead - * of the built-in IEEE-754 53 bits. See https://github.com/kawanet/int64-buffer - * @default false - */ - int64?: boolean; - /** - * It ties msgpack's bin format with ArrayBuffer object, instead of Buffer object. - * @default false - */ - binarraybuffer?: boolean; - /** - * It returns Uint8Array object when encoding, instead of Buffer object. - */ - uint8array?: boolean; - } - - interface EncoderOptions { - codec?: Codec; - } - - interface DecoderOptions { - codec?: Codec; - } - } - - export = MsgpackLite; + /** + * Register a custom extension to deserialize your own class instances + * + * @param etype an integer within the range of 0 and 127 (0x0 and 0x7F) + * @param unpacker a function that converts bytes to an instance of T + */ + addExtUnpacker(etype: number, unpacker: (data: Buffer | Uint8Array) => T): void; } + +export interface Encoder { + bufferish: any; + maxBufferSize: number; + minBufferSize: number; + offset: number; + start: number; + write: (chunk: any) => void; + fetch: () => void; + flush: () => void; + push: (chunk: any) => void; + pull: () => number; + read: () => number; + reserve: (length: number) => number; + send: (buffer: Buffer) => void; + encode: (chunk: any) => void; + end: (chunk: any) => void; +} + +export interface Decoder { + bufferish: any; + offset: number; + fetch: () => void; + flush: () => void; + pull: () => number; + read: () => number; + write: (chunk: any) => void; + reserve: (length: number) => number; + decode: (chunk: any) => void; + push: (chunk: any) => void; + end: (chunk: any) => void; +} + +export interface EncodeStream extends stream.Transform { + encoder: Encoder; +} + +export interface DecodeStream extends stream.Transform { + decoder: Decoder; +} + +export interface CodecOptions { + /** + * It includes the preset extensions for JavaScript native objects. + * @see https://github.com/kawanet/msgpack-lite#extension-types + * @default false + */ + preset?: boolean; + /** + * It runs a validation of the value before writing it into buffer. + * This is the default behavior for some old browsers which do not support ArrayBuffer object. + * @default varies + */ + safe?: boolean; + /** + * It uses raw formats instead of bin and str. + * Set true for compatibility with msgpack's old spec. + * @see https://github.com/kawanet/msgpack-lite#compatibility-mode + * @default false + */ + raw?: boolean; + /** + * It decodes msgpack's int64/uint64 formats with int64-buffer object. + * int64-buffer is a cutom integer type with 64 bits of precision instead + * of the built-in IEEE-754 53 bits. See https://github.com/kawanet/int64-buffer + * @default false + */ + int64?: boolean; + /** + * It ties msgpack's bin format with ArrayBuffer object, instead of Buffer object. + * @default false + */ + binarraybuffer?: boolean; + /** + * It returns Uint8Array object when encoding, instead of Buffer object. + */ + uint8array?: boolean; +} + +export interface EncoderOptions { + codec?: Codec; +} + +export interface DecoderOptions { + codec?: Codec; +} \ No newline at end of file diff --git a/msgpack-lite/msgpack-lite-tests.ts b/msgpack-lite/msgpack-lite-tests.ts index 3608e6bfd9..033fde060c 100644 --- a/msgpack-lite/msgpack-lite-tests.ts +++ b/msgpack-lite/msgpack-lite-tests.ts @@ -28,7 +28,6 @@ function writingToStream() { // https://github.com/kawanet/msgpack-lite#reading-from-messagepack-stream function readingFromStream() { var fs = require("fs"); - var msgpack = require("msgpack-lite"); var readStream = fs.createReadStream("test.msp"); var decodeStream = msgpack.createDecodeStream(); From 3f8ae530b91b19d0875aa533d99ec0868a92af3e Mon Sep 17 00:00:00 2001 From: Jacob Baskin Date: Thu, 26 Jan 2017 14:24:01 -0500 Subject: [PATCH 05/55] Add typings for react-native-datepicker --- react-native-datepicker/index.d.ts | 33 +++++++++++++++ .../react-native-datepicker-tests.tsx | 42 +++++++++++++++++++ react-native-datepicker/tsconfig.json | 24 +++++++++++ react-native-datepicker/tslint.json | 1 + 4 files changed, 100 insertions(+) create mode 100644 react-native-datepicker/index.d.ts create mode 100644 react-native-datepicker/react-native-datepicker-tests.tsx create mode 100644 react-native-datepicker/tsconfig.json create mode 100644 react-native-datepicker/tslint.json diff --git a/react-native-datepicker/index.d.ts b/react-native-datepicker/index.d.ts new file mode 100644 index 0000000000..ef985ecdc5 --- /dev/null +++ b/react-native-datepicker/index.d.ts @@ -0,0 +1,33 @@ +// Type definitions for react-native-datepicker 1.4 +// Project: https://github.com/xgfe/react-native-datepicker +// Definitions by: Jacob Baskin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as React from 'react'; + +interface DatePickerProps { + mode?: 'date' | 'datetime' | 'time'; + date?: string | Date; + format?: string; + minDate?: string | Date; + maxDate?: string | Date; + height?: number; + duration?: number; + confirmBtnText?: string; + cancelBtnText?: string; + showIcon?: boolean; + disabled?: boolean; + onDateChange?: (dateStr: string, date: Date) => void; + placeholder?: string; + modalOnResponderTerminationRequest?: (e: any) => boolean; + is24Hour?: boolean; + style?: any; + customStyles?: any; + minuteInterval?: number; +} + +declare class DatePicker extends React.Component { + constructor(props: DatePickerProps); +} + +export default DatePicker; diff --git a/react-native-datepicker/react-native-datepicker-tests.tsx b/react-native-datepicker/react-native-datepicker-tests.tsx new file mode 100644 index 0000000000..eb423fd554 --- /dev/null +++ b/react-native-datepicker/react-native-datepicker-tests.tsx @@ -0,0 +1,42 @@ +import * as React from 'react'; +import DatePicker from 'react-native-datepicker'; + +interface MyDatePickerState { + date: string; +} + +export default class MyDatePicker extends React.Component<{}, MyDatePickerState> { + constructor(props: {}) { + super(props); + this.state = {date: "2016-05-15"}; + } + + render() { + return ( + {this.setState({date});}} + /> + ); + } +} + diff --git a/react-native-datepicker/tsconfig.json b/react-native-datepicker/tsconfig.json new file mode 100644 index 0000000000..ffbef033e1 --- /dev/null +++ b/react-native-datepicker/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-native-datepicker-tests.tsx" + ] +} diff --git a/react-native-datepicker/tslint.json b/react-native-datepicker/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/react-native-datepicker/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From 8f4b8ffc92f6e0e8f457bedac824796b0ff954fa Mon Sep 17 00:00:00 2001 From: Jacob Baskin Date: Fri, 27 Jan 2017 14:51:52 -0500 Subject: [PATCH 06/55] Use TS 2.1 only for react-native-datepicker typings. --- react-native-datepicker/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/react-native-datepicker/index.d.ts b/react-native-datepicker/index.d.ts index ef985ecdc5..232f2f56d1 100644 --- a/react-native-datepicker/index.d.ts +++ b/react-native-datepicker/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/xgfe/react-native-datepicker // Definitions by: Jacob Baskin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from 'react'; From 6ab0599be2ea516a3821c58cea01cdb81d204927 Mon Sep 17 00:00:00 2001 From: Rich Buggy Date: Sun, 29 Jan 2017 12:49:30 +1100 Subject: [PATCH 07/55] Added Lambda Proxy and API Gateway Event definitions --- aws-lambda/aws-lambda-tests.ts | 47 +++++++++++++++++++++++++++++++++ aws-lambda/index.d.ts | 48 +++++++++++++++++++++++++++++++++- 2 files changed, 94 insertions(+), 1 deletion(-) diff --git a/aws-lambda/aws-lambda-tests.ts b/aws-lambda/aws-lambda-tests.ts index 0d8d9bd47f..fb09beda8a 100644 --- a/aws-lambda/aws-lambda-tests.ts +++ b/aws-lambda/aws-lambda-tests.ts @@ -6,11 +6,48 @@ var anyObj: any = { abc: 123 }; var num: number = 5; var error: Error = new Error(); var b: boolean = true; +var apiGwEvt: AWSLambda.APIGatewayEvent; var clientCtx: AWSLambda.ClientContext; var clientContextEnv: AWSLambda.ClientContextEnv; var clientContextClient: AWSLambda.ClientContextClient; var context: AWSLambda.Context; var identity: AWSLambda.CognitoIdentity; +var proxyResult: AWSLambda.ProxyResult; + +/* API Gateway Event */ +str = apiGwEvt.body; +str = apiGwEvt.headers["example"]; +str = apiGwEvt.httpMethod; +b = apiGwEvt.isBase64Encoded; +str = apiGwEvt.path; +str = apiGwEvt.pathParameters["example"]; +str = apiGwEvt.queryStringParameters["example"]; +str = apiGwEvt.stageVariables["example"]; +str = apiGwEvt.requestContext.accountId; +str = apiGwEvt.requestContext.apiId; +str = apiGwEvt.requestContext.httpMethod; +str = apiGwEvt.requestContext.identity.accessKey; +str = apiGwEvt.requestContext.identity.accountId; +str = apiGwEvt.requestContext.identity.apiKey; +str = apiGwEvt.requestContext.identity.caller; +str = apiGwEvt.requestContext.identity.cognitoAuthenticationProvider; +str = apiGwEvt.requestContext.identity.cognitoAuthenticationType; +str = apiGwEvt.requestContext.identity.cognitoIdentityId; +str = apiGwEvt.requestContext.identity.cognitoIdentityPoolId; +str = apiGwEvt.requestContext.identity.sourceIp; +str = apiGwEvt.requestContext.identity.user; +str = apiGwEvt.requestContext.identity.userAgent; +str = apiGwEvt.requestContext.identity.userArn; +str = apiGwEvt.requestContext.stage; +str = apiGwEvt.requestContext.requestId; +str = apiGwEvt.requestContext.resourceId; +str = apiGwEvt.requestContext.resourcePath; +str = apiGwEvt.resource; + +/* Lambda Proxy Result */ +num = proxyResult.statusCode; +str = proxyResult.headers["example"]; +str = proxyResult.body /* Context */ b = context.callbackWaitsForEmptyEventLoop; @@ -54,6 +91,15 @@ function callback(cb: AWSLambda.Callback) { cb(error); cb(null, anyObj); } + +/* Proxy Callback */ +function proxyCallback(cb: AWSLambda.ProxyCallback) { + cb(); + cb(null); + cb(error); + cb(null, proxyResult); +} + /* Compatibility functions */ context.done(); context.done(error); @@ -66,3 +112,4 @@ context.fail(str); /* Handler */ let handler: AWSLambda.Handler = (event: any, context: AWSLambda.Context, cb: AWSLambda.Callback) => {}; +let proxyHandler: AWSLambda.ProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.ProxyCallback) => {}; diff --git a/aws-lambda/index.d.ts b/aws-lambda/index.d.ts index 1aa41b9e62..e8b70db7bd 100644 --- a/aws-lambda/index.d.ts +++ b/aws-lambda/index.d.ts @@ -1,8 +1,44 @@ // Type definitions for AWS Lambda // Project: http://docs.aws.amazon.com/lambda -// Definitions by: James Darbyshire , Michael Skarum , Stef Heyenrath , Toby Hede +// Definitions by: James Darbyshire , Michael Skarum , Stef Heyenrath , Toby Hede , Rich Buggy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// API Gateway "event" +interface APIGatewayEvent { + body: string | null; + headers: { [name: string]: string }; + httpMethod: string; + isBase64Encoded: boolean; + path: string; + pathParameters: { [name: string]: string } | null; + queryStringParameters: { [name: string]: string } | null; + stageVariables: { [name: string]: string } | null; + requestContext: { + accountId: string; + apiId: string; + httpMethod: string; + identity: { + accessKey: string | null; + accountId: string | null; + apiKey: string | null; + caller: string | null; + cognitoAuthenticationProvider: string | null; + cognitoAuthenticationType: string | null; + cognitoIdentityId: string | null; + cognitoIdentityPoolId: string | null; + sourceIp: string; + user: string | null; + userAgent: string | null; + userArn: string | null; + }, + stage: string; + requestId: string; + resourceId: string; + resourcePath: string; + }; + resource: string; +} + // Context // http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html interface Context { @@ -58,6 +94,14 @@ interface ClientContextEnv { locale: string; } +interface ProxyResult { + statusCode: number; + headers?: { + [header: string]: string; + }, + body: string; +} + /** * AWS Lambda handler function. * http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html @@ -67,6 +111,7 @@ interface ClientContextEnv { * @param callback – optional callback to return information to the caller, otherwise return value is null. */ export type Handler = (event: any, context: Context, callback?: Callback) => void; +export type ProxyHandler = (event: APIGatewayEvent, context: Context, callback?: ProxyCallback) => void; /** * Optional callback parameter. @@ -76,5 +121,6 @@ export type Handler = (event: any, context: Context, callback?: Callback) => vo * @param result – an optional parameter that you can use to provide the result of a successful function execution. The result provided must be JSON.stringify compatible. */ export type Callback = (error?: Error, result?: any) => void; +export type ProxyCallback = (error?: Error, result?: ProxyResult) => void; export as namespace AWSLambda; From dc2a51cbd5555de2c6a89a7356a9d79550c2b2bb Mon Sep 17 00:00:00 2001 From: 421p Date: Tue, 31 Jan 2017 10:53:01 +0200 Subject: [PATCH 08/55] update wampy.d.ts to work with in-browser typescript --- wampy/wampy.d.ts | 198 +++++++++++++++++++++++------------------------ 1 file changed, 99 insertions(+), 99 deletions(-) diff --git a/wampy/wampy.d.ts b/wampy/wampy.d.ts index e068b97a25..261c521aff 100644 --- a/wampy/wampy.d.ts +++ b/wampy/wampy.d.ts @@ -3,103 +3,103 @@ // Definitions by: Konstantin Burkalev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare module "wampy" { - - interface WampyOptions { - autoReconnect?: boolean; - reconnectInterval?: number; - maxRetries?: number; - transportEncoding?: string; - realm?: string; - helloCustomDetails?: any; - onChallenge?: (auth_method: string, challenge_details: string) => string; - authid?: string; - onConnect?: () => void; - onClose?: () => void; - onError?: () => void; - onReconnect?: () => void; - onReconnectSuccess?: () => void; - ws?: any; - msgpackCoder?: any; - } - - interface WampyOpStatus { - code: number; - description: string; - reqId?: number; - } - - interface SuccessErrorCallbacksHash { - onSuccess?: (data: any) => void; - onError?: (err: string) => void; - } - - interface SubscribeCallbacksHash extends SuccessErrorCallbacksHash { - onEvent: (data: any) => void; - } - - interface RegisterCallbacksHash extends SuccessErrorCallbacksHash { - rpc: (data: any, options: any) => any[]; - } - - interface CallSuccessErrorCallbacksHash { - onSuccess: (data: any) => any; - onError?: (err: string) => void; - } - - interface AdvancedOptions { - exclude?: number | number[]; - eligible?: number | number[]; - exclude_me?: boolean; - disclose_me?: boolean; - } - - interface PublishAdvancedOptions extends AdvancedOptions { - exclude_authid?: string | string[]; - exclude_authrole?: string | string[]; - eligible_authid?: string | string[]; - eligible_authrole?: string | string[]; - } - - interface CallAdvancedOptions { - disclose_me?: boolean; - receive_progress?: boolean; - timeout?: number; - } - - interface CancelAdvancedOptions { - mode?: "skip" | "kill" | "killnowait"; - } - - interface Wampy { - options(opts?: WampyOptions): WampyOptions | Wampy; - getOpStatus(): WampyOpStatus; - getSessionId(): number; - connect(url?: string): Wampy; - disconnect(): Wampy; - abort(): Wampy; - subscribe(topicURI: string, callbacks: (((data: any) => void) | SubscribeCallbacksHash)): Wampy; - unsubscribe(topicURI: string, callbacks?: (((data: any) => void) | SubscribeCallbacksHash)): Wampy; - publish(topicURI: string, - payload?: any, - callbacks?: SuccessErrorCallbacksHash, - advancedOptions?: PublishAdvancedOptions): Wampy; - call(topicURI: string, - payload?: any, - callbacks?: (((data: any) => void) | CallSuccessErrorCallbacksHash), - advancedOptions?: CallAdvancedOptions): Wampy; - cancel(reqId: number, - callbacks?: ((() => void) | SuccessErrorCallbacksHash), - advancedOptions?: CancelAdvancedOptions): Wampy; - register(topicURI: string, callbacks: (((data: any, options: any) => any[]) | RegisterCallbacksHash)): Wampy; - unregister(topicURI: string, callbacks?: ((() => void) | SuccessErrorCallbacksHash)): Wampy; - } - - interface WampyInstance { - new(url?: string, options?: WampyOptions): Wampy; - } - - var wampy: WampyInstance; - - export default wampy; +interface WampyOptions { + autoReconnect?: boolean; + reconnectInterval?: number; + maxRetries?: number; + transportEncoding?: string; + realm?: string; + helloCustomDetails?: any; + onChallenge?: (auth_method: string, challenge_details: string) => string; + authid?: string; + onConnect?: () => void; + onClose?: () => void; + onError?: () => void; + onReconnect?: () => void; + onReconnectSuccess?: () => void; + ws?: any; + msgpackCoder?: any; } + +interface WampyOpStatus { + code: number; + description: string; + reqId?: number; +} + +interface SuccessErrorCallbacksHash { + onSuccess?: (data: any) => void; + onError?: (err: string) => void; +} + +interface SubscribeCallbacksHash extends SuccessErrorCallbacksHash { + onEvent: (data: any) => void; +} + +interface RegisterCallbacksHash extends SuccessErrorCallbacksHash { + rpc: (data: any, options: any) => any[]; +} + +interface CallSuccessErrorCallbacksHash { + onSuccess: (data: any) => any; + onError?: (err: string) => void; +} + +interface AdvancedOptions { + exclude?: number | number[]; + eligible?: number | number[]; + exclude_me?: boolean; + disclose_me?: boolean; +} + +interface PublishAdvancedOptions extends AdvancedOptions { + exclude_authid?: string | string[]; + exclude_authrole?: string | string[]; + eligible_authid?: string | string[]; + eligible_authrole?: string | string[]; +} + +interface CallAdvancedOptions { + disclose_me?: boolean; + receive_progress?: boolean; + timeout?: number; +} + +interface CancelAdvancedOptions { + mode?: "skip" | "kill" | "killnowait"; +} + +interface Wampy { + new (url?: string, options?: WampyOptions): Wampy; + options(opts?: WampyOptions): WampyOptions | Wampy; + getOpStatus(): WampyOpStatus; + getSessionId(): number; + connect(url?: string): Wampy; + disconnect(): Wampy; + abort(): Wampy; + subscribe(topicURI: string, callbacks: (((data: any) => void) | SubscribeCallbacksHash)): Wampy; + unsubscribe(topicURI: string, callbacks?: (((data: any) => void) | SubscribeCallbacksHash)): Wampy; + publish(topicURI: string, + payload?: any, + callbacks?: SuccessErrorCallbacksHash, + advancedOptions?: PublishAdvancedOptions): Wampy; + call(topicURI: string, + payload?: any, + callbacks?: (((data: any) => void) | CallSuccessErrorCallbacksHash), + advancedOptions?: CallAdvancedOptions): Wampy; + cancel(reqId: number, + callbacks?: ((() => void) | SuccessErrorCallbacksHash), + advancedOptions?: CancelAdvancedOptions): Wampy; + register(topicURI: string, callbacks: (((data: any, options: any) => any[]) | RegisterCallbacksHash)): Wampy; + unregister(topicURI: string, callbacks?: ((() => void) | SuccessErrorCallbacksHash)): Wampy; +} + + +declare var wampy: Wampy; + +declare module 'wampy' +{ + export = wampy +} + + From 8f873ba3566630dad1b62d080d93145de2dc5784 Mon Sep 17 00:00:00 2001 From: Rohit Kumar Date: Tue, 31 Jan 2017 18:01:53 +0530 Subject: [PATCH 09/55] Add FusionCharts definition for Charts, Widgets, Maps, PowerCharts and themes - Also fixed the linting issue. --- fusioncharts/fusioncharts-tests.ts | 2 ++ fusioncharts/fusioncharts.charts.d.ts | 7 +++++++ fusioncharts/fusioncharts.gantt.d.ts | 7 +++++++ fusioncharts/fusioncharts.maps.d.ts | 7 +++++++ fusioncharts/fusioncharts.powercharts.d.ts | 7 +++++++ fusioncharts/fusioncharts.ssgrid.d.ts | 7 +++++++ fusioncharts/fusioncharts.treemap.d.ts | 7 +++++++ fusioncharts/fusioncharts.widgets.d.ts | 7 +++++++ fusioncharts/fusioncharts.zoomscatter.d.ts | 7 +++++++ fusioncharts/index.d.ts | 14 +++++++------- fusioncharts/maps/fusioncharts.usa.d.ts | 7 +++++++ fusioncharts/maps/fusioncharts.world.d.ts | 7 +++++++ fusioncharts/themes/fusioncharts.theme.carbon.d.ts | 7 +++++++ fusioncharts/themes/fusioncharts.theme.fint.d.ts | 7 +++++++ fusioncharts/themes/fusioncharts.theme.ocean.d.ts | 7 +++++++ fusioncharts/themes/fusioncharts.theme.zune.d.ts | 7 +++++++ fusioncharts/tsconfig.json | 14 ++++++++++++++ fusioncharts/tslint.json | 1 + 18 files changed, 122 insertions(+), 7 deletions(-) create mode 100644 fusioncharts/fusioncharts.charts.d.ts create mode 100644 fusioncharts/fusioncharts.gantt.d.ts create mode 100644 fusioncharts/fusioncharts.maps.d.ts create mode 100644 fusioncharts/fusioncharts.powercharts.d.ts create mode 100644 fusioncharts/fusioncharts.ssgrid.d.ts create mode 100644 fusioncharts/fusioncharts.treemap.d.ts create mode 100644 fusioncharts/fusioncharts.widgets.d.ts create mode 100644 fusioncharts/fusioncharts.zoomscatter.d.ts create mode 100644 fusioncharts/maps/fusioncharts.usa.d.ts create mode 100644 fusioncharts/maps/fusioncharts.world.d.ts create mode 100644 fusioncharts/themes/fusioncharts.theme.carbon.d.ts create mode 100644 fusioncharts/themes/fusioncharts.theme.fint.d.ts create mode 100644 fusioncharts/themes/fusioncharts.theme.ocean.d.ts create mode 100644 fusioncharts/themes/fusioncharts.theme.zune.d.ts create mode 100644 fusioncharts/tslint.json diff --git a/fusioncharts/fusioncharts-tests.ts b/fusioncharts/fusioncharts-tests.ts index 9bbf640225..77b912ba18 100644 --- a/fusioncharts/fusioncharts-tests.ts +++ b/fusioncharts/fusioncharts-tests.ts @@ -1,3 +1,5 @@ +import * as FusionCharts from "fusioncharts"; + FusionCharts.addEventListener('ready',(eventObject)=>{ eventObject.stopPropagation(); }); diff --git a/fusioncharts/fusioncharts.charts.d.ts b/fusioncharts/fusioncharts.charts.d.ts new file mode 100644 index 0000000000..214f9d79c2 --- /dev/null +++ b/fusioncharts/fusioncharts.charts.d.ts @@ -0,0 +1,7 @@ +interface FusionCharts { + type: string; +} + +declare var charts: (H: FusionCharts) => FusionCharts; +export = charts; +export as namespace charts; diff --git a/fusioncharts/fusioncharts.gantt.d.ts b/fusioncharts/fusioncharts.gantt.d.ts new file mode 100644 index 0000000000..7af79ff354 --- /dev/null +++ b/fusioncharts/fusioncharts.gantt.d.ts @@ -0,0 +1,7 @@ +interface FusionCharts { + type: string; +} + +declare var gantt: (H: FusionCharts) => FusionCharts; +export = gantt; +export as namespace gantt; diff --git a/fusioncharts/fusioncharts.maps.d.ts b/fusioncharts/fusioncharts.maps.d.ts new file mode 100644 index 0000000000..8610b8405f --- /dev/null +++ b/fusioncharts/fusioncharts.maps.d.ts @@ -0,0 +1,7 @@ +interface FusionCharts { + type: string; +} + +declare var maps: (H: FusionCharts) => FusionCharts; +export = maps; +export as namespace maps; diff --git a/fusioncharts/fusioncharts.powercharts.d.ts b/fusioncharts/fusioncharts.powercharts.d.ts new file mode 100644 index 0000000000..432cc4ce24 --- /dev/null +++ b/fusioncharts/fusioncharts.powercharts.d.ts @@ -0,0 +1,7 @@ +interface FusionCharts { + type: string; +} + +declare var powercharts: (H: FusionCharts) => FusionCharts; +export = powercharts; +export as namespace powercharts; diff --git a/fusioncharts/fusioncharts.ssgrid.d.ts b/fusioncharts/fusioncharts.ssgrid.d.ts new file mode 100644 index 0000000000..f74376410d --- /dev/null +++ b/fusioncharts/fusioncharts.ssgrid.d.ts @@ -0,0 +1,7 @@ +interface FusionCharts { + type: string; +} + +declare var ssgrid: (H: FusionCharts) => FusionCharts; +export = ssgrid; +export as namespace ssgrid; diff --git a/fusioncharts/fusioncharts.treemap.d.ts b/fusioncharts/fusioncharts.treemap.d.ts new file mode 100644 index 0000000000..f8f80059ed --- /dev/null +++ b/fusioncharts/fusioncharts.treemap.d.ts @@ -0,0 +1,7 @@ +interface FusionCharts { + type: string; +} + +declare var treemap: (H: FusionCharts) => FusionCharts; +export = treemap; +export as namespace treemap; diff --git a/fusioncharts/fusioncharts.widgets.d.ts b/fusioncharts/fusioncharts.widgets.d.ts new file mode 100644 index 0000000000..052216721d --- /dev/null +++ b/fusioncharts/fusioncharts.widgets.d.ts @@ -0,0 +1,7 @@ +interface FusionCharts { + type: string; +} + +declare var widgets: (H: FusionCharts) => FusionCharts; +export = widgets; +export as namespace widgets; diff --git a/fusioncharts/fusioncharts.zoomscatter.d.ts b/fusioncharts/fusioncharts.zoomscatter.d.ts new file mode 100644 index 0000000000..07e58585bb --- /dev/null +++ b/fusioncharts/fusioncharts.zoomscatter.d.ts @@ -0,0 +1,7 @@ +interface FusionCharts { + type: string; +} + +declare var zoomscatter: (H: FusionCharts) => FusionCharts; +export = zoomscatter; +export as namespace zoomscatter; diff --git a/fusioncharts/index.d.ts b/fusioncharts/index.d.ts index dc053859b9..9c46955075 100644 --- a/fusioncharts/index.d.ts +++ b/fusioncharts/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for FusionCharts 3.11.2 +// Type definitions for fusioncharts 3.11 // Project: http://www.fusioncharts.com -// Definitions by: Shivaraj KV +// Definitions by: Rohit Kumar , Shivaraj KV // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -136,9 +136,9 @@ declare namespace FusionCharts { outputTo(callback: (message: any) => any): void; - enable(state:any,outputTo?:(message: any) =>any,outputFormat?:any):void + enable(state: any, outputTo?: (message: any) => any, outputFormat?: any): void; - enableFirebugLite():any; + enableFirebugLite(): any; } interface FusionCharts { @@ -154,7 +154,7 @@ declare namespace FusionCharts { configureLink(param: {} | any[], level?: number): void; - setChartAttribute(attributes: ChartObject | String, value?: string): void; + setChartAttribute(attributes: ChartObject | string, value?: string): void; getChartAttribute(attribute?: string | string[]): ChartObject; @@ -273,7 +273,7 @@ declare namespace FusionCharts { formatNumber(num: number, type?: string, config?: {}): Element; - setCurrentRenderer(name: string): void + setCurrentRenderer(name: string): void; getCurrentRenderer(): string; @@ -285,7 +285,7 @@ declare namespace FusionCharts { options: {}; - debugger:Debugger; + debugger: Debugger; } diff --git a/fusioncharts/maps/fusioncharts.usa.d.ts b/fusioncharts/maps/fusioncharts.usa.d.ts new file mode 100644 index 0000000000..159ad8ab80 --- /dev/null +++ b/fusioncharts/maps/fusioncharts.usa.d.ts @@ -0,0 +1,7 @@ +interface FusionCharts { + type: string; +} + +declare var usa: (H: FusionCharts) => FusionCharts; +export = usa; +export as namespace usa; diff --git a/fusioncharts/maps/fusioncharts.world.d.ts b/fusioncharts/maps/fusioncharts.world.d.ts new file mode 100644 index 0000000000..889afc5a7d --- /dev/null +++ b/fusioncharts/maps/fusioncharts.world.d.ts @@ -0,0 +1,7 @@ +interface FusionCharts { + type: string; +} + +declare var world: (H: FusionCharts) => FusionCharts; +export = world; +export as namespace world; diff --git a/fusioncharts/themes/fusioncharts.theme.carbon.d.ts b/fusioncharts/themes/fusioncharts.theme.carbon.d.ts new file mode 100644 index 0000000000..0be2ca7334 --- /dev/null +++ b/fusioncharts/themes/fusioncharts.theme.carbon.d.ts @@ -0,0 +1,7 @@ +interface FusionCharts { + type: string; +} + +declare var carbon: (H: FusionCharts) => FusionCharts; +export = carbon; +export as namespace carbon; diff --git a/fusioncharts/themes/fusioncharts.theme.fint.d.ts b/fusioncharts/themes/fusioncharts.theme.fint.d.ts new file mode 100644 index 0000000000..8c76253ee6 --- /dev/null +++ b/fusioncharts/themes/fusioncharts.theme.fint.d.ts @@ -0,0 +1,7 @@ +interface FusionCharts { + type: string; +} + +declare var fint: (H: FusionCharts) => FusionCharts; +export = fint; +export as namespace fint; diff --git a/fusioncharts/themes/fusioncharts.theme.ocean.d.ts b/fusioncharts/themes/fusioncharts.theme.ocean.d.ts new file mode 100644 index 0000000000..f0dd57aa03 --- /dev/null +++ b/fusioncharts/themes/fusioncharts.theme.ocean.d.ts @@ -0,0 +1,7 @@ +interface FusionCharts { + type: string; +} + +declare var ocean: (H: FusionCharts) => FusionCharts; +export = ocean; +export as namespace ocean; diff --git a/fusioncharts/themes/fusioncharts.theme.zune.d.ts b/fusioncharts/themes/fusioncharts.theme.zune.d.ts new file mode 100644 index 0000000000..23c04014c7 --- /dev/null +++ b/fusioncharts/themes/fusioncharts.theme.zune.d.ts @@ -0,0 +1,7 @@ +interface FusionCharts { + type: string; +} + +declare var zune: (H: FusionCharts) => FusionCharts; +export = zune; +export as namespace zune; diff --git a/fusioncharts/tsconfig.json b/fusioncharts/tsconfig.json index dc4436d64c..970238d9a8 100644 --- a/fusioncharts/tsconfig.json +++ b/fusioncharts/tsconfig.json @@ -18,6 +18,20 @@ }, "files": [ "index.d.ts", + "fusioncharts.charts.d.ts", + "fusioncharts.powercharts.d.ts", + "fusioncharts.widgets.d.ts", + "fusioncharts.maps.d.ts", + "fusioncharts.zoomscatter.d.ts", + "fusioncharts.ssgrid.d.ts", + "fusioncharts.gantt.d.ts", + "fusioncharts.treemap.d.ts", + "maps/fusioncharts.usa.d.ts", + "maps/fusioncharts.world.d.ts", + "themes/fusioncharts.theme.carbon.d.ts", + "themes/fusioncharts.theme.fint.d.ts", + "themes/fusioncharts.theme.ocean.d.ts", + "themes/fusioncharts.theme.zune.d.ts", "fusioncharts-tests.ts" ] } \ No newline at end of file diff --git a/fusioncharts/tslint.json b/fusioncharts/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/fusioncharts/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From c1d3c066bf68a9b0fe357800e424df5ece7e4eee Mon Sep 17 00:00:00 2001 From: Drew Noakes Date: Tue, 31 Jan 2017 22:46:21 +0000 Subject: [PATCH 10/55] Consistent delimiters. --- react-modal/index.d.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/react-modal/index.d.ts b/react-modal/index.d.ts index e5db7d66f0..80958ae918 100644 --- a/react-modal/index.d.ts +++ b/react-modal/index.d.ts @@ -12,20 +12,20 @@ declare module "react-modal" { style?: { content?: { [key: string]: any; - }, + }; overlay?: { [key: string]: any; - } - }, - appElement?: HTMLElement | {}, - onAfterOpen?: Function, - onRequestClose?: Function, - closeTimeoutMS?: number, - ariaHideApp?: boolean, - shouldCloseOnOverlayClick?: boolean, - overlayClassName?: string, - className?: string - contentLabel?: string + }; + }; + appElement?: HTMLElement | {}; + onAfterOpen?: Function; + onRequestClose?: Function; + closeTimeoutMS?: number; + ariaHideApp?: boolean; + shouldCloseOnOverlayClick?: boolean; + overlayClassName?: string; + className?: string; + contentLabel?: string; } let ReactModal: React.ClassicComponentClass; export = ReactModal; From d998af2ff33295d7bc63644086646ba1300f2ad7 Mon Sep 17 00:00:00 2001 From: Drew Noakes Date: Tue, 31 Jan 2017 22:47:04 +0000 Subject: [PATCH 11/55] Specify function type. --- react-modal/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/react-modal/index.d.ts b/react-modal/index.d.ts index 80958ae918..13e4a94a0c 100644 --- a/react-modal/index.d.ts +++ b/react-modal/index.d.ts @@ -18,8 +18,8 @@ declare module "react-modal" { }; }; appElement?: HTMLElement | {}; - onAfterOpen?: Function; - onRequestClose?: Function; + onAfterOpen?: () => void; + onRequestClose?: () => void; closeTimeoutMS?: number; ariaHideApp?: boolean; shouldCloseOnOverlayClick?: boolean; From e20443bdf764432446cdae94347359dab22e1ace Mon Sep 17 00:00:00 2001 From: Drew Noakes Date: Tue, 31 Jan 2017 22:49:32 +0000 Subject: [PATCH 12/55] Add documentation. --- react-modal/index.d.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/react-modal/index.d.ts b/react-modal/index.d.ts index 13e4a94a0c..1a3826004a 100644 --- a/react-modal/index.d.ts +++ b/react-modal/index.d.ts @@ -8,7 +8,9 @@ declare module "react-modal" { interface ReactModal { + /* Boolean describing if the modal should be shown or not. Defaults to false. */ isOpen: boolean; + /* Object indicating styles to be used for the modal, divided into overlay and content styles. */ style?: { content?: { [key: string]: any; @@ -17,14 +19,23 @@ declare module "react-modal" { [key: string]: any; }; }; + /* Set this to properly hide your application from assistive screenreaders and other assistive technologies while the modal is open. */ appElement?: HTMLElement | {}; + /* Function that will be run after the modal has opened. */ onAfterOpen?: () => void; + /* Function that will be run when the modal is requested to be closed, prior to actually closing. */ onRequestClose?: () => void; + /* Number indicating the milliseconds to wait before closing the modal. Defaults to zero (no timeout). */ closeTimeoutMS?: number; + /* Boolean indicating if the appElement should be hidden. Defaults to true. */ ariaHideApp?: boolean; + /* Boolean indicating if the overlay should close the modal. Defaults to true. */ shouldCloseOnOverlayClick?: boolean; + /* String className to be applied to the overlay. */ overlayClassName?: string; + /* String className to be applied to the modal content. */ className?: string; + /* String indicating how the content container should be announced to screenreaders. */ contentLabel?: string; } let ReactModal: React.ClassicComponentClass; From ae31538dc212e9a37c3463c091b37f328d9935ab Mon Sep 17 00:00:00 2001 From: Drew Noakes Date: Tue, 31 Jan 2017 22:51:06 +0000 Subject: [PATCH 13/55] Add static members. --- react-modal/index.d.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/react-modal/index.d.ts b/react-modal/index.d.ts index 1a3826004a..7dc83f7d79 100644 --- a/react-modal/index.d.ts +++ b/react-modal/index.d.ts @@ -7,10 +7,7 @@ /// declare module "react-modal" { - interface ReactModal { - /* Boolean describing if the modal should be shown or not. Defaults to false. */ - isOpen: boolean; - /* Object indicating styles to be used for the modal, divided into overlay and content styles. */ + interface Styles { style?: { content?: { [key: string]: any; @@ -19,6 +16,12 @@ declare module "react-modal" { [key: string]: any; }; }; + } + interface ReactModal { + /* Boolean describing if the modal should be shown or not. Defaults to false. */ + isOpen: boolean; + /* Object indicating styles to be used for the modal, divided into overlay and content styles. */ + style?: Styles; /* Set this to properly hide your application from assistive screenreaders and other assistive technologies while the modal is open. */ appElement?: HTMLElement | {}; /* Function that will be run after the modal has opened. */ @@ -38,6 +41,11 @@ declare module "react-modal" { /* String indicating how the content container should be announced to screenreaders. */ contentLabel?: string; } - let ReactModal: React.ClassicComponentClass; + let ReactModal: React.ClassicComponentClass & { + /* Override styles for all modals. */ + defaultStyles: Styles; + /* Call this to properly hide your application from assistive screenreaders and other assistive technologies while the modal is open. */ + setAppElement(appElement: HTMLElement): void; + }; export = ReactModal; } From c6e9076a946fb67ce462ffea6c4e9bd1bc16eadb Mon Sep 17 00:00:00 2001 From: Drew Noakes Date: Tue, 31 Jan 2017 22:52:13 +0000 Subject: [PATCH 14/55] Add missing members. --- react-modal/index.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/react-modal/index.d.ts b/react-modal/index.d.ts index 7dc83f7d79..1d24ebc85b 100644 --- a/react-modal/index.d.ts +++ b/react-modal/index.d.ts @@ -34,12 +34,18 @@ declare module "react-modal" { ariaHideApp?: boolean; /* Boolean indicating if the overlay should close the modal. Defaults to true. */ shouldCloseOnOverlayClick?: boolean; + /* String className to be applied to the portal. Defaults to "ReactModalPortal". */ + portalClassName?: string; /* String className to be applied to the overlay. */ overlayClassName?: string; /* String className to be applied to the modal content. */ className?: string; /* String indicating how the content container should be announced to screenreaders. */ contentLabel?: string; + /* String indicating the role of the modal, allowing the 'dialog' role to be applied if desired. */ + role?: string; + /* Function that will be called to get the parent element that the modal will be attached to. */ + parentSelector?: () => HTMLElement; } let ReactModal: React.ClassicComponentClass & { /* Override styles for all modals. */ From e4bf1668726965be0860a89ede5667ace3240e1b Mon Sep 17 00:00:00 2001 From: Drew Noakes Date: Tue, 31 Jan 2017 22:52:28 +0000 Subject: [PATCH 15/55] Bump react-modal version to 1.6.5. --- react-modal/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/react-modal/index.d.ts b/react-modal/index.d.ts index 1d24ebc85b..115e36730b 100644 --- a/react-modal/index.d.ts +++ b/react-modal/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for react-modal v1.6.1 +// Type definitions for react-modal v1.6.5 // Project: https://github.com/reactjs/react-modal // Definitions by: Rajab Shakirov +// Definitions by: Drew Noakes // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 From 05478eb92a04b36ea25246d0806b4ff2fd04b415 Mon Sep 17 00:00:00 2001 From: Jakub Pistek Date: Tue, 31 Jan 2017 19:51:29 +0100 Subject: [PATCH 16/55] Update ngStorage to latest version --- ngstorage/index.d.ts | 34 ++++++++---------- ngstorage/ngstorage-tests.ts | 68 ++++++++++++++++++------------------ ngstorage/tsconfig.json | 2 +- 3 files changed, 50 insertions(+), 54 deletions(-) diff --git a/ngstorage/index.d.ts b/ngstorage/index.d.ts index b8fcf023c8..15fb3c0481 100644 --- a/ngstorage/index.d.ts +++ b/ngstorage/index.d.ts @@ -1,29 +1,25 @@ -// Type definitions for ngstorage 0.3.10 +// Type definitions for ngstorage 0.3.11 // Project: https://github.com/gsklee/ngStorage // Definitions by: Jakub Pistek // Definitions: https://github.com/kubiq/DefinitelyTyped -import * as angular from 'angular'; +declare module 'ngstorage' { -declare module 'angular' { - export namespace storage { + interface IStorageService { + $default(items: {}): IStorageService; + $reset(items?: {}): IStorageService; + $apply(): void; + $sync(): void; + get(key: string): T; + } - export interface IStorageService { - $default(items: {}): IStorageService; - $reset(items?: {}): IStorageService; - $apply(): void; - $sync(): void; - get(key: string): T; - } + interface IStorageProvider extends angular.IServiceProvider { - export interface IStorageProvider extends angular.IServiceProvider { + get(key: string): T; + set(key: string, value: T): T; - get(key: string): T; - set(key: string, value: T): T; - - setKeyPrefix(prefix: string): void; - setSerializer(serializer: (value: any) => string): void; - setDeserializer(deserializer: (value: string) => any): void; - } + setKeyPrefix(prefix: string): void; + setSerializer(serializer: (value: any) => string): void; + setDeserializer(deserializer: (value: string) => any): void; } } diff --git a/ngstorage/ngstorage-tests.ts b/ngstorage/ngstorage-tests.ts index 924d017a66..abddf19bb7 100644 --- a/ngstorage/ngstorage-tests.ts +++ b/ngstorage/ngstorage-tests.ts @@ -1,9 +1,9 @@ -/// +/// +import {IStorageService, IStorageProvider} from "ngstorage"; var app: any; - -app.controller('LocalCtrl', function ($localStorage: angular.storage.IStorageService) { +app.controller('LocalCtrl', function ($localStorage: IStorageService) { $localStorage.$default({ counter: 1 @@ -12,15 +12,15 @@ app.controller('LocalCtrl', function ($localStorage: angular.storage.IStorageSer $localStorage.$reset({ counter: 1 }); - + $localStorage.$reset(); $localStorage.$apply(); - + $localStorage.$sync(); }); -app.controller('SessionCtrl', function ($sessionStorage: angular.storage.IStorageService) { +app.controller('SessionCtrl', function ($sessionStorage: IStorageService) { $sessionStorage.$default({ counter: 1 @@ -29,50 +29,50 @@ app.controller('SessionCtrl', function ($sessionStorage: angular.storage.IStorag $sessionStorage.$reset({ counter: 1 }); - + $sessionStorage.$reset(); $sessionStorage.$apply(); - + $sessionStorage.$sync(); }); -app.config(['$localStorageProvider', function ($localStorageProvider: angular.storage.IStorageProvider) { +app.config(['$localStorageProvider', function ($localStorageProvider: IStorageProvider) { - $localStorageProvider.setKeyPrefix('NewPrefix'); + $localStorageProvider.setKeyPrefix('NewPrefix'); - $localStorageProvider.get('MyKey'); + $localStorageProvider.get('MyKey'); - $localStorageProvider.set('MyKey', { counter: 'value' }); + $localStorageProvider.set('MyKey', {counter: 'value'}); - var mySerializer = function (value:any):string { - return value.toString(); - }; + var mySerializer = function (value: any): string { + return value.toString(); + }; - var myDeserializer = function (value:string):any { - return value; - }; + var myDeserializer = function (value: string): any { + return value; + }; - $localStorageProvider.setSerializer(mySerializer); - $localStorageProvider.setDeserializer(myDeserializer); - } -]).config(['$sessionStorageProvider', function ($sessionStorageProvider: angular.storage.IStorageProvider) { + $localStorageProvider.setSerializer(mySerializer); + $localStorageProvider.setDeserializer(myDeserializer); +} +]).config(['$sessionStorageProvider', function ($sessionStorageProvider: IStorageProvider) { - $sessionStorageProvider.setKeyPrefix('NewPrefix'); + $sessionStorageProvider.setKeyPrefix('NewPrefix'); - $sessionStorageProvider.get('MyKey'); + $sessionStorageProvider.get('MyKey'); - $sessionStorageProvider.set('MyKey', { counter: 'value' }); + $sessionStorageProvider.set('MyKey', {counter: 'value'}); - var mySerializer = function (value:any):string { - return value.toString(); - }; + var mySerializer = function (value: any): string { + return value.toString(); + }; - var myDeserializer = function (value:string):any { - return value; - }; + var myDeserializer = function (value: string): any { + return value; + }; - $sessionStorageProvider.setSerializer(mySerializer); - $sessionStorageProvider.setDeserializer(myDeserializer); - } + $sessionStorageProvider.setSerializer(mySerializer); + $sessionStorageProvider.setDeserializer(myDeserializer); +} ]); diff --git a/ngstorage/tsconfig.json b/ngstorage/tsconfig.json index 691875db20..a3cdb4a204 100644 --- a/ngstorage/tsconfig.json +++ b/ngstorage/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "ngstorage-tests.ts" ] -} \ No newline at end of file +} From 877d3861dedbeee12e8d9d4a0dbbdc286dccab84 Mon Sep 17 00:00:00 2001 From: Calvin Jeong Date: Wed, 1 Feb 2017 14:44:58 +1300 Subject: [PATCH 17/55] Updated three/index.d.ts Added extra properties for `Spherical` class. --- three/index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/three/index.d.ts b/three/index.d.ts index 36263993c7..b4b4995ee8 100644 --- a/three/index.d.ts +++ b/three/index.d.ts @@ -3586,6 +3586,10 @@ declare namespace THREE { export class Spherical { constructor(radius?: number, phi?: number, theta?: number); + radius: number; + phi: number; + theta: number; + set(radius: number, phi: number, theta: number): Spherical; clone(): this; copy(other: this): this; From 72698b1b117efb129f80964393ed39ed69009ac2 Mon Sep 17 00:00:00 2001 From: Ryan Gomoto Date: Tue, 31 Jan 2017 19:04:52 -0800 Subject: [PATCH 18/55] Fix bintrees callback signature --- bintrees/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bintrees/index.d.ts b/bintrees/index.d.ts index 9853be67dc..7a7b2c233e 100644 --- a/bintrees/index.d.ts +++ b/bintrees/index.d.ts @@ -5,7 +5,7 @@ declare module 'bintrees' { - type Callback = (err: Error, item: T) => void; + type Callback = (item: T) => void; type Comparator = (a: T, b: T) => number; class Iterator { From b1a2640f60981fa575b6b8339ce385003117404d Mon Sep 17 00:00:00 2001 From: bglee Date: Wed, 1 Feb 2017 13:44:48 +0900 Subject: [PATCH 19/55] add 4 props accessibility?: boolean nextArrow?: HTMLElement | any prevArrow?: HTMLElement | any pauseOnHover?: boolean --- react-slick/index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/react-slick/index.d.ts b/react-slick/index.d.ts index 9bd267cad1..0f8c770ee2 100644 --- a/react-slick/index.d.ts +++ b/react-slick/index.d.ts @@ -6,6 +6,10 @@ /// interface __config { + accessibility?: boolean + nextArrow?: HTMLElement | any + prevArrow?: HTMLElement | any + pauseOnHover?: boolean className?: string adaptiveHeight?: boolean arrows?: boolean From 96996eebbdd326f6925e6da9360e4566e80e882a Mon Sep 17 00:00:00 2001 From: bglee Date: Wed, 1 Feb 2017 13:44:48 +0900 Subject: [PATCH 20/55] add 4 props accessibility?: boolean nextArrow?: HTMLElement | any prevArrow?: HTMLElement | any pauseOnHover?: boolean --- react-slick/index.d.ts | 4 ++++ react-slick/react-slick-tests.tsx | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/react-slick/index.d.ts b/react-slick/index.d.ts index 9bd267cad1..0f8c770ee2 100644 --- a/react-slick/index.d.ts +++ b/react-slick/index.d.ts @@ -6,6 +6,10 @@ /// interface __config { + accessibility?: boolean + nextArrow?: HTMLElement | any + prevArrow?: HTMLElement | any + pauseOnHover?: boolean className?: string adaptiveHeight?: boolean arrows?: boolean diff --git a/react-slick/react-slick-tests.tsx b/react-slick/react-slick-tests.tsx index 7b51dbdf3a..2d26b0dcf1 100644 --- a/react-slick/react-slick-tests.tsx +++ b/react-slick/react-slick-tests.tsx @@ -10,7 +10,8 @@ class SliderTest extends React.Component, {}> { slidesToShow: 8, slidesToScroll: 1, draggable: false, - infinite: false + infinite: false, + prevArrow: link }; return ( From 863829da136054d403b1d5383d46828f4e729f52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=84=9D=EB=9E=98?= Date: Wed, 1 Feb 2017 17:23:44 +0900 Subject: [PATCH 21/55] add Request.buffer() --- chai-http/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/chai-http/index.d.ts b/chai-http/index.d.ts index 567f13e4e7..2e619b6166 100644 --- a/chai-http/index.d.ts +++ b/chai-http/index.d.ts @@ -55,6 +55,7 @@ declare namespace ChaiHttp { send(data: Object): Request; auth(user: string, name: string): Request; field(name: string, val: string): Request; + buffer(): Request; end(callback?: (err: any, res: Response) => void): FinishedRequest; } From ff38bd198b87ba02101af481d5eac8aba3da4bed Mon Sep 17 00:00:00 2001 From: Drew Noakes Date: Wed, 1 Feb 2017 21:39:47 +0000 Subject: [PATCH 22/55] Fix tslint errors 'dt-header' - Expected: foo MAJOR.MINOR (patch version not allowed) - Expected: foo MAJOR.MINOR ('v' not allowed) --- react-modal/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-modal/index.d.ts b/react-modal/index.d.ts index 115e36730b..20c8d08f27 100644 --- a/react-modal/index.d.ts +++ b/react-modal/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-modal v1.6.5 +// Type definitions for react-modal 1.6 // Project: https://github.com/reactjs/react-modal // Definitions by: Rajab Shakirov // Definitions by: Drew Noakes From fb1f121c408488d14764ad99041267c9d35e876f Mon Sep 17 00:00:00 2001 From: Drew Noakes Date: Wed, 1 Feb 2017 21:40:18 +0000 Subject: [PATCH 23/55] Fix tslint errors 'dt-header' Expected: one of /(, )|(,?\r?\n\/\/\s\s+)/ /\r?\n\/\/ Definitions by: / --- react-modal/index.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/react-modal/index.d.ts b/react-modal/index.d.ts index 20c8d08f27..30db228f59 100644 --- a/react-modal/index.d.ts +++ b/react-modal/index.d.ts @@ -1,7 +1,6 @@ // Type definitions for react-modal 1.6 // Project: https://github.com/reactjs/react-modal -// Definitions by: Rajab Shakirov -// Definitions by: Drew Noakes +// Definitions by: Rajab Shakirov , Drew Noakes // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 From 34c28a11da363a27d5de601b666c2feca176aa9a Mon Sep 17 00:00:00 2001 From: Drew Noakes Date: Wed, 1 Feb 2017 21:41:16 +0000 Subject: [PATCH 24/55] Fix tslint error 'no-single-declare-module ' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit File has only 1 module declaration — write it as an external module. --- react-modal/index.d.ts | 93 +++++++++++++++++++++--------------------- 1 file changed, 47 insertions(+), 46 deletions(-) diff --git a/react-modal/index.d.ts b/react-modal/index.d.ts index 30db228f59..68e6f1e2bc 100644 --- a/react-modal/index.d.ts +++ b/react-modal/index.d.ts @@ -6,52 +6,53 @@ /// -declare module "react-modal" { - interface Styles { - style?: { - content?: { - [key: string]: any; - }; - overlay?: { - [key: string]: any; - }; +interface Styles { + style?: { + content?: { + [key: string]: any; + }; + overlay?: { + [key: string]: any; }; - } - interface ReactModal { - /* Boolean describing if the modal should be shown or not. Defaults to false. */ - isOpen: boolean; - /* Object indicating styles to be used for the modal, divided into overlay and content styles. */ - style?: Styles; - /* Set this to properly hide your application from assistive screenreaders and other assistive technologies while the modal is open. */ - appElement?: HTMLElement | {}; - /* Function that will be run after the modal has opened. */ - onAfterOpen?: () => void; - /* Function that will be run when the modal is requested to be closed, prior to actually closing. */ - onRequestClose?: () => void; - /* Number indicating the milliseconds to wait before closing the modal. Defaults to zero (no timeout). */ - closeTimeoutMS?: number; - /* Boolean indicating if the appElement should be hidden. Defaults to true. */ - ariaHideApp?: boolean; - /* Boolean indicating if the overlay should close the modal. Defaults to true. */ - shouldCloseOnOverlayClick?: boolean; - /* String className to be applied to the portal. Defaults to "ReactModalPortal". */ - portalClassName?: string; - /* String className to be applied to the overlay. */ - overlayClassName?: string; - /* String className to be applied to the modal content. */ - className?: string; - /* String indicating how the content container should be announced to screenreaders. */ - contentLabel?: string; - /* String indicating the role of the modal, allowing the 'dialog' role to be applied if desired. */ - role?: string; - /* Function that will be called to get the parent element that the modal will be attached to. */ - parentSelector?: () => HTMLElement; - } - let ReactModal: React.ClassicComponentClass & { - /* Override styles for all modals. */ - defaultStyles: Styles; - /* Call this to properly hide your application from assistive screenreaders and other assistive technologies while the modal is open. */ - setAppElement(appElement: HTMLElement): void; }; - export = ReactModal; } + +interface ReactModal { + /* Boolean describing if the modal should be shown or not. Defaults to false. */ + isOpen: boolean; + /* Object indicating styles to be used for the modal, divided into overlay and content styles. */ + style?: Styles; + /* Set this to properly hide your application from assistive screenreaders and other assistive technologies while the modal is open. */ + appElement?: HTMLElement | {}; + /* Function that will be run after the modal has opened. */ + onAfterOpen?: () => void; + /* Function that will be run when the modal is requested to be closed, prior to actually closing. */ + onRequestClose?: () => void; + /* Number indicating the milliseconds to wait before closing the modal. Defaults to zero (no timeout). */ + closeTimeoutMS?: number; + /* Boolean indicating if the appElement should be hidden. Defaults to true. */ + ariaHideApp?: boolean; + /* Boolean indicating if the overlay should close the modal. Defaults to true. */ + shouldCloseOnOverlayClick?: boolean; + /* String className to be applied to the portal. Defaults to "ReactModalPortal". */ + portalClassName?: string; + /* String className to be applied to the overlay. */ + overlayClassName?: string; + /* String className to be applied to the modal content. */ + className?: string; + /* String indicating how the content container should be announced to screenreaders. */ + contentLabel?: string; + /* String indicating the role of the modal, allowing the 'dialog' role to be applied if desired. */ + role?: string; + /* Function that will be called to get the parent element that the modal will be attached to. */ + parentSelector?: () => HTMLElement; +} + +declare const ReactModal: React.ClassicComponentClass & { + /* Override styles for all modals. */ + defaultStyles: Styles; + /* Call this to properly hide your application from assistive screenreaders and other assistive technologies while the modal is open. */ + setAppElement(appElement: HTMLElement): void; +}; + +export = ReactModal; From 6c1d88d6a9f3d81c993c17333bb04926051442be Mon Sep 17 00:00:00 2001 From: Drew Noakes Date: Wed, 1 Feb 2017 21:42:48 +0000 Subject: [PATCH 25/55] Use 'import' over ' +import * as React from "react"; interface Styles { style?: { From c834c31b814c751322150cb272167e2ac504f946 Mon Sep 17 00:00:00 2001 From: Drew Noakes Date: Wed, 1 Feb 2017 21:41:29 +0000 Subject: [PATCH 26/55] Add tslint file. --- react-modal/tslint.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 react-modal/tslint.json diff --git a/react-modal/tslint.json b/react-modal/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/react-modal/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From 70520cc92389c48b24ee7d51ea3a5362712a5eec Mon Sep 17 00:00:00 2001 From: Drew Noakes Date: Wed, 1 Feb 2017 22:03:12 +0000 Subject: [PATCH 27/55] Declare as class and namespace. --- react-modal/index.d.ts | 100 +++++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 48 deletions(-) diff --git a/react-modal/index.d.ts b/react-modal/index.d.ts index c26442aa76..4e038b416c 100644 --- a/react-modal/index.d.ts +++ b/react-modal/index.d.ts @@ -6,53 +6,57 @@ import * as React from "react"; -interface Styles { - style?: { - content?: { - [key: string]: any; - }; - overlay?: { - [key: string]: any; - }; - }; -} - -interface ReactModal { - /* Boolean describing if the modal should be shown or not. Defaults to false. */ - isOpen: boolean; - /* Object indicating styles to be used for the modal, divided into overlay and content styles. */ - style?: Styles; - /* Set this to properly hide your application from assistive screenreaders and other assistive technologies while the modal is open. */ - appElement?: HTMLElement | {}; - /* Function that will be run after the modal has opened. */ - onAfterOpen?: () => void; - /* Function that will be run when the modal is requested to be closed, prior to actually closing. */ - onRequestClose?: () => void; - /* Number indicating the milliseconds to wait before closing the modal. Defaults to zero (no timeout). */ - closeTimeoutMS?: number; - /* Boolean indicating if the appElement should be hidden. Defaults to true. */ - ariaHideApp?: boolean; - /* Boolean indicating if the overlay should close the modal. Defaults to true. */ - shouldCloseOnOverlayClick?: boolean; - /* String className to be applied to the portal. Defaults to "ReactModalPortal". */ - portalClassName?: string; - /* String className to be applied to the overlay. */ - overlayClassName?: string; - /* String className to be applied to the modal content. */ - className?: string; - /* String indicating how the content container should be announced to screenreaders. */ - contentLabel?: string; - /* String indicating the role of the modal, allowing the 'dialog' role to be applied if desired. */ - role?: string; - /* Function that will be called to get the parent element that the modal will be attached to. */ - parentSelector?: () => HTMLElement; -} - -declare const ReactModal: React.ClassicComponentClass & { - /* Override styles for all modals. */ - defaultStyles: Styles; - /* Call this to properly hide your application from assistive screenreaders and other assistive technologies while the modal is open. */ - setAppElement(appElement: HTMLElement): void; -}; +export as namespace ReactModal; export = ReactModal; + +declare namespace ReactModal { + export interface Styles { + style?: { + content?: { + [key: string]: any; + }; + overlay?: { + [key: string]: any; + }; + }; + } + + export interface Props { + /* Boolean describing if the modal should be shown or not. Defaults to false. */ + isOpen: boolean; + /* Object indicating styles to be used for the modal, divided into overlay and content styles. */ + style?: Styles; + /* Set this to properly hide your application from assistive screenreaders and other assistive technologies while the modal is open. */ + appElement?: HTMLElement | {}; + /* Function that will be run after the modal has opened. */ + onAfterOpen?: () => void; + /* Function that will be run when the modal is requested to be closed, prior to actually closing. */ + onRequestClose?: () => void; + /* Number indicating the milliseconds to wait before closing the modal. Defaults to zero (no timeout). */ + closeTimeoutMS?: number; + /* Boolean indicating if the appElement should be hidden. Defaults to true. */ + ariaHideApp?: boolean; + /* Boolean indicating if the overlay should close the modal. Defaults to true. */ + shouldCloseOnOverlayClick?: boolean; + /* String className to be applied to the portal. Defaults to "ReactModalPortal". */ + portalClassName?: string; + /* String className to be applied to the overlay. */ + overlayClassName?: string; + /* String className to be applied to the modal content. */ + className?: string; + /* String indicating how the content container should be announced to screenreaders. */ + contentLabel?: string; + /* String indicating the role of the modal, allowing the 'dialog' role to be applied if desired. */ + role?: string; + /* Function that will be called to get the parent element that the modal will be attached to. */ + parentSelector?: () => HTMLElement; + } +} + +declare class ReactModal extends React.Component { + /* Override base styles for all instances of this component. */ + static defaultStyles: ReactModal.Styles; + /* Call this to properly hide your application from assistive screenreaders and other assistive technologies while the modal is open. */ + static setAppElement(appElement: HTMLElement): void; +} From a047ca1d6dbbb05f286ec8b8a533ee84ed293a00 Mon Sep 17 00:00:00 2001 From: Conrad Chan Date: Wed, 1 Feb 2017 19:50:03 -0800 Subject: [PATCH 28/55] add onInputKeyDown to react-select --- react-select/index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/react-select/index.d.ts b/react-select/index.d.ts index e59322d0dc..a7c0f2f17a 100644 --- a/react-select/index.d.ts +++ b/react-select/index.d.ts @@ -246,6 +246,10 @@ declare namespace ReactSelectClass { * onInputChange handler: function (inputValue) {} */ onInputChange?: (inputValue: string) => void; + /** + * onInputKeyDown handler: function (keyboardEvent) {} + */ + onInputKeyDown?: (event: KeyboardEvent) => void; /** * fires when the menu is scrolled to the bottom; can be used to paginate options */ From d095c67aa93626f02bf72bd5b8a2886870496fdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20SIMOND?= Date: Thu, 2 Feb 2017 13:40:29 +0100 Subject: [PATCH 29/55] Add missing property 'noData' to HighChartsNGConfig HighChartsNGConfig is missing noData property implemented since highcharts-ng#0.0.6 : https://github.com/pablojim/highcharts-ng#version-006 --- highcharts-ng/highcharts-ng-tests.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/highcharts-ng/highcharts-ng-tests.ts b/highcharts-ng/highcharts-ng-tests.ts index 0bf559061b..6f79d6e79a 100644 --- a/highcharts-ng/highcharts-ng-tests.ts +++ b/highcharts-ng/highcharts-ng-tests.ts @@ -33,7 +33,8 @@ class AppController { title: { text: 'My Awesome Chart' }, - loading: true + loading: true, + noData: 'No data here' }; constructor($timeout: ng.ITimeoutService) { var vm = this; From 0d9808c65180cd9ce6b12194064f9cc3fd03f66f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20SIMOND?= Date: Thu, 2 Feb 2017 13:46:24 +0100 Subject: [PATCH 30/55] Add missing property 'noData' to HighChartsNGConfig --- highcharts-ng/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/highcharts-ng/index.d.ts b/highcharts-ng/index.d.ts index 123799e76c..639d21d88e 100644 --- a/highcharts-ng/index.d.ts +++ b/highcharts-ng/index.d.ts @@ -35,6 +35,8 @@ declare global { }; //function (optional) - setup some logic for the chart func?: (chart: ChartObject) => void; + //no data text (optional) to show if all series are empty + noData?: string; } //Instantiated Chart From c1be6557513d67857fa4de171944b2ff84f837d1 Mon Sep 17 00:00:00 2001 From: Ant Kennedy Date: Thu, 2 Feb 2017 16:41:23 +0000 Subject: [PATCH 31/55] bugfix: WebResponseHeadersDetails missing method WebResponseHeadersDetails interface missing the method field defined in the documentation. https://developer.chrome.com/extensions/webRequest#event-onHeadersReceived --- chrome/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/chrome/index.d.ts b/chrome/index.d.ts index 2822dd421e..cd6922f5fb 100644 --- a/chrome/index.d.ts +++ b/chrome/index.d.ts @@ -7267,6 +7267,7 @@ declare namespace chrome.webRequest { interface WebResponseHeadersDetails extends WebResponseDetails { /** Optional. The HTTP response headers that have been received with this response. */ responseHeaders?: HttpHeader[]; + method: string; /** standard HTTP method i.e. GET, POST, PUT, etc. */ } interface WebResponseCacheDetails extends WebResponseHeadersDetails { From 06c9f9019023f3348de341b36af823e69ba1e58a Mon Sep 17 00:00:00 2001 From: Jeff Kenney Date: Thu, 26 Jan 2017 16:16:33 -0800 Subject: [PATCH 32/55] yargs: standardize tests as 4 spaces --- yargs/yargs-tests.ts | 720 +++++++++++++++++++++---------------------- 1 file changed, 360 insertions(+), 360 deletions(-) diff --git a/yargs/yargs-tests.ts b/yargs/yargs-tests.ts index f44e38b545..ae5871f2a3 100644 --- a/yargs/yargs-tests.ts +++ b/yargs/yargs-tests.ts @@ -12,539 +12,539 @@ const stringVal = 'string'; // With yargs, the options be just a hash! function xup() { - var argv = yargs.argv; + var argv = yargs.argv; - if (argv.rif - 5 * argv.xup > 7.138) { - console.log('Plunder more riffiwobbles!'); - } - else { - console.log('Drop the xupptumblers!'); - } + if (argv.rif - 5 * argv.xup > 7.138) { + console.log('Plunder more riffiwobbles!'); + } + else { + console.log('Drop the xupptumblers!'); + } } // And non-hyphenated options too! Just use argv._! function nonopt() { - var argv = yargs.argv; - console.log('(%d,%d)', argv.x, argv.y); - console.log(argv._); + var argv = yargs.argv; + console.log('(%d,%d)', argv.x, argv.y); + console.log(argv._); } // Yargs even counts your booleans! function count() { - var argv = yargs - .count('verbose') - .alias('v', 'verbose') - .argv; + var argv = yargs + .count('verbose') + .alias('v', 'verbose') + .argv; - var VERBOSE_LEVEL: number = argv.verbose; + var VERBOSE_LEVEL: number = argv.verbose; - function WARN() { VERBOSE_LEVEL >= 0 && console.log.apply(console, arguments); } - function INFO() { VERBOSE_LEVEL >= 1 && console.log.apply(console, arguments); } - function DEBUG() { VERBOSE_LEVEL >= 2 && console.log.apply(console, arguments); } + function WARN() { VERBOSE_LEVEL >= 0 && console.log.apply(console, arguments); } + function INFO() { VERBOSE_LEVEL >= 1 && console.log.apply(console, arguments); } + function DEBUG() { VERBOSE_LEVEL >= 2 && console.log.apply(console, arguments); } } // Tell users how to use yer options and make demands. function divide() { - var argv = yargs - .usage('Usage: $0 -x [num] -y [num]') - .demand(['x', 'y']) - .argv; + var argv = yargs + .usage('Usage: $0 -x [num] -y [num]') + .demand(['x', 'y']) + .argv; - console.log(argv.x / argv.y); + console.log(argv.x / argv.y); } // After yer demands have been met, demand more! Ask for non-hypenated arguments! function demand_count() { - var argv = yargs - .demand(2) - .demand(2, false) - .demand(2, 2) - .demand(2, 2, "message") - .argv; - console.dir(argv); + var argv = yargs + .demand(2) + .demand(2, false) + .demand(2, 2) + .demand(2, 2, "message") + .argv; + console.dir(argv); } // EVEN MORE SHIVER ME TIMBERS! function default_singles() { - var argv = yargs - .default('x', 10) - .default('y', 10) - .argv - ; - console.log(argv.x + argv.y); + var argv = yargs + .default('x', 10) + .default('y', 10) + .argv + ; + console.log(argv.x + argv.y); } function default_hash() { - var argv = yargs - .default({ x: 10, y: 10 }) - .argv - ; - console.log(argv.x + argv.y); + var argv = yargs + .default({ x: 10, y: 10 }) + .argv + ; + console.log(argv.x + argv.y); } // And if you really want to get all descriptive about it... function boolean_single() { - var argv = yargs - .boolean('v') - .argv - ; - console.dir(argv.v); - console.dir(argv._); + var argv = yargs + .boolean('v') + .argv + ; + console.dir(argv.v); + console.dir(argv._); } function boolean_double() { - var argv = yargs - .boolean(['x', 'y', 'z']) - .argv - ; - console.dir([argv.x, argv.y, argv.z]); - console.dir(argv._); + var argv = yargs + .boolean(['x', 'y', 'z']) + .argv + ; + console.dir([argv.x, argv.y, argv.z]); + console.dir(argv._); } // Yargs is here to help you... function line_count() { - var argv = yargs - .usage('Count the lines in a file.\nUsage: $0') - .example('$0 -f', 'count the lines in the given file') - .demand('f') - .alias('f', 'file') - .describe('f', 'Load a file') - .argv - ; + var argv = yargs + .usage('Count the lines in a file.\nUsage: $0') + .example('$0 -f', 'count the lines in the given file') + .demand('f') + .alias('f', 'file') + .describe('f', 'Load a file') + .argv + ; } // Below are tests for individual methods. // Not all methods are covered yet, and neither are all possible invocations of methods. function Argv_parsing() { - var argv1 = yargs.argv; - var argv2 = yargs(['-x', '1', '-y', '2']).argv; - var argv3 = yargs.parse(['-x', '1', '-y', '2']); - console.log(argv1.x, argv2.x, argv3.x); + var argv1 = yargs.argv; + var argv2 = yargs(['-x', '1', '-y', '2']).argv; + var argv3 = yargs.parse(['-x', '1', '-y', '2']); + console.log(argv1.x, argv2.x, argv3.x); } function Argv$options() { - var argv1 = yargs - .options('f', { - alias: 'file', - default: '/etc/passwd', - defaultDescription: 'The /etc/passwd file', - group: 'files', - normalize: true, - global: false, - array: true, - nargs: 3 - }) - .argv - ; + var argv1 = yargs + .options('f', { + alias: 'file', + default: '/etc/passwd', + defaultDescription: 'The /etc/passwd file', + group: 'files', + normalize: true, + global: false, + array: true, + nargs: 3 + }) + .argv + ; - var argv2 = yargs - .alias('f', 'file') - .default('f', '/etc/passwd') - .argv - ; + var argv2 = yargs + .alias('f', 'file') + .default('f', '/etc/passwd') + .argv + ; } function Argv$global() { - var argv = yargs - .global('foo') - .global(['bar', 'baz', 'fizz', 'buzz']) + var argv = yargs + .global('foo') + .global(['bar', 'baz', 'fizz', 'buzz']) } function Argv$group() { - var argv = yargs - .group('foo', 'foogroup') - .group(['bing', 'bang', 'buzz'], 'onomatopoeia') + var argv = yargs + .group('foo', 'foogroup') + .group(['bing', 'bang', 'buzz'], 'onomatopoeia') } function Argv$env() { - var argv = yargs - .env('YARGS_PREFIX_') - .env() - .env(true); + var argv = yargs + .env('YARGS_PREFIX_') + .env() + .env(true); } function Argv$array() { - var argv = yargs - .array('foo') - .array(['bar', 'baz']) + var argv = yargs + .array('foo') + .array(['bar', 'baz']) } function Argv$nargs() { - var argv = yargs - .nargs('foo', 12) - .nargs({ 'bing': 3, 'bang': 2, 'buzz': 4 }) + var argv = yargs + .nargs('foo', 12) + .nargs({ 'bing': 3, 'bang': 2, 'buzz': 4 }) } function Argv$choices() { - // example from documentation - var argv = yargs - .alias('i', 'ingredient') - .describe('i', 'choose your sandwich ingredients') - .choices('i', ['peanut-butter', 'jelly', 'banana', 'pickles']) - .help('help') - .argv + // example from documentation + var argv = yargs + .alias('i', 'ingredient') + .describe('i', 'choose your sandwich ingredients') + .choices('i', ['peanut-butter', 'jelly', 'banana', 'pickles']) + .help('help') + .argv } function command() { - var argv = yargs - .usage('npm ') - .command('install', 'tis a mighty fine package to install') - .command('publish', 'shiver me timbers, should you be sharing all that', yargs => - yargs.option('f', { - alias: 'force', - description: 'yar, it usually be a bad idea' - }) - .help('help') - ) - .command("build", "arghh, build it mate", { - tag: { - default: true, - demand: true, - description: "Tag the build, mate!" - }, - publish: { - default: false, - description:"Should i publish?" - } - }) - .command({ - command: "test", - describe: "test package", - builder: { - mateys: { - demand: false - } - }, - handler: (args: any) => { - /* handle me mateys! */ - } - }) - .command("test", "test mateys", { - handler: (args: any) => { - /* handle me mateys! */ - } - }) - .help('help') - .argv; + var argv = yargs + .usage('npm ') + .command('install', 'tis a mighty fine package to install') + .command('publish', 'shiver me timbers, should you be sharing all that', yargs => + yargs.option('f', { + alias: 'force', + description: 'yar, it usually be a bad idea' + }) + .help('help') + ) + .command("build", "arghh, build it mate", { + tag: { + default: true, + demand: true, + description: "Tag the build, mate!" + }, + publish: { + default: false, + description:"Should i publish?" + } + }) + .command({ + command: "test", + describe: "test package", + builder: { + mateys: { + demand: false + } + }, + handler: (args: any) => { + /* handle me mateys! */ + } + }) + .command("test", "test mateys", { + handler: (args: any) => { + /* handle me mateys! */ + } + }) + .help('help') + .argv; - yargs - .command('get', 'make a get HTTP request', function (yargs) { - return yargs.option('url', { - alias: 'u', - default: 'http://yargs.js.org/' - }) - }) - .help() - .argv + yargs + .command('get', 'make a get HTTP request', function (yargs) { + return yargs.option('url', { + alias: 'u', + default: 'http://yargs.js.org/' + }) + }) + .help() + .argv - yargs - .command( - 'get', - 'make a get HTTP request', - function (yargs) { - return yargs.option('u', { - alias: 'url', - describe: 'the URL to make an HTTP request to' - }) - }, - function (argv: { url: string }) { - console.dir(argv.url) - } - ) - .help() - .argv + yargs + .command( + 'get', + 'make a get HTTP request', + function (yargs) { + return yargs.option('u', { + alias: 'url', + describe: 'the URL to make an HTTP request to' + }) + }, + function (argv: { url: string }) { + console.dir(argv.url) + } + ) + .help() + .argv } function completion_sync() { - var argv = yargs - .completion('completion', (current, argv) => { - // 'current' is the current command being completed. - // 'argv' is the parsed arguments so far. - // simply return an array of completions. - return [ - 'foo', - 'bar' - ]; - }) - .argv; + var argv = yargs + .completion('completion', (current, argv) => { + // 'current' is the current command being completed. + // 'argv' is the parsed arguments so far. + // simply return an array of completions. + return [ + 'foo', + 'bar' + ]; + }) + .argv; } function completion_async() { - var argv = yargs - .completion('completion', (current: string, argv: any, done: (completion: string[]) => void) => { - setTimeout(function () { - done([ - 'apple', - 'banana' - ]); - }, 500); - }) - .argv; + var argv = yargs + .completion('completion', (current: string, argv: any, done: (completion: string[]) => void) => { + setTimeout(function () { + done([ + 'apple', + 'banana' + ]); + }, 500); + }) + .argv; } function Argv$help() { - var argv = yargs - .usage("$0 -operand1 number -operand2 number -operation [add|subtract]") - .help() - .argv; + var argv = yargs + .usage("$0 -operand1 number -operand2 number -operation [add|subtract]") + .help() + .argv; } function Argv$showHelpOnFail() { - var argv = yargs - .usage('Count the lines in a file.\nUsage: $0') - .demand('f') - .alias('f', 'file') - .describe('f', 'Load a file') - .showHelpOnFail(false, "Specify --help for available options") - .argv; + var argv = yargs + .usage('Count the lines in a file.\nUsage: $0') + .demand('f') + .alias('f', 'file') + .describe('f', 'Load a file') + .showHelpOnFail(false, "Specify --help for available options") + .argv; } function Argv$showHelp() { - var yargs1 = yargs - .usage("$0 -operand1 number -operand2 number -operation [add|subtract]"); - yargs1.showHelp(); + var yargs1 = yargs + .usage("$0 -operand1 number -operand2 number -operation [add|subtract]"); + yargs1.showHelp(); } function Argv$version() { - var argv1 = yargs - .version(); + var argv1 = yargs + .version(); - var argv2 = yargs - .version('1.0.0'); + var argv2 = yargs + .version('1.0.0'); - var argv3 = yargs - .version('1.0.0', '--version'); + var argv3 = yargs + .version('1.0.0', '--version'); - var argv4 = yargs - .version('1.0.0', '--version', 'description'); + var argv4 = yargs + .version('1.0.0', '--version', 'description'); - var argv5 = yargs - .version(function () { return '1.0.0'; }, '--version', 'description'); + var argv5 = yargs + .version(function () { return '1.0.0'; }, '--version', 'description'); } function Argv$wrap() { - var argv1 = yargs - .wrap(null); + var argv1 = yargs + .wrap(null); - var argv2 = yargs - .wrap(yargs.terminalWidth()); + var argv2 = yargs + .wrap(yargs.terminalWidth()); } function Argv$locale() { - var argv = yargs - .usage('./$0 - follow ye instructions true') - .option('option', { - alias: 'o', - describe: "'tis a mighty fine option", - demand: true - }) - .command('run', "Arrr, ya best be knowin' what yer doin'") - .example('$0 run foo', "shiver me timbers, here's an example for ye") - .help('help') - .wrap(70) - .locale('pirate') - .argv + var argv = yargs + .usage('./$0 - follow ye instructions true') + .option('option', { + alias: 'o', + describe: "'tis a mighty fine option", + demand: true + }) + .command('run', "Arrr, ya best be knowin' what yer doin'") + .example('$0 run foo', "shiver me timbers, here's an example for ye") + .help('help') + .wrap(70) + .locale('pirate') + .argv } function Argv$epilogue() { - var argv = yargs - .epilogue('for more information, find our manual at http://example.com'); + var argv = yargs + .epilogue('for more information, find our manual at http://example.com'); } function Argv$reset() { - var ya = yargs - .usage('$0 command') - .command('hello', 'hello command') - .command('world', 'world command') - .demand(1, 'must provide a valid command'), - argv = yargs.argv, - command = argv._[0]; + var ya = yargs + .usage('$0 command') + .command('hello', 'hello command') + .command('world', 'world command') + .demand(1, 'must provide a valid command'), + argv = yargs.argv, + command = argv._[0]; - if (command === 'hello') { - ya.reset() - .usage('$0 hello') - .help('h') - .example('$0 hello', 'print the hello message!') - .argv + if (command === 'hello') { + ya.reset() + .usage('$0 hello') + .help('h') + .example('$0 hello', 'print the hello message!') + .argv - console.log('hello!'); - } else if (command === 'world') { - ya.reset() - .usage('$0 world') - .help('h') - .example('$0 world', 'print the world message!') - .argv + console.log('hello!'); + } else if (command === 'world') { + ya.reset() + .usage('$0 world') + .help('h') + .example('$0 world', 'print the world message!') + .argv - console.log('world!'); - } else { - ya.showHelp(); - } + console.log('world!'); + } else { + ya.showHelp(); + } } // http://yargs.js.org/docs/#methods-commanddirdirectory-opts function Argv$commandDir() { - var ya = yargs - .commandDir('.') - .argv + var ya = yargs + .commandDir('.') + .argv } // http://yargs.js.org/docs/#methods-commanddirdirectory-opts function Argv$commandDirWithOptions() { - var ya = yargs - .commandDir('.', { - recurse: false, - extensions: ['js'], - visit: (commandObject: any, pathToFile: string, filename: string) => { }, - include: /.*\.js$/, - exclude: /.*\.spec.js$/, - }) - .argv + var ya = yargs + .commandDir('.', { + recurse: false, + extensions: ['js'], + visit: (commandObject: any, pathToFile: string, filename: string) => { }, + include: /.*\.js$/, + exclude: /.*\.spec.js$/, + }) + .argv } function Argv$normalize() { - var ya = yargs - .normalize('path') - .normalize(['user', 'group']) - .argv + var ya = yargs + .normalize('path') + .normalize(['user', 'group']) + .argv } // From http://yargs.js.org/docs/#methods-coercekey-fn function Argv$coerce() { - var ya = yargs - .coerce('file', function (arg: string) { - return fs.readFileSync(arg, 'utf8'); - }) - .argv + var ya = yargs + .coerce('file', function (arg: string) { + return fs.readFileSync(arg, 'utf8'); + }) + .argv } function Argv$coerces() { - var ya = yargs - .coerce({ - date: Date.parse, - json: JSON.parse - }) - .argv + var ya = yargs + .coerce({ + date: Date.parse, + json: JSON.parse + }) + .argv } function Argv$coerceWithKeys() { - var ya = yargs - .coerce(['src', 'dest'], path.resolve) - .argv + var ya = yargs + .coerce(['src', 'dest'], path.resolve) + .argv } // From http://yargs.js.org/docs/#methods-failfn function Argv$fail() { - var ya = yargs - .fail(function (msg, err) { - if (err) throw err // preserve stack - console.error('You broke it!') - console.error(msg) - process.exit(1) - }) - .argv + var ya = yargs + .fail(function (msg, err) { + if (err) throw err // preserve stack + console.error('You broke it!') + console.error(msg) + process.exit(1) + }) + .argv } function Argv$implies() { - var ya = yargs - .implies('foo', 'snuh') - .implies({ - x: 'y' - }) - .argv + var ya = yargs + .implies('foo', 'snuh') + .implies({ + x: 'y' + }) + .argv } function Argv$count() { - var ya = yargs - .count('size') - .count(['w', 'h']) - .argv + var ya = yargs + .count('size') + .count(['w', 'h']) + .argv } function Argv$number() { - var ya = yargs - .number('n') - .number(['width', 'height']) - .argv + var ya = yargs + .number('n') + .number(['width', 'height']) + .argv } function Argv$updateStrings() { - var ya = yargs - .command('run', 'the run command') - .help('help') - .updateStrings({ - 'Commands:': 'My Commands -->\n' - }) - .wrap(null) - .argv + var ya = yargs + .command('run', 'the run command') + .help('help') + .updateStrings({ + 'Commands:': 'My Commands -->\n' + }) + .wrap(null) + .argv } function Argv$default() { - var ya = yargs - .default('random', function randomValue() { - return Math.random() * 256; - }) - .argv + var ya = yargs + .default('random', function randomValue() { + return Math.random() * 256; + }) + .argv } function Argv$configObject() { - var ya = yargs - .config({foo: 1, bar: 2}) - .argv + var ya = yargs + .config({foo: 1, bar: 2}) + .argv } function Argv$configParseFunction() { - var ya = yargs - .config('settings', function (configPath) { - return JSON.parse(fs.readFileSync(configPath, 'utf-8')) - }) - .config('settings', 'description', function (configPath) { - return JSON.parse(fs.readFileSync(configPath, 'utf-8')) - }) - .argv + var ya = yargs + .config('settings', function (configPath) { + return JSON.parse(fs.readFileSync(configPath, 'utf-8')) + }) + .config('settings', 'description', function (configPath) { + return JSON.parse(fs.readFileSync(configPath, 'utf-8')) + }) + .argv } function Argv$helpDescriptionExplicit() { - var ya = yargs - .help('help', 'description', true) - .argv + var ya = yargs + .help('help', 'description', true) + .argv } function Argv$showHelpConsoleLevel() { - yargs.showHelp("log"); //prints to stdout using console.log() + yargs.showHelp("log"); //prints to stdout using console.log() } function Argv$getCompletion() { - var ya = yargs - .option('foobar', {}) - .option('foobaz', {}) - .completion() - .getCompletion(['./test.js', '--foo'], function (completions) { - console.log(completions) - }) - .argv + var ya = yargs + .option('foobar', {}) + .option('foobaz', {}) + .completion() + .getCompletion(['./test.js', '--foo'], function (completions) { + console.log(completions) + }) + .argv } function Argv$pkgConf() { - var ya = yargs - .pkgConf(['key1', 'key2'], 'configFile.json') - .argv + var ya = yargs + .pkgConf(['key1', 'key2'], 'configFile.json') + .argv } function Argv$recommendCommands() { - var ya = yargs - .recommendCommands() - .argv + var ya = yargs + .recommendCommands() + .argv } function Argv$showCompletionScript() { - var ya = yargs - .showCompletionScript() - .argv + var ya = yargs + .showCompletionScript() + .argv } function Argv$skipValidation() { - var ya = yargs - .skipValidation('arg1') - .skipValidation(['arg2', 'arg3']) - .argv + var ya = yargs + .skipValidation('arg1') + .skipValidation(['arg2', 'arg3']) + .argv } function Argv$commandObject() { From 975b1a68393eb8e3748d7cc732de4fd96c8dfdb7 Mon Sep 17 00:00:00 2001 From: Jeff Kenney Date: Thu, 26 Jan 2017 16:17:30 -0800 Subject: [PATCH 33/55] yargs: add demandCommand() and demandOption() --- yargs/index.d.ts | 7 +++++++ yargs/yargs-tests.ts | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/yargs/index.d.ts b/yargs/index.d.ts index da23a91f7f..bd512a7773 100644 --- a/yargs/index.d.ts +++ b/yargs/index.d.ts @@ -36,6 +36,12 @@ declare namespace yargs { demand(positionals: number, msg: string): Argv; demand(positionals: number, max: number, msg?: string): Argv; + demandCommand(min: number, minMsg?: string): Argv; + demandCommand(min: number, max?: number, minMsg?: string, maxMsg?: string): Argv; + + demandOption(key: string|string[], msg?: string): Argv; + demandOption(key: string|string[], demand?: boolean): Argv; + require(key: string, msg: string): Argv; require(key: string, required: boolean): Argv; require(keys: number[], msg: string): Argv; @@ -187,6 +193,7 @@ declare namespace yargs { default?: any; defaultDescription?: string; demand?: boolean | string; + demandOption?: boolean | string; desc?: string; describe?: string; description?: string; diff --git a/yargs/yargs-tests.ts b/yargs/yargs-tests.ts index ae5871f2a3..90448bce77 100644 --- a/yargs/yargs-tests.ts +++ b/yargs/yargs-tests.ts @@ -562,6 +562,7 @@ function Argv$commandObject() { default: "myvalue", defaultDescription: "description", demand: true, + demandOption: true, desc: "desc", describe: "describe", description: "description", @@ -577,3 +578,24 @@ function Argv$commandObject() { } }) } + +function Argv$demandCommand() { + var ya = yargs + .demandCommand(1) + .demandCommand(1, 'at least 1 command required') + .demandCommand(1, 2) + .demandCommand(1, 2, 'at least 1 command required') + .demandCommand(1, 2, 'at least 1 command required', 'at most 2 commands required') + .argv; +} + +function Argv$demandOption() { + var ya = yargs + .demandOption('a') + .demandOption('a', 'a is required') + .demandOption('a', true) + .demandOption(['a', 'b']) + .demandOption(['a', 'b'], 'a and b are required') + .demandOption(['a', 'b'], true) + .argv; +} From bb4107dc401097d8143c642b56a4d1228bdca5ee Mon Sep 17 00:00:00 2001 From: Jeff Kenney Date: Thu, 26 Jan 2017 16:01:19 -0800 Subject: [PATCH 34/55] yargs: add conflicts() --- yargs/index.d.ts | 3 +++ yargs/yargs-tests.ts | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/yargs/index.d.ts b/yargs/index.d.ts index bd512a7773..1cd96e68e1 100644 --- a/yargs/index.d.ts +++ b/yargs/index.d.ts @@ -109,6 +109,9 @@ declare namespace yargs { config(key: string, parseFn: (configPath: string) => Object): Argv; config(keys: string[], parseFn: (configPath: string) => Object): Argv; + conflicts(key: string, value: string): Argv; + conflicts(conflicts: { [key: string]: string }): Argv; + wrap(columns: number): Argv; strict(): Argv; diff --git a/yargs/yargs-tests.ts b/yargs/yargs-tests.ts index 90448bce77..f68c1113e9 100644 --- a/yargs/yargs-tests.ts +++ b/yargs/yargs-tests.ts @@ -599,3 +599,12 @@ function Argv$demandOption() { .demandOption(['a', 'b'], true) .argv; } + +function Argv$conflicts() { + var ya = yargs + .conflicts('a', 'b') + .conflicts({ + a: 'b' + }) + .argv; +} From 01790850765886569e4c5bf35546ce498240762d Mon Sep 17 00:00:00 2001 From: Jeff Kenney Date: Thu, 26 Jan 2017 16:04:55 -0800 Subject: [PATCH 35/55] yargs: increment version number to v6.6.0, update authors --- yargs/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yargs/index.d.ts b/yargs/index.d.ts index 1cd96e68e1..db205efc09 100644 --- a/yargs/index.d.ts +++ b/yargs/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for yargs 6.5.0 +// Type definitions for yargs 6.6.0 // Project: https://github.com/chevex/yargs -// Definitions by: Martin Poelstra , Mizunashi Mana , Jeffery Grajkowski +// Definitions by: Martin Poelstra , Mizunashi Mana , Jeffery Grajkowski , Jeff Kenney // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace yargs { From 9e263a8d9f5468da2cea5a789c58bf42fc610974 Mon Sep 17 00:00:00 2001 From: Jeff Kenney Date: Fri, 27 Jan 2017 09:32:24 -0800 Subject: [PATCH 36/55] yargs: standardize spaces around union operator --- yargs/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yargs/index.d.ts b/yargs/index.d.ts index db205efc09..a704afec94 100644 --- a/yargs/index.d.ts +++ b/yargs/index.d.ts @@ -39,8 +39,8 @@ declare namespace yargs { demandCommand(min: number, minMsg?: string): Argv; demandCommand(min: number, max?: number, minMsg?: string, maxMsg?: string): Argv; - demandOption(key: string|string[], msg?: string): Argv; - demandOption(key: string|string[], demand?: boolean): Argv; + demandOption(key: string | string[], msg?: string): Argv; + demandOption(key: string | string[], demand?: boolean): Argv; require(key: string, msg: string): Argv; require(key: string, required: boolean): Argv; @@ -156,7 +156,7 @@ declare namespace yargs { fail(func: (msg: string, err: Error) => any): Argv; - coerce(key: string|string[], func: (arg: T) => U): Argv; + coerce(key: string | string[], func: (arg: T) => U): Argv; coerce(opts: { [key: string]: (arg: T) => U; }): Argv; getCompletion(args: string[], done: (completions: string[]) => void): Argv; From 2d3c8e8e4481771de2e4feeb9b5ef96f6d162232 Mon Sep 17 00:00:00 2001 From: Jeff Kenney Date: Fri, 27 Jan 2017 09:35:34 -0800 Subject: [PATCH 37/55] yargs: add .editorconfig --- yargs/.editorconfig | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 yargs/.editorconfig diff --git a/yargs/.editorconfig b/yargs/.editorconfig new file mode 100644 index 0000000000..db9b917e06 --- /dev/null +++ b/yargs/.editorconfig @@ -0,0 +1,5 @@ +[*.ts] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 From e535a5dfa000f29fd907b9c702b061e8fc0c557f Mon Sep 17 00:00:00 2001 From: Jeff Kenney Date: Fri, 27 Jan 2017 10:17:26 -0800 Subject: [PATCH 38/55] yargs: add deprecated annotation for demand() --- yargs/index.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/yargs/index.d.ts b/yargs/index.d.ts index a704afec94..9c581611db 100644 --- a/yargs/index.d.ts +++ b/yargs/index.d.ts @@ -28,6 +28,9 @@ declare namespace yargs { default(key: string, value: any, description?: string): Argv; default(defaults: { [key: string]: any }, description?: string): Argv; + /** + * @deprecated since version 6.6.0 + */ demand(key: string, msg: string): Argv; demand(key: string, required?: boolean): Argv; demand(keys: string[], msg: string): Argv; @@ -42,6 +45,9 @@ declare namespace yargs { demandOption(key: string | string[], msg?: string): Argv; demandOption(key: string | string[], demand?: boolean): Argv; + /** + * @deprecated since version 6.6.0 + */ require(key: string, msg: string): Argv; require(key: string, required: boolean): Argv; require(keys: number[], msg: string): Argv; @@ -49,6 +55,9 @@ declare namespace yargs { require(positionals: number, required: boolean): Argv; require(positionals: number, msg: string): Argv; + /** + * @deprecated since version 6.6.0 + */ required(key: string, msg: string): Argv; required(key: string, required: boolean): Argv; required(keys: number[], msg: string): Argv; @@ -195,6 +204,7 @@ declare namespace yargs { count?: boolean; default?: any; defaultDescription?: string; + /** @deprecated since version 6.6.0 */ demand?: boolean | string; demandOption?: boolean | string; desc?: string; From 7078614fc5d6a55447ed9971c7c36d2b354dd60f Mon Sep 17 00:00:00 2001 From: 421p Date: Thu, 2 Feb 2017 22:19:06 +0200 Subject: [PATCH 39/55] fix arguments in callbacks --- wampy/wampy.d.ts | 49 +++++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/wampy/wampy.d.ts b/wampy/wampy.d.ts index 261c521aff..357591acf9 100644 --- a/wampy/wampy.d.ts +++ b/wampy/wampy.d.ts @@ -3,7 +3,8 @@ // Definitions by: Konstantin Burkalev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -interface WampyOptions { +interface WampyOptions +{ autoReconnect?: boolean; reconnectInterval?: number; maxRetries?: number; @@ -21,55 +22,65 @@ interface WampyOptions { msgpackCoder?: any; } -interface WampyOpStatus { +interface WampyOpStatus +{ code: number; description: string; reqId?: number; } -interface SuccessErrorCallbacksHash { +interface SuccessErrorCallbacksHash +{ onSuccess?: (data: any) => void; - onError?: (err: string) => void; + onError?: (err: string, details: any) => void; } -interface SubscribeCallbacksHash extends SuccessErrorCallbacksHash { - onEvent: (data: any) => void; +interface SubscribeCallbacksHash extends SuccessErrorCallbacksHash +{ + onEvent: (args: any[], kwargs: any) => void; } -interface RegisterCallbacksHash extends SuccessErrorCallbacksHash { +interface RegisterCallbacksHash extends SuccessErrorCallbacksHash +{ rpc: (data: any, options: any) => any[]; } -interface CallSuccessErrorCallbacksHash { - onSuccess: (data: any) => any; - onError?: (err: string) => void; +interface CallSuccessErrorCallbacksHash +{ + onSuccess: (args: any[], kwargs: any) => any; + onError?: (err: string, details: any, args: any[], kwargs: any) => void; } -interface AdvancedOptions { +interface AdvancedOptions +{ exclude?: number | number[]; eligible?: number | number[]; exclude_me?: boolean; disclose_me?: boolean; } -interface PublishAdvancedOptions extends AdvancedOptions { +interface PublishAdvancedOptions extends AdvancedOptions +{ exclude_authid?: string | string[]; exclude_authrole?: string | string[]; eligible_authid?: string | string[]; eligible_authrole?: string | string[]; } -interface CallAdvancedOptions { +interface CallAdvancedOptions +{ disclose_me?: boolean; receive_progress?: boolean; timeout?: number; } -interface CancelAdvancedOptions { +interface CancelAdvancedOptions +{ mode?: "skip" | "kill" | "killnowait"; } -interface Wampy { +interface Wampy +{ new (url?: string, options?: WampyOptions): Wampy; options(opts?: WampyOptions): WampyOptions | Wampy; getOpStatus(): WampyOpStatus; @@ -77,15 +88,15 @@ interface Wampy { connect(url?: string): Wampy; disconnect(): Wampy; abort(): Wampy; - subscribe(topicURI: string, callbacks: (((data: any) => void) | SubscribeCallbacksHash)): Wampy; - unsubscribe(topicURI: string, callbacks?: (((data: any) => void) | SubscribeCallbacksHash)): Wampy; + subscribe(topicURI: string, callbacks: (((args: any[], kwargs: any) => void) | SubscribeCallbacksHash)): Wampy; + unsubscribe(topicURI: string, callbacks?: (((args: any[], kwargs: any) => void) | SubscribeCallbacksHash)): Wampy; publish(topicURI: string, payload?: any, callbacks?: SuccessErrorCallbacksHash, advancedOptions?: PublishAdvancedOptions): Wampy; call(topicURI: string, payload?: any, - callbacks?: (((data: any) => void) | CallSuccessErrorCallbacksHash), + callbacks?: (((args: any[], kwargs: any) => void) | CallSuccessErrorCallbacksHash), advancedOptions?: CallAdvancedOptions): Wampy; cancel(reqId: number, callbacks?: ((() => void) | SuccessErrorCallbacksHash), @@ -94,7 +105,6 @@ interface Wampy { unregister(topicURI: string, callbacks?: ((() => void) | SuccessErrorCallbacksHash)): Wampy; } - declare var wampy: Wampy; declare module 'wampy' @@ -103,3 +113,4 @@ declare module 'wampy' } + From a73aa9c077a1164913af853b0acdd028cc1d3cd3 Mon Sep 17 00:00:00 2001 From: inuscript Date: Fri, 3 Feb 2017 18:39:39 +0900 Subject: [PATCH 40/55] Add axios to not needed packages --- axios/axios-tests.ts | 107 -------------- axios/index.d.ts | 316 ----------------------------------------- axios/tsconfig.json | 23 --- notNeededPackages.json | 6 + 4 files changed, 6 insertions(+), 446 deletions(-) delete mode 100644 axios/axios-tests.ts delete mode 100644 axios/index.d.ts delete mode 100644 axios/tsconfig.json diff --git a/axios/axios-tests.ts b/axios/axios-tests.ts deleted file mode 100644 index eb98e2710c..0000000000 --- a/axios/axios-tests.ts +++ /dev/null @@ -1,107 +0,0 @@ - - -enum HttpMethod { GET, PUT, POST, DELETE, CONNECT, HEAD, OPTIONS, TRACE, PATCH } -enum ResponseType { arraybuffer, blob, document, json, text } - -interface Repository { - id: number; - name: string; -} - -interface Issue { - id: number; - title: string; -} - -axios.interceptors.request.use(config => { - console.log("Method:" + config.method + " Url:" +config.url); - return config; -}); - - -const requestId: number = axios.interceptors.request.use( - (config) => { - console.log("Method:" + config.method + " Url:" +config.url); - return config; - }, - (error: any) => error); - - -axios.interceptors.request.eject(requestId); -axios.interceptors.request.eject(7); - - -axios.interceptors.response.use(config => { - console.log("Status:" + config.status); - return config; -}); - -const responseId: number = axios.interceptors.response.use( - config => { - console.log("Status:" + config.status); - return config; - }, - (error: any) => error); - -axios.interceptors.response.eject(responseId); - -axios.get("https://api.github.com/repos/mzabriskie/axios") - .then(r => console.log(r.config.method)); - -var getRepoDetails = axios({ - url: "https://api.github.com/repos/mzabriskie/axios", - method: HttpMethod[HttpMethod.GET], - headers: {}, -}).then(r => { - console.log("ID:" + r.data.id + " Name: " + r.data.name); - return r; -}); - -axios.post("http://example.com/", {}, { - transformRequest: (data: any) => data -}); - -axios.post("http://example.com/", { - headers: {'X-Custom-Header': 'foobar'} -}, { - transformRequest: [ - (data: any) => data - ] -}); - -var config: Axios.AxiosXHRConfigBase = {headers: {}}; -config.headers['X-Custom-Header'] = 'baz'; -axios.post("http://example.com/", config); - -var getRepoIssue = axios.get("https://api.github.com/repos/mzabriskie/axios/issues/1"); - -var axiosInstance = axios.create({ - baseURL: "https://api.github.com/repos/mzabriskie/axios/", - timeout: 1000 -}); - -axiosInstance.request({url: "issues/1"}).then(res => { - if (res.headers['content-type'].startsWith('application/json')) { - throw new Error('Unexpected content-type'); - } -}); - -axios.all([getRepoDetails, getRepoDetails]).then(([repo1, repo2]) => { - var sumIds = repo1.data.id + repo2.data.id; - console.log("Sum ID:" + sumIds); - return sumIds; -}); - -var repoSum = (repo1: Axios.AxiosXHR, repo2: Axios.AxiosXHR) => { - var sumIds = repo1.data.id + repo2.data.id; - console.log("Sum ID:" + sumIds); - return sumIds; -}; - -axios.all([getRepoDetails, getRepoDetails]).then(axios.spread(repoSum)); - -axios.defaults.baseURL = 'https://api.example.com'; -axios.defaults.headers.common['Authorization'] = "AUTH_TOKEN"; -axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; - -axiosInstance.defaults.headers.common['Authorization'] = "AUTH_TOKEN"; \ No newline at end of file diff --git a/axios/index.d.ts b/axios/index.d.ts deleted file mode 100644 index 681fefc806..0000000000 --- a/axios/index.d.ts +++ /dev/null @@ -1,316 +0,0 @@ -// Type definitions for axios 0.9.1 -// Project: https://github.com/mzabriskie/axios -// Definitions by: Marcel Buesing -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare namespace Axios { - - interface IThenable { - then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => U | IThenable): IThenable; - then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => void): IThenable; - } - - interface IPromise extends IThenable { - then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => U | IThenable): IPromise; - then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => void): IPromise; - catch(onRejected?: (error: any) => U | IThenable): IPromise; - } - - /** - * HTTP Basic auth details - */ - interface AxiosHttpBasicAuth { - username: string; - password: string; - } - - /** - * Common axios XHR config interface - * - request body data type - */ - interface AxiosXHRConfigBase { - /** - * will be prepended to `url` unless `url` is absolute. - * It can be convenient to set `baseURL` for an instance - * of axios to pass relative URLs to methods of that instance. - */ - baseURL?: string; - - /** - * custom headers to be sent - */ - headers?: {[key: string]: any}; - - /** - * URL parameters to be sent with the request - */ - params?: Object; - - /** - * optional function in charge of serializing `params` - * (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/) - */ - paramsSerializer?: (params: Object) => string; - - /** - * specifies the number of milliseconds before the request times out. - * If the request takes longer than `timeout`, the request will be aborted. - */ - timeout?: number; - - /** - * indicates whether or not cross-site Access-Control requests - * should be made using credentials - */ - withCredentials?: boolean; - - /** - * indicates that HTTP Basic auth should be used, and supplies - * credentials. This will set an `Authorization` header, - * overwriting any existing `Authorization` custom headers you have - * set using `headers`. - */ - auth?: AxiosHttpBasicAuth; - - /** - * indicates the type of data that the server will respond with - * options are 'arraybuffer', 'blob', 'document', 'json', 'text' - */ - responseType?: string; - - /** - * name of the cookie to use as a value for xsrf token - */ - xsrfCookieName?: string; - - /** - * name of the http header that carries the xsrf token value - */ - xsrfHeaderName?: string; - - /** - * Change the request data before it is sent to the server. - * This is only applicable for request methods 'PUT', 'POST', and 'PATCH' - * The last function in the array must return a string or an ArrayBuffer - */ - transformRequest?: ((data: T) => U) | [(data: T) => U]; - - /** - * change the response data to be made before it is passed to then/catch - */ - transformResponse?: (data: T) => U; - - /** - * defines whether to resolve or reject the promise for a given HTTP response status code. - * If returns `true` (or is set to `null` or `undefined`), the promise will be resolved; - * otherwise, the promise will be rejected - */ - validateStatus?: (status: number) => boolean | undefined; - } - - /** - * - request body data type - */ - interface AxiosXHRConfig extends AxiosXHRConfigBase { - /** - * server URL that will be used for the request, options are: - * GET, PUT, POST, DELETE, CONNECT, HEAD, OPTIONS, TRACE, PATCH - */ - url: string; - - /** - * request method to be used when making the request - */ - method?: string; - - /** - * data to be sent as the request body - * Only applicable for request methods 'PUT', 'POST', and 'PATCH' - * When no `transformRequest` is set, must be a string, an ArrayBuffer or a hash - */ - data?: T; - } - - interface AxiosXHRConfigDefaults extends AxiosXHRConfigBase { - /** - * custom headers to be sent - */ - headers: { - common: {[index: string]: string}; - patch: {[index: string]: string}; - post: {[index: string]: string}; - put: {[index: string]: string}; - }; - } - - /** - * - expected response type, - * - request body data type - */ - interface AxiosXHR { - /** - * Response that was provided by the server - */ - data: T; - - /** - * HTTP status code from the server response - */ - status: number; - - /** - * HTTP status message from the server response - */ - statusText: string; - - /** - * headers that the server responded with - */ - headers: {[index: string]: any}; - - /** - * config that was provided to `axios` for the request - */ - config: AxiosXHRConfig; - } - - interface Interceptor { - /** - * intercept request before it is sent - */ - request: RequestInterceptor; - - /** - * intercept response of request when it is received. - */ - response: ResponseInterceptor - } - - type InterceptorId = number; - - interface RequestInterceptor { - /** - * - request body data type - */ - - use(fulfilledFn: (config: AxiosXHRConfig) => AxiosXHRConfig): InterceptorId; - - use(fulfilledFn: (config: AxiosXHRConfig) => AxiosXHRConfig, - rejectedFn: (error: any) => any) - : InterceptorId; - - eject(interceptorId: InterceptorId): void; - } - - interface ResponseInterceptor { - /** - * - expected response type - */ - - use(fulfilledFn: (config: Axios.AxiosXHR) => Axios.AxiosXHR): InterceptorId; - - use(fulfilledFn: (config: Axios.AxiosXHR) => Axios.AxiosXHR, - rejectedFn: (error: any) => any) - : InterceptorId; - - eject(interceptorId: InterceptorId): void; - } - - /** - * - expected response type, - * - request body data type - */ - interface AxiosInstance { - - /** - * Send request as configured - */ - (config: AxiosXHRConfig): IPromise>; - - /** - * Send request as configured - */ - new (config: AxiosXHRConfig): IPromise>; - - /** - * Send request as configured - */ - request(config: AxiosXHRConfig): IPromise>; - - /** - * intercept requests or responses before they are handled by then or catch - */ - interceptors: Interceptor; - - /** - * Config defaults - */ - defaults: AxiosXHRConfigDefaults; - - /** - * equivalent to `Promise.all` - */ - all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>, T6 | IPromise>, T7 | IPromise>, T8 | IPromise>, T9 | IPromise>, T10 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; - all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>, T6 | IPromise>, T7 | IPromise>, T8 | IPromise>, T9 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; - all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>, T6 | IPromise>, T7 | IPromise>, T8 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; - all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>, T6 | IPromise>, T7 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; - all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>, T6 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; - all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; - all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; - all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR]>; - all(values: [T1 | IPromise>, T2 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR]>; - - /** - * spread array parameter to `fn`. - * note: alternative to `spread`, destructuring assignment. - */ - spread(fn: (t1: T1, t2: T2) => U): (arr: ([T1, T2])) => U; - - /** - * convenience alias, method = GET - */ - get(url: string, config?: AxiosXHRConfigBase): IPromise>; - - - /** - * convenience alias, method = DELETE - */ - delete(url: string, config?: AxiosXHRConfigBase): IPromise>; - - /** - * convenience alias, method = HEAD - */ - head(url: string, config?: AxiosXHRConfigBase): IPromise>; - - /** - * convenience alias, method = POST - */ - post(url: string, data?: any, config?: AxiosXHRConfigBase): IPromise>; - - /** - * convenience alias, method = PUT - */ - put(url: string, data?: any, config?: AxiosXHRConfigBase): IPromise>; - - /** - * convenience alias, method = PATCH - */ - patch(url: string, data?: any, config?: AxiosXHRConfigBase): IPromise>; - } - - /** - * - expected response type, - */ - interface AxiosStatic extends AxiosInstance { - /** - * create a new instance of axios with a custom config - */ - create(config: AxiosXHRConfigBase): AxiosInstance; - } -} - -declare var axios: Axios.AxiosStatic; - -declare module "axios" { - export = axios; -} diff --git a/axios/tsconfig.json b/axios/tsconfig.json deleted file mode 100644 index 4300cfb925..0000000000 --- a/axios/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "axios-tests.ts" - ] -} \ No newline at end of file diff --git a/notNeededPackages.json b/notNeededPackages.json index e671ef4523..46509a1642 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -293,6 +293,12 @@ "typingsPackageName": "redux-saga", "sourceRepoURL": "https://github.com/redux-saga/redux-saga", "asOfVersion": "0.10.5" + }, + { + "libraryName": "axios", + "typingsPackageName": "axios", + "sourceRepoURL": "https://github.com/mzabriskie/axios", + "asOfVersion": "0.14.0" } ] } From 966906150f5b098c91a9c8313c135d9095d2dafe Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 3 Feb 2017 16:26:59 +0300 Subject: [PATCH 41/55] Revert "update wampy.d.ts to work with in-browser typescript" --- wampy/wampy.d.ts | 209 ++++++++++++++++++++++------------------------- 1 file changed, 99 insertions(+), 110 deletions(-) diff --git a/wampy/wampy.d.ts b/wampy/wampy.d.ts index 357591acf9..e068b97a25 100644 --- a/wampy/wampy.d.ts +++ b/wampy/wampy.d.ts @@ -3,114 +3,103 @@ // Definitions by: Konstantin Burkalev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -interface WampyOptions -{ - autoReconnect?: boolean; - reconnectInterval?: number; - maxRetries?: number; - transportEncoding?: string; - realm?: string; - helloCustomDetails?: any; - onChallenge?: (auth_method: string, challenge_details: string) => string; - authid?: string; - onConnect?: () => void; - onClose?: () => void; - onError?: () => void; - onReconnect?: () => void; - onReconnectSuccess?: () => void; - ws?: any; - msgpackCoder?: any; +declare module "wampy" { + + interface WampyOptions { + autoReconnect?: boolean; + reconnectInterval?: number; + maxRetries?: number; + transportEncoding?: string; + realm?: string; + helloCustomDetails?: any; + onChallenge?: (auth_method: string, challenge_details: string) => string; + authid?: string; + onConnect?: () => void; + onClose?: () => void; + onError?: () => void; + onReconnect?: () => void; + onReconnectSuccess?: () => void; + ws?: any; + msgpackCoder?: any; + } + + interface WampyOpStatus { + code: number; + description: string; + reqId?: number; + } + + interface SuccessErrorCallbacksHash { + onSuccess?: (data: any) => void; + onError?: (err: string) => void; + } + + interface SubscribeCallbacksHash extends SuccessErrorCallbacksHash { + onEvent: (data: any) => void; + } + + interface RegisterCallbacksHash extends SuccessErrorCallbacksHash { + rpc: (data: any, options: any) => any[]; + } + + interface CallSuccessErrorCallbacksHash { + onSuccess: (data: any) => any; + onError?: (err: string) => void; + } + + interface AdvancedOptions { + exclude?: number | number[]; + eligible?: number | number[]; + exclude_me?: boolean; + disclose_me?: boolean; + } + + interface PublishAdvancedOptions extends AdvancedOptions { + exclude_authid?: string | string[]; + exclude_authrole?: string | string[]; + eligible_authid?: string | string[]; + eligible_authrole?: string | string[]; + } + + interface CallAdvancedOptions { + disclose_me?: boolean; + receive_progress?: boolean; + timeout?: number; + } + + interface CancelAdvancedOptions { + mode?: "skip" | "kill" | "killnowait"; + } + + interface Wampy { + options(opts?: WampyOptions): WampyOptions | Wampy; + getOpStatus(): WampyOpStatus; + getSessionId(): number; + connect(url?: string): Wampy; + disconnect(): Wampy; + abort(): Wampy; + subscribe(topicURI: string, callbacks: (((data: any) => void) | SubscribeCallbacksHash)): Wampy; + unsubscribe(topicURI: string, callbacks?: (((data: any) => void) | SubscribeCallbacksHash)): Wampy; + publish(topicURI: string, + payload?: any, + callbacks?: SuccessErrorCallbacksHash, + advancedOptions?: PublishAdvancedOptions): Wampy; + call(topicURI: string, + payload?: any, + callbacks?: (((data: any) => void) | CallSuccessErrorCallbacksHash), + advancedOptions?: CallAdvancedOptions): Wampy; + cancel(reqId: number, + callbacks?: ((() => void) | SuccessErrorCallbacksHash), + advancedOptions?: CancelAdvancedOptions): Wampy; + register(topicURI: string, callbacks: (((data: any, options: any) => any[]) | RegisterCallbacksHash)): Wampy; + unregister(topicURI: string, callbacks?: ((() => void) | SuccessErrorCallbacksHash)): Wampy; + } + + interface WampyInstance { + new(url?: string, options?: WampyOptions): Wampy; + } + + var wampy: WampyInstance; + + export default wampy; } - -interface WampyOpStatus -{ - code: number; - description: string; - reqId?: number; -} - -interface SuccessErrorCallbacksHash -{ - onSuccess?: (data: any) => void; - onError?: (err: string, details: any) => void; -} - -interface SubscribeCallbacksHash extends SuccessErrorCallbacksHash -{ - onEvent: (args: any[], kwargs: any) => void; -} - -interface RegisterCallbacksHash extends SuccessErrorCallbacksHash -{ - rpc: (data: any, options: any) => any[]; -} - -interface CallSuccessErrorCallbacksHash -{ - onSuccess: (args: any[], kwargs: any) => any; - onError?: (err: string, details: any, args: any[], kwargs: any) => void; -} - -interface AdvancedOptions -{ - exclude?: number | number[]; - eligible?: number | number[]; - exclude_me?: boolean; - disclose_me?: boolean; -} - -interface PublishAdvancedOptions extends AdvancedOptions -{ - exclude_authid?: string | string[]; - exclude_authrole?: string | string[]; - eligible_authid?: string | string[]; - eligible_authrole?: string | string[]; -} - -interface CallAdvancedOptions -{ - disclose_me?: boolean; - receive_progress?: boolean; - timeout?: number; -} - -interface CancelAdvancedOptions -{ - mode?: "skip" | "kill" | "killnowait"; -} - -interface Wampy -{ - new (url?: string, options?: WampyOptions): Wampy; - options(opts?: WampyOptions): WampyOptions | Wampy; - getOpStatus(): WampyOpStatus; - getSessionId(): number; - connect(url?: string): Wampy; - disconnect(): Wampy; - abort(): Wampy; - subscribe(topicURI: string, callbacks: (((args: any[], kwargs: any) => void) | SubscribeCallbacksHash)): Wampy; - unsubscribe(topicURI: string, callbacks?: (((args: any[], kwargs: any) => void) | SubscribeCallbacksHash)): Wampy; - publish(topicURI: string, - payload?: any, - callbacks?: SuccessErrorCallbacksHash, - advancedOptions?: PublishAdvancedOptions): Wampy; - call(topicURI: string, - payload?: any, - callbacks?: (((args: any[], kwargs: any) => void) | CallSuccessErrorCallbacksHash), - advancedOptions?: CallAdvancedOptions): Wampy; - cancel(reqId: number, - callbacks?: ((() => void) | SuccessErrorCallbacksHash), - advancedOptions?: CancelAdvancedOptions): Wampy; - register(topicURI: string, callbacks: (((data: any, options: any) => any[]) | RegisterCallbacksHash)): Wampy; - unregister(topicURI: string, callbacks?: ((() => void) | SuccessErrorCallbacksHash)): Wampy; -} - -declare var wampy: Wampy; - -declare module 'wampy' -{ - export = wampy -} - - - From 01dc4752d185d4932be5617fa5f94d7717240cc9 Mon Sep 17 00:00:00 2001 From: 421p Date: Fri, 3 Feb 2017 19:35:29 +0200 Subject: [PATCH 42/55] fix tests --- wampy/wampy-tests.ts | 84 ++++++++++++++++++-------------------------- wampy/wampy.d.ts | 2 +- 2 files changed, 35 insertions(+), 51 deletions(-) diff --git a/wampy/wampy-tests.ts b/wampy/wampy-tests.ts index c0ac8d6656..bd414f8c85 100644 --- a/wampy/wampy-tests.ts +++ b/wampy/wampy-tests.ts @@ -1,47 +1,50 @@ /// /// -import Wampy from 'wampy'; +import * as Wampy from 'wampy'; -var ws = new Wampy('http://wamp.router.url', {realm: 'WAMPRealm'}); +let ws = new Wampy('http://wamp.router.url', {realm: 'WAMPRealm'}); ws.options(); ws.options({ reconnectInterval: 1000, maxRetries: 999, - onConnect: function () { console.log('Yahoo! We are online!'); }, - onClose: function () { console.log('See you next time!'); }, - onError: function () { console.log('Breakdown happened'); }, - onReconnect: function () { console.log('Reconnecting...'); }, - onReconnectSuccess: function () { console.log('Successfully reconnected!'); } + onConnect: () => console.log('Yahoo! We are online!'), + onClose: () => console.log('See you next time!'), + onError: () => console.log('Breakdown happened'), + onReconnect: () => console.log('Reconnecting...'), + onReconnectSuccess: () => console.log('Successfully reconnected!') }); ws.connect(); ws.connect('/my-socket-path'); ws.connect('wss://socket.server.com:5000/ws'); -var id: number = ws.getSessionId(); + +let id: number = ws.getSessionId(); + ws.disconnect(); ws.abort(); -ws.subscribe('system.monitor.update', function (data) { +ws.subscribe('system.monitor.update', (args: any[], kwargs: any) => { console.log('Received system.monitor.update event!'); }) - .subscribe('client.message', function (data) { + .subscribe('client.message', function (args: any[], kwargs: any) { console.log('Received client.message event!'); }); -var f1 = function () { console.log('Subscribe processing!'); }; +let f1 = () => console.log('Subscribe processing!'); + ws.unsubscribe('subscribed.topic', f1); ws.unsubscribe('chat.message.received'); ws.call('get.server.time', null, { - onSuccess: function (stime) { + onSuccess: (args: any[], kwargs: any) => { console.log('RPC successfully called'); - console.log('Server time is ' + stime); + console.log('Server time is ' + kwargs); }, - onError: function (err) { + onError: (err: string, details: any, args: any[], kwargs: any) => { console.log('RPC call failed with error ' + err); } }); @@ -54,67 +57,48 @@ ws.publish('chat.message.received', 'user message'); ws.publish('chat.message.received', ['user message1', 'user message2']); ws.publish('user.modified', { field1: 'field1', field2: true, field3: 123 }); ws.publish('user.modified', { field1: 'field1', field2: true, field3: 123 }, { - onSuccess: function () { console.log('User successfully modified'); } + onSuccess: () => console.log('User successfully modified') }); ws.publish('user.modified', { field1: 'field1', field2: true, field3: 123 }, { - onSuccess: function () { console.log('User successfully modified'); }, - onError: function (err) { console.log('User modification failed', err); } + onSuccess: () => console.log('User successfully modified'), + onError: (err: string, details: any) => console.log('User modification failed', err) }); ws.publish('chat.message.received', ['Private message'], null, { eligible: 123456789 }); -ws.call('server.time', null, function (data) { console.log('Server time is ' + data[0]); }); +ws.call('server.time', null, (args: any[], kwargs: any) => console.log('Server time is ' + args[0])); ws.call('start.migration', null, { - onSuccess: function (data) { - console.log('RPC successfully called'); - }, - onError: function (err) { - console.log('RPC call failed!',err); - } + onSuccess: (args: any[], kwargs: any) => console.log('RPC successfully called'), + onError: (err: string, details: any, args: any[], kwargs: any) => console.log('RPC call failed!',err) }); ws.call('restore.backup', { backupFile: 'backup.zip' }, { - onSuccess: function (data) { - console.log('Backup successfully restored'); - }, - onError: function (err) { - console.log('Restore failed!',err); - } + onSuccess: (args: any[], kwargs: any) => console.log('Backup successfully restored'), + onError: (err: string, details: any, args: any[], kwargs: any) => console.log('Restore failed!',err) }); ws.call('start.migration', null, { - onSuccess: function (data) { - console.log('RPC successfully called'); - }, - onError: function (err) { - console.log('RPC call failed!',err); - } + onSuccess: (args: any[], kwargs: any) => console.log('RPC successfully called'), + onError: (err: string, details: any, args: any[], kwargs: any) => console.log('RPC call failed!',err) }); -var status = ws.getOpStatus(); + +let status = ws.getOpStatus(); ws.cancel(status.reqId); -var sqrt_f = function (x: number, y: any) { return [{}, x*x]; }; +let sqrt_f = (x: number, y: any) => [{}, x*x]; ws.register('sqrt.value', sqrt_f); ws.register('sqrt.value', { rpc: sqrt_f, - onSuccess: function (data) { - console.log('RPC successfully registered'); - }, - onError: function (err) { - console.log('RPC registration failed!',err); - } + onSuccess: (data: any) => console.log('RPC successfully registered'), + onError: (err: string, details: any) => console.log('RPC registration failed!',err) }); ws.unregister('sqrt.value'); ws.unregister('sqrt.value', { - onSuccess: function (data) { - console.log('RPC successfully unregistered'); - }, - onError: function (err) { - console.log('RPC unregistration failed!',err); - } + onSuccess: (data: any) => console.log('RPC successfully unregistered'), + onError: (err: string, details: any) => console.log('RPC unregistration failed!', err) }); diff --git a/wampy/wampy.d.ts b/wampy/wampy.d.ts index 357591acf9..f74695503a 100644 --- a/wampy/wampy.d.ts +++ b/wampy/wampy.d.ts @@ -109,7 +109,7 @@ declare var wampy: Wampy; declare module 'wampy' { - export = wampy + export = wampy; } From cec3881ae0ec736fd66366f5475a7356468aec8a Mon Sep 17 00:00:00 2001 From: Alexandre Rieux Date: Sat, 4 Feb 2017 11:00:14 +0000 Subject: [PATCH 43/55] Add bundled module --- mapbox-gl/index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mapbox-gl/index.d.ts b/mapbox-gl/index.d.ts index 360eb1ce33..2e75704dde 100644 --- a/mapbox-gl/index.d.ts +++ b/mapbox-gl/index.d.ts @@ -986,3 +986,7 @@ declare namespace mapboxgl { declare module 'mapbox-gl' { export = mapboxgl; } + +declare module 'mapbox-gl/dist/mapbox-gl' { + export = mapboxgl; +} From 2e14c31a33f42857d1651b7d8b336a519b9431e7 Mon Sep 17 00:00:00 2001 From: Olmo del Corral Date: Mon, 6 Feb 2017 07:36:39 +0100 Subject: [PATCH 44/55] make RouteComponentProps non-optional to smoth strictNullChecks --- react-router/lib/Router.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/react-router/lib/Router.d.ts b/react-router/lib/Router.d.ts index dbd2d43fff..95b2e38267 100644 --- a/react-router/lib/Router.d.ts +++ b/react-router/lib/Router.d.ts @@ -86,11 +86,11 @@ export interface InjectedRouter { } export interface RouteComponentProps { - location?: Location; - params?: P & R; - route?: PlainRoute; - router?: InjectedRouter; - routeParams?: R; + location: Location; + params: P & R; + route: PlainRoute; + router: InjectedRouter; + routeParams: R; } export interface RouterProps extends ClassAttributes { From eae4e9814145c51b92401305e3fa1f87170870f4 Mon Sep 17 00:00:00 2001 From: Rohit Kumar Date: Mon, 6 Feb 2017 12:52:39 +0530 Subject: [PATCH 45/55] Fix error in definition for fusioncharts modules. - *ERROR in* Argument of type 'FusionChartStatic' is not assignable to parameter of type 'FusionCharts'. --- fusioncharts/fusioncharts.charts.d.ts | 8 ++++---- fusioncharts/fusioncharts.gantt.d.ts | 8 ++++---- fusioncharts/fusioncharts.maps.d.ts | 8 ++++---- fusioncharts/fusioncharts.powercharts.d.ts | 8 ++++---- fusioncharts/fusioncharts.ssgrid.d.ts | 8 ++++---- fusioncharts/fusioncharts.treemap.d.ts | 8 ++++---- fusioncharts/fusioncharts.widgets.d.ts | 8 ++++---- fusioncharts/fusioncharts.zoomscatter.d.ts | 8 ++++---- fusioncharts/maps/fusioncharts.usa.d.ts | 8 ++++---- fusioncharts/maps/fusioncharts.world.d.ts | 8 ++++---- fusioncharts/themes/fusioncharts.theme.carbon.d.ts | 8 ++++---- fusioncharts/themes/fusioncharts.theme.fint.d.ts | 8 ++++---- fusioncharts/themes/fusioncharts.theme.ocean.d.ts | 8 ++++---- fusioncharts/themes/fusioncharts.theme.zune.d.ts | 8 ++++---- 14 files changed, 56 insertions(+), 56 deletions(-) diff --git a/fusioncharts/fusioncharts.charts.d.ts b/fusioncharts/fusioncharts.charts.d.ts index 214f9d79c2..f06060a054 100644 --- a/fusioncharts/fusioncharts.charts.d.ts +++ b/fusioncharts/fusioncharts.charts.d.ts @@ -1,7 +1,7 @@ -interface FusionCharts { - type: string; -} -declare var charts: (H: FusionCharts) => FusionCharts; +import { FusionChartStatic } from "fusioncharts"; + +declare var charts: (H: FusionChartStatic) => FusionChartStatic; export = charts; export as namespace charts; + diff --git a/fusioncharts/fusioncharts.gantt.d.ts b/fusioncharts/fusioncharts.gantt.d.ts index 7af79ff354..d29fa26f78 100644 --- a/fusioncharts/fusioncharts.gantt.d.ts +++ b/fusioncharts/fusioncharts.gantt.d.ts @@ -1,7 +1,7 @@ -interface FusionCharts { - type: string; -} -declare var gantt: (H: FusionCharts) => FusionCharts; +import { FusionChartStatic } from "fusioncharts"; + +declare var gantt: (H: FusionChartStatic) => FusionChartStatic; export = gantt; export as namespace gantt; + diff --git a/fusioncharts/fusioncharts.maps.d.ts b/fusioncharts/fusioncharts.maps.d.ts index 8610b8405f..1894383758 100644 --- a/fusioncharts/fusioncharts.maps.d.ts +++ b/fusioncharts/fusioncharts.maps.d.ts @@ -1,7 +1,7 @@ -interface FusionCharts { - type: string; -} -declare var maps: (H: FusionCharts) => FusionCharts; +import { FusionChartStatic } from "fusioncharts"; + +declare var maps: (H: FusionChartStatic) => FusionChartStatic; export = maps; export as namespace maps; + diff --git a/fusioncharts/fusioncharts.powercharts.d.ts b/fusioncharts/fusioncharts.powercharts.d.ts index 432cc4ce24..46178c8b8f 100644 --- a/fusioncharts/fusioncharts.powercharts.d.ts +++ b/fusioncharts/fusioncharts.powercharts.d.ts @@ -1,7 +1,7 @@ -interface FusionCharts { - type: string; -} -declare var powercharts: (H: FusionCharts) => FusionCharts; +import { FusionChartStatic } from "fusioncharts"; + +declare var powercharts: (H: FusionChartStatic) => FusionChartStatic; export = powercharts; export as namespace powercharts; + diff --git a/fusioncharts/fusioncharts.ssgrid.d.ts b/fusioncharts/fusioncharts.ssgrid.d.ts index f74376410d..b44f5336c1 100644 --- a/fusioncharts/fusioncharts.ssgrid.d.ts +++ b/fusioncharts/fusioncharts.ssgrid.d.ts @@ -1,7 +1,7 @@ -interface FusionCharts { - type: string; -} -declare var ssgrid: (H: FusionCharts) => FusionCharts; +import { FusionChartStatic } from "fusioncharts"; + +declare var ssgrid: (H: FusionChartStatic) => FusionChartStatic; export = ssgrid; export as namespace ssgrid; + diff --git a/fusioncharts/fusioncharts.treemap.d.ts b/fusioncharts/fusioncharts.treemap.d.ts index f8f80059ed..c555a627bc 100644 --- a/fusioncharts/fusioncharts.treemap.d.ts +++ b/fusioncharts/fusioncharts.treemap.d.ts @@ -1,7 +1,7 @@ -interface FusionCharts { - type: string; -} -declare var treemap: (H: FusionCharts) => FusionCharts; +import { FusionChartStatic } from "fusioncharts"; + +declare var treemap: (H: FusionChartStatic) => FusionChartStatic; export = treemap; export as namespace treemap; + diff --git a/fusioncharts/fusioncharts.widgets.d.ts b/fusioncharts/fusioncharts.widgets.d.ts index 052216721d..a4547b99b7 100644 --- a/fusioncharts/fusioncharts.widgets.d.ts +++ b/fusioncharts/fusioncharts.widgets.d.ts @@ -1,7 +1,7 @@ -interface FusionCharts { - type: string; -} -declare var widgets: (H: FusionCharts) => FusionCharts; +import { FusionChartStatic } from "fusioncharts"; + +declare var widgets: (H: FusionChartStatic) => FusionChartStatic; export = widgets; export as namespace widgets; + diff --git a/fusioncharts/fusioncharts.zoomscatter.d.ts b/fusioncharts/fusioncharts.zoomscatter.d.ts index 07e58585bb..106908b6df 100644 --- a/fusioncharts/fusioncharts.zoomscatter.d.ts +++ b/fusioncharts/fusioncharts.zoomscatter.d.ts @@ -1,7 +1,7 @@ -interface FusionCharts { - type: string; -} -declare var zoomscatter: (H: FusionCharts) => FusionCharts; +import { FusionChartStatic } from "fusioncharts"; + +declare var zoomscatter: (H: FusionChartStatic) => FusionChartStatic; export = zoomscatter; export as namespace zoomscatter; + diff --git a/fusioncharts/maps/fusioncharts.usa.d.ts b/fusioncharts/maps/fusioncharts.usa.d.ts index 159ad8ab80..16ed0d6c91 100644 --- a/fusioncharts/maps/fusioncharts.usa.d.ts +++ b/fusioncharts/maps/fusioncharts.usa.d.ts @@ -1,7 +1,7 @@ -interface FusionCharts { - type: string; -} -declare var usa: (H: FusionCharts) => FusionCharts; +import { FusionChartStatic } from "fusioncharts"; + +declare var usa: (H: FusionChartStatic) => FusionChartStatic; export = usa; export as namespace usa; + diff --git a/fusioncharts/maps/fusioncharts.world.d.ts b/fusioncharts/maps/fusioncharts.world.d.ts index 889afc5a7d..3e545e2556 100644 --- a/fusioncharts/maps/fusioncharts.world.d.ts +++ b/fusioncharts/maps/fusioncharts.world.d.ts @@ -1,7 +1,7 @@ -interface FusionCharts { - type: string; -} -declare var world: (H: FusionCharts) => FusionCharts; +import { FusionChartStatic } from "fusioncharts"; + +declare var world: (H: FusionChartStatic) => FusionChartStatic; export = world; export as namespace world; + diff --git a/fusioncharts/themes/fusioncharts.theme.carbon.d.ts b/fusioncharts/themes/fusioncharts.theme.carbon.d.ts index 0be2ca7334..79ba171231 100644 --- a/fusioncharts/themes/fusioncharts.theme.carbon.d.ts +++ b/fusioncharts/themes/fusioncharts.theme.carbon.d.ts @@ -1,7 +1,7 @@ -interface FusionCharts { - type: string; -} -declare var carbon: (H: FusionCharts) => FusionCharts; +import { FusionChartStatic } from "fusioncharts"; + +declare var carbon: (H: FusionChartStatic) => FusionChartStatic; export = carbon; export as namespace carbon; + diff --git a/fusioncharts/themes/fusioncharts.theme.fint.d.ts b/fusioncharts/themes/fusioncharts.theme.fint.d.ts index 8c76253ee6..cee08aa6b2 100644 --- a/fusioncharts/themes/fusioncharts.theme.fint.d.ts +++ b/fusioncharts/themes/fusioncharts.theme.fint.d.ts @@ -1,7 +1,7 @@ -interface FusionCharts { - type: string; -} -declare var fint: (H: FusionCharts) => FusionCharts; +import { FusionChartStatic } from "fusioncharts"; + +declare var fint: (H: FusionChartStatic) => FusionChartStatic; export = fint; export as namespace fint; + diff --git a/fusioncharts/themes/fusioncharts.theme.ocean.d.ts b/fusioncharts/themes/fusioncharts.theme.ocean.d.ts index f0dd57aa03..8b7e3828c0 100644 --- a/fusioncharts/themes/fusioncharts.theme.ocean.d.ts +++ b/fusioncharts/themes/fusioncharts.theme.ocean.d.ts @@ -1,7 +1,7 @@ -interface FusionCharts { - type: string; -} -declare var ocean: (H: FusionCharts) => FusionCharts; +import { FusionChartStatic } from "fusioncharts"; + +declare var ocean: (H: FusionChartStatic) => FusionChartStatic; export = ocean; export as namespace ocean; + diff --git a/fusioncharts/themes/fusioncharts.theme.zune.d.ts b/fusioncharts/themes/fusioncharts.theme.zune.d.ts index 23c04014c7..06ab4c1787 100644 --- a/fusioncharts/themes/fusioncharts.theme.zune.d.ts +++ b/fusioncharts/themes/fusioncharts.theme.zune.d.ts @@ -1,7 +1,7 @@ -interface FusionCharts { - type: string; -} -declare var zune: (H: FusionCharts) => FusionCharts; +import { FusionChartStatic } from "fusioncharts"; + +declare var zune: (H: FusionChartStatic) => FusionChartStatic; export = zune; export as namespace zune; + From 91647767d2fff5cd269631f9d1eeb2681cfc8d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Kl=C3=B6pf?= Date: Mon, 6 Feb 2017 10:23:50 +0100 Subject: [PATCH 46/55] Fix definitions of serialport --- serialport/index.d.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/serialport/index.d.ts b/serialport/index.d.ts index 60c240bbda..d94ab9d79f 100644 --- a/serialport/index.d.ts +++ b/serialport/index.d.ts @@ -1,24 +1,24 @@ -// Type definitions for serialport 4.0.1 +// Type definitions for serialport 4.0 // Project: https://github.com/EmergingTechnologyAdvisors/node-serialport // Definitions by: Jeremy Foster // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module 'serialport' { class SerialPort { - constructor(path: string, options?: Object, openImmediately?: boolean, callback?: (err: string) => void) - isOpen: boolean; + constructor(path: string, options?: Object, openImmediately?: boolean, callback?: (err: any) => void) + isOpen(): boolean; on(event: string, callback?: (data?: any) => void): void; - open(callback?: () => void): void; - write(buffer: any, callback?: (err: string, bytesWritten: number) => void): void + open(callback?: (err: any) => void): void; + write(buffer: any, callback?: (err: any, bytesWritten: number) => void): void pause(): void; resume(): void; disconnected(err: Error): void; - close(callback?: (err:any) => void): void; - flush(callback?: (err:any) => void): void; - set(options: SerialPort.setOptions, callback: () => void): void; - drain(callback?: (err:any) => void): void; - update(options: SerialPort.updateOptions, callback?: () => void): void; - static list(callback: (err: string, ports: SerialPort.portConfig[]) => void): void; + close(callback?: (err: any) => void): void; + flush(callback?: (err: any) => void): void; + set(options: SerialPort.setOptions, callback: (err: any) => void): void; + drain(callback?: (err: any) => void): void; + update(options: SerialPort.updateOptions, callback?: (err: any) => void): void; + static list(callback: (err: any, ports: SerialPort.portConfig[]) => void): void; static parsers: { readline: (delimiter: string) => void, raw: (emitter: any, buffer: string) => void @@ -49,5 +49,5 @@ declare module 'serialport' { } } - export = SerialPort + export = SerialPort; } From b8b063f64b46dbec26bf792b8928060ffe2af7b6 Mon Sep 17 00:00:00 2001 From: Victor Widell Date: Mon, 6 Feb 2017 11:47:15 +0100 Subject: [PATCH 47/55] Made overloads work with union types. https://github.com/Microsoft/TypeScript/issues/1805 --- pg/index.d.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pg/index.d.ts b/pg/index.d.ts index 75f3f33dd5..b819d6b66b 100644 --- a/pg/index.d.ts +++ b/pg/index.d.ts @@ -96,11 +96,10 @@ export declare class Client extends events.EventEmitter { end(callback?: (err: Error) => void): void; release(): void; - query(queryText: string): Promise; + query(queryTextOrConfig: string | QueryConfig): Promise; query(queryText: string, values: any[]): Promise; - query(queryText: string, callback?: (err: Error, result: QueryResult) => void): Query; - query(config: QueryConfig, callback?: (err: Error, result: QueryResult) => void): Query; + query(queryTextOrConfig: string | QueryConfig, callback?: (err: Error, result: QueryResult) => void): Query; query(queryText: string, values: any[], callback?: (err: Error, result: QueryResult) => void): Query; copyFrom(queryText: string): stream.Writable; From 04f5827aca02436a55129eef6b010e653345e590 Mon Sep 17 00:00:00 2001 From: Bradley Ayers Date: Mon, 6 Feb 2017 23:41:24 +1100 Subject: [PATCH 48/55] Add 'index' parameter to fn in .map and .forEach MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Map — https://github.com/airbnb/enzyme/blob/master/docs/api/ShallowWrapper/map.md - forEach — https://github.com/airbnb/enzyme/blob/master/docs/api/ShallowWrapper/forEach.md --- enzyme/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/enzyme/index.d.ts b/enzyme/index.d.ts index 5502b0eb85..eb77ce21eb 100644 --- a/enzyme/index.d.ts +++ b/enzyme/index.d.ts @@ -329,7 +329,7 @@ interface CommonWrapper { * @param fn A callback to be run for every node in the collection. Should expect a ShallowWrapper as the first * argument, and will be run with a context of the original instance. */ - forEach(fn: (wrapper: this) => any): this; + forEach(fn: (wrapper: this, index: number) => any): this; /** * Maps the current array of nodes to another array. Each node is passed in as a ShallowWrapper to the map @@ -339,7 +339,7 @@ interface CommonWrapper { * to the returned array. Should expect a ShallowWrapper as the first argument, and will be run * with a context of the original instance. */ - map(fn: (wrapper: this) => V): V[]; + map(fn: (wrapper: this, index: number) => V): V[]; /** * Applies the provided reducing function to every node in the wrapper to reduce to a single value. Each node From dff9fc5ff457c38d71db4766f4373ded428d4fcf Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Mon, 6 Feb 2017 23:53:51 +0900 Subject: [PATCH 49/55] =?UTF-8?q?Refer=20.md=20file=20directly=20to=20redu?= =?UTF-8?q?ce=20heavy=C2=A0load?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The main page of DefinitlyTyped is heavy because of the long list of types. Linking directly to the .md files can help. --- PULL_REQUEST_TEMPLATE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index 4d9a7aab6f..1fc8897d23 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -3,8 +3,8 @@ Please fill in this template. - [ ] Make your PR against the `master` branch. - [ ] Use a meaningful title for the pull request. Include the name of the package modified. - [ ] Test the change in your own code. (Compile and run.) -- [ ] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped#make-a-pull-request). -- [ ] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped#common-mistakes). +- [ ] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#make-a-pull-request). +- [ ] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#common-mistakes). - [ ] Run `tsc` without errors. - [ ] Run `npm run lint package-name` if a `tslint.json` is present. From 9d060ae3fac10cecc5c3121fd6b3b7263193a6e0 Mon Sep 17 00:00:00 2001 From: Ville Saarinen Date: Mon, 6 Feb 2017 17:15:28 +0200 Subject: [PATCH 50/55] Third parameter to branch() should be optional This is in line with the API documentation, e.g. the example for renderComponent(): https://github.com/acdlite/recompose/blob/master/docs/API.md#rendercomponent --- recompose/index.d.ts | 2 +- recompose/recompose-tests.tsx | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/recompose/index.d.ts b/recompose/index.d.ts index e72302415f..bed45744aa 100644 --- a/recompose/index.d.ts +++ b/recompose/index.d.ts @@ -103,7 +103,7 @@ declare module 'recompose' { export function branch( test: predicate, trueEnhancer: InferableComponentEnhancer, - falseEnhancer: InferableComponentEnhancer + falseEnhancer?: InferableComponentEnhancer ): ComponentEnhancer; // renderComponent: https://github.com/acdlite/recompose/blob/master/docs/API.md#renderComponent diff --git a/recompose/recompose-tests.tsx b/recompose/recompose-tests.tsx index 25b52d70b0..c4c66b3e2c 100644 --- a/recompose/recompose-tests.tsx +++ b/recompose/recompose-tests.tsx @@ -148,13 +148,19 @@ function testBranch() { const innerComponent: React.StatelessComponent = (props: InnerProps) =>
props.update()}>{props.count}
; + const innerComponent2 = () =>
Hello
; const enhancer = branch( (props: OutterProps) => props.toggled, withState("count", "update", 0), withState("count", "update", 100) ); + const enhancer2 = branch( + (props: OutterProps) => props.toggled, + renderComponent(innerComponent), + ) const enhanced: React.ComponentClass = enhancer(innerComponent); + const enhanced2: React.ComponentClass = enhancer2(innerComponent); } function testRenderComponent() { From dffc2b7078db3295252a646dce2697a00552f1a3 Mon Sep 17 00:00:00 2001 From: Ville Saarinen Date: Mon, 6 Feb 2017 17:19:33 +0200 Subject: [PATCH 51/55] Increase version number --- recompose/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recompose/index.d.ts b/recompose/index.d.ts index bed45744aa..3ff504fab3 100644 --- a/recompose/index.d.ts +++ b/recompose/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Recompose v0.20.2 +// Type definitions for Recompose v0.20.3 // Project: https://github.com/acdlite/recompose // Definitions by: Iskander Sierra // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 6fd8c5eecd1bbfc55fc1379edb91e549b8fe741a Mon Sep 17 00:00:00 2001 From: z21cdevo Date: Mon, 6 Feb 2017 17:38:11 +0100 Subject: [PATCH 52/55] use correct settings exdends from daterangepicker definition --- react-bootstrap-daterangepicker/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/react-bootstrap-daterangepicker/index.d.ts b/react-bootstrap-daterangepicker/index.d.ts index e2ac7d49c6..baec72795b 100644 --- a/react-bootstrap-daterangepicker/index.d.ts +++ b/react-bootstrap-daterangepicker/index.d.ts @@ -5,12 +5,13 @@ // TypeScript Version: 2.1 /// -/// +/// declare namespace ReactBootstrapDaterangepicker { + export interface EventHandler { (event?: any, picker?: any): any; } - export interface Props extends DatepickerOptions { + export interface Props extends daterangepicker.Settings{ onShow?: EventHandler; onHide?: EventHandler; onShowCalendar?: EventHandler; From a3dd726ba33d460a539488394e2b286b0dea9669 Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Mon, 6 Feb 2017 17:05:14 -0800 Subject: [PATCH 53/55] Revert "Fix #11566 allows SFC to return null" This reverts commit 81730dfd225b778bfd0f0a7e1524899a372ad37c. --- react/index.d.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/react/index.d.ts b/react/index.d.ts index f25e5c0afd..e39c8c7026 100644 --- a/react/index.d.ts +++ b/react/index.d.ts @@ -204,7 +204,7 @@ declare namespace React { type SFC

= StatelessComponent

; interface StatelessComponent

{ - (props: P & { children?: ReactNode }, context?: any): ReactElement | null; + (props: P & { children?: ReactNode }, context?: any): ReactElement; propTypes?: ValidationMap

; contextTypes?: ValidationMap; defaultProps?: P; @@ -2628,9 +2628,7 @@ declare namespace React { declare global { namespace JSX { - interface JSXElement extends React.ReactElement { } - type Element = JSXElement | null; - + interface Element extends React.ReactElement { } interface ElementClass extends React.Component { render(): JSX.Element; } From 47f5a06ab00097373ee387f9b5ebad6d90d9cae9 Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Mon, 6 Feb 2017 17:05:24 -0800 Subject: [PATCH 54/55] Revert "Add tests and fix broken test" This reverts commit d79f340d574873ca4deabd545ee4b9fdab1164ec. --- react-day-picker/index.d.ts | 2 +- react-dom/index.d.ts | 4 ++-- react-input-mask/index.d.ts | 2 +- react-native-scrollable-tab-view/index.d.ts | 18 +++++++++--------- .../react-native-swiper-tests.tsx | 2 +- react/index.d.ts | 4 ++-- react/test/tsx.tsx | 3 --- 7 files changed, 16 insertions(+), 19 deletions(-) diff --git a/react-day-picker/index.d.ts b/react-day-picker/index.d.ts index f2993d95c5..01c5492922 100644 --- a/react-day-picker/index.d.ts +++ b/react-day-picker/index.d.ts @@ -75,7 +75,7 @@ declare namespace ReactDayPicker { toMonth?: Date; localeUtils?: LocaleUtils; locale?: string; - captionElement?: React.ReactElement | null; + captionElement?: React.ReactElement; onDayClick?: (e: React.SyntheticEvent<{}>, day: Date, modifiers: DayModifiers) => any; onDayTouchTap?: (e: React.SyntheticEvent<{}>, day: Date, modifiers: DayModifiers) => any; onDayMouseEnter?: (e: React.SyntheticEvent<{}>, day: Date, modifiers: DayModifiers) => any; diff --git a/react-dom/index.d.ts b/react-dom/index.d.ts index bf0a246211..00520fc6ed 100644 --- a/react-dom/index.d.ts +++ b/react-dom/index.d.ts @@ -28,7 +28,7 @@ declare namespace ReactDOM { container: Element | null, callback?: (component: T) => any): T; function render

( - element: ReactElement

| null, + element: ReactElement

, container: Element | null, callback?: (component?: Component | Element) => any): Component | Element | void; @@ -57,7 +57,7 @@ declare namespace ReactDOM { callback?: () => any): void; function unstable_renderSubtreeIntoContainer

( parentComponent: Component, - element: ReactElement

| null, + element: ReactElement

, container: Element, callback?: (component?: Component | Element) => any): Component | Element | void; } diff --git a/react-input-mask/index.d.ts b/react-input-mask/index.d.ts index c6acce5858..6fc8c6008f 100644 --- a/react-input-mask/index.d.ts +++ b/react-input-mask/index.d.ts @@ -13,7 +13,7 @@ declare namespace reactInputMask { * * `9`: `0-9` * * `a`: `A-Z, a-z` * * `\*`: `A-Z, a-z, 0-9` - * + * * Any character can be escaped with backslash, which usually will appear as double backslash in JS strings. For example, German phone mask with unremoveable prefix +49 will look like `mask="+4\\9 99 999 99"` or `mask={"+4\\\\9 99 999 99"}` */ mask: string; diff --git a/react-native-scrollable-tab-view/index.d.ts b/react-native-scrollable-tab-view/index.d.ts index 9287ede79d..2f22f1bcf4 100644 --- a/react-native-scrollable-tab-view/index.d.ts +++ b/react-native-scrollable-tab-view/index.d.ts @@ -37,9 +37,9 @@ export interface renderTabBarProperties { interface ScrollableTabViewProperties extends React.Props { /** - * tabBarPosition (String) Defaults to "top". + * tabBarPosition (String) Defaults to "top". * "bottom" to position the tab bar below content. - * "overlayTop" or "overlayBottom" for a semitransparent tab bar that overlays content. Custom + * "overlayTop" or "overlayBottom" for a semitransparent tab bar that overlays content. Custom * tab bars must consume a style prop on their outer element to support this feature: style={this.props.style}. */ tabBarPosition?: 'top' | 'bottom' | 'overlayTop' | 'overlayBottom'; @@ -50,27 +50,27 @@ interface ScrollableTabViewProperties extends React.Props { initialPage?: number; /** - * (Integer) - set selected tab(can be buggy see + * (Integer) - set selected tab(can be buggy see * https://github.com/skv-headless/react-native-scrollable-tab-view/issues/126 */ page?: number; /** - * onChangeTab (Function) - function to call when tab changes, should accept 1 argument which is - * an Object containing two keys: i: the index of the tab that is selected, ref: the ref of the + * onChangeTab (Function) - function to call when tab changes, should accept 1 argument which is + * an Object containing two keys: i: the index of the tab that is selected, ref: the ref of the * tab that is selected */ onChangeTab?: (value: onChangeTabProperties) => void; /** - * onScroll (Function) - function to call when the pages are sliding, + * onScroll (Function) - function to call when the pages are sliding, * should accept 1 argument which is an Float number representing the page position in the slide frame. */ onScroll?: (value: number) => void; /** * renderTabBar (Function:ReactComponent) - accept 1 argument props and should return a component - * to use as the tab bar. The component has goToPage, tabs, activeTab and ref added to the props, + * to use as the tab bar. The component has goToPage, tabs, activeTab and ref added to the props, * and should implement setAnimationValue to be able to animate itself along with the tab content. * You can manually pass the props to the TabBar component. */ @@ -82,7 +82,7 @@ interface ScrollableTabViewProperties extends React.Props { style?: ViewStyle; /** - * contentProps (Object) - props that are applied to root ScrollView/ViewPagerAndroid. + * contentProps (Object) - props that are applied to root ScrollView/ViewPagerAndroid. * Note that overriding defaults set by the library may break functionality; see the source for details. */ contentProps?: React.ScrollViewProperties; @@ -98,7 +98,7 @@ interface ScrollableTabViewProperties extends React.Props { locked?: boolean; /** - * prerenderingSiblingsNumber (Integer) - pre-render nearby # sibling, Infinity === render all + * prerenderingSiblingsNumber (Integer) - pre-render nearby # sibling, Infinity === render all * the siblings, default to 0 === render current page. */ prerenderingSiblingsNumber?: number; diff --git a/react-native-swiper/react-native-swiper-tests.tsx b/react-native-swiper/react-native-swiper-tests.tsx index c8dae8511e..93cdfcfd18 100644 --- a/react-native-swiper/react-native-swiper-tests.tsx +++ b/react-native-swiper/react-native-swiper-tests.tsx @@ -18,7 +18,7 @@ class SwiperTest extends React.Component { super(props); } - public render(): React.ReactElement | null { + public render(): React.ReactElement { return ( diff --git a/react/index.d.ts b/react/index.d.ts index e39c8c7026..001484aa15 100644 --- a/react/index.d.ts +++ b/react/index.d.ts @@ -171,7 +171,7 @@ declare namespace React { setState(f: (prevState: S, props: P) => Pick, callback?: () => any): void; setState(state: Pick, callback?: () => any): void; forceUpdate(callBack?: () => any): void; - render(): JSX.Element; + render(): JSX.Element | null; // React.Props is now deprecated, which means that the `children` // property is not available on `P` by default, even though you can @@ -2630,7 +2630,7 @@ declare global { namespace JSX { interface Element extends React.ReactElement { } interface ElementClass extends React.Component { - render(): JSX.Element; + render(): JSX.Element | null; } interface ElementAttributesProperty { props: {}; } diff --git a/react/test/tsx.tsx b/react/test/tsx.tsx index 0b0bc096ae..0531cb52c0 100644 --- a/react/test/tsx.tsx +++ b/react/test/tsx.tsx @@ -32,6 +32,3 @@ StatelessComponent2.defaultProps = { ; - -const CustomComponent = (props: { flag: boolean }) => props.flag ? React.createElement('div') : null; -const UseComponent2 = (f: boolean) => ; From e791b291058bc8e9e7e5e3c4690f32124ea77b36 Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Mon, 6 Feb 2017 17:54:17 -0800 Subject: [PATCH 55/55] Fix trailing whitespace that broke test --- react-input-mask/index.d.ts | 2 +- react-native-scrollable-tab-view/index.d.ts | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/react-input-mask/index.d.ts b/react-input-mask/index.d.ts index 6fc8c6008f..c6acce5858 100644 --- a/react-input-mask/index.d.ts +++ b/react-input-mask/index.d.ts @@ -13,7 +13,7 @@ declare namespace reactInputMask { * * `9`: `0-9` * * `a`: `A-Z, a-z` * * `\*`: `A-Z, a-z, 0-9` - * + * * Any character can be escaped with backslash, which usually will appear as double backslash in JS strings. For example, German phone mask with unremoveable prefix +49 will look like `mask="+4\\9 99 999 99"` or `mask={"+4\\\\9 99 999 99"}` */ mask: string; diff --git a/react-native-scrollable-tab-view/index.d.ts b/react-native-scrollable-tab-view/index.d.ts index 2f22f1bcf4..9287ede79d 100644 --- a/react-native-scrollable-tab-view/index.d.ts +++ b/react-native-scrollable-tab-view/index.d.ts @@ -37,9 +37,9 @@ export interface renderTabBarProperties { interface ScrollableTabViewProperties extends React.Props { /** - * tabBarPosition (String) Defaults to "top". + * tabBarPosition (String) Defaults to "top". * "bottom" to position the tab bar below content. - * "overlayTop" or "overlayBottom" for a semitransparent tab bar that overlays content. Custom + * "overlayTop" or "overlayBottom" for a semitransparent tab bar that overlays content. Custom * tab bars must consume a style prop on their outer element to support this feature: style={this.props.style}. */ tabBarPosition?: 'top' | 'bottom' | 'overlayTop' | 'overlayBottom'; @@ -50,27 +50,27 @@ interface ScrollableTabViewProperties extends React.Props { initialPage?: number; /** - * (Integer) - set selected tab(can be buggy see + * (Integer) - set selected tab(can be buggy see * https://github.com/skv-headless/react-native-scrollable-tab-view/issues/126 */ page?: number; /** - * onChangeTab (Function) - function to call when tab changes, should accept 1 argument which is - * an Object containing two keys: i: the index of the tab that is selected, ref: the ref of the + * onChangeTab (Function) - function to call when tab changes, should accept 1 argument which is + * an Object containing two keys: i: the index of the tab that is selected, ref: the ref of the * tab that is selected */ onChangeTab?: (value: onChangeTabProperties) => void; /** - * onScroll (Function) - function to call when the pages are sliding, + * onScroll (Function) - function to call when the pages are sliding, * should accept 1 argument which is an Float number representing the page position in the slide frame. */ onScroll?: (value: number) => void; /** * renderTabBar (Function:ReactComponent) - accept 1 argument props and should return a component - * to use as the tab bar. The component has goToPage, tabs, activeTab and ref added to the props, + * to use as the tab bar. The component has goToPage, tabs, activeTab and ref added to the props, * and should implement setAnimationValue to be able to animate itself along with the tab content. * You can manually pass the props to the TabBar component. */ @@ -82,7 +82,7 @@ interface ScrollableTabViewProperties extends React.Props { style?: ViewStyle; /** - * contentProps (Object) - props that are applied to root ScrollView/ViewPagerAndroid. + * contentProps (Object) - props that are applied to root ScrollView/ViewPagerAndroid. * Note that overriding defaults set by the library may break functionality; see the source for details. */ contentProps?: React.ScrollViewProperties; @@ -98,7 +98,7 @@ interface ScrollableTabViewProperties extends React.Props { locked?: boolean; /** - * prerenderingSiblingsNumber (Integer) - pre-render nearby # sibling, Infinity === render all + * prerenderingSiblingsNumber (Integer) - pre-render nearby # sibling, Infinity === render all * the siblings, default to 0 === render current page. */ prerenderingSiblingsNumber?: number;