From 076d8cafb4f6b8bf3928250d9a0a695dbee522c3 Mon Sep 17 00:00:00 2001 From: Gareth Parker Date: Thu, 19 Apr 2018 20:56:31 +0100 Subject: [PATCH 01/53] Glue - Fix to plugins --- types/glue/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/glue/index.d.ts b/types/glue/index.d.ts index 8e710d233a..d1bf010ffe 100644 --- a/types/glue/index.d.ts +++ b/types/glue/index.d.ts @@ -24,7 +24,7 @@ export interface Plugin { export interface Manifest { server: ServerOptions; register?: { - plugins: Plugin[] + plugins: string | Plugin[] }; } From f9810f1caa738e724cfdc07533c139486cbf5146 Mon Sep 17 00:00:00 2001 From: Gareth Parker Date: Fri, 20 Apr 2018 21:25:56 +0100 Subject: [PATCH 02/53] Plugins can now be string arrays rather that just strings --- types/glue/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/glue/index.d.ts b/types/glue/index.d.ts index d1bf010ffe..f347e69746 100644 --- a/types/glue/index.d.ts +++ b/types/glue/index.d.ts @@ -24,7 +24,7 @@ export interface Plugin { export interface Manifest { server: ServerOptions; register?: { - plugins: string | Plugin[] + plugins: string[] | Plugin[] }; } From 2e4d7a47cab30d7620498811dd0e7d266aaf7df7 Mon Sep 17 00:00:00 2001 From: "Jon.Hallander" Date: Wed, 2 May 2018 13:45:52 -0400 Subject: [PATCH 03/53] missing methods Added missing methods to pki namespace. --- types/node-forge/index.d.ts | 2 ++ types/node-forge/node-forge-tests.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/types/node-forge/index.d.ts b/types/node-forge/index.d.ts index 2784d95fa3..f177f36d5c 100644 --- a/types/node-forge/index.d.ts +++ b/types/node-forge/index.d.ts @@ -43,7 +43,9 @@ declare module "node-forge" { privateKey: Key; } + function pemToDer(pem: PEM): util.ByteStringBuffer; function privateKeyToPem(key: Key, maxline?: number): PEM; + function privateKeyInfoToPem(key: Key, maxline?: number): PEM; function publicKeyToPem(key: Key, maxline?: number): PEM; function publicKeyFromPem(pem: PEM): Key; function privateKeyFromPem(pem: PEM): Key; diff --git a/types/node-forge/node-forge-tests.ts b/types/node-forge/node-forge-tests.ts index 29b8267714..a5487ed027 100644 --- a/types/node-forge/node-forge-tests.ts +++ b/types/node-forge/node-forge-tests.ts @@ -8,6 +8,8 @@ let x: string = forge.ssh.privateKeyToOpenSSH(key); let pemKey: forge.pki.PEM = publicKeyPem; let publicKeyRsa = forge.pki.publicKeyFromPem(pemKey); let privateKeyRsa = forge.pki.privateKeyFromPem(privateKeyPem); +let privateKeyRsa2 = forge.pki.privateKeyInfoToPem(privateKeyPem); +let byteBufferString = forge.pki.pemToDer(privateKeyRsa); let cert = forge.pki.createCertificate(); { From ffa30195c0348582068cc673fe0d36c4b798bed2 Mon Sep 17 00:00:00 2001 From: "Jon.Hallander" Date: Wed, 2 May 2018 14:18:28 -0400 Subject: [PATCH 04/53] Updated node-forge release number The node-forge I updated against is 0.7.5 --- types/node-forge/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/node-forge/index.d.ts b/types/node-forge/index.d.ts index f177f36d5c..dafed52047 100644 --- a/types/node-forge/index.d.ts +++ b/types/node-forge/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for node-forge 0.7.2 +// Type definitions for node-forge 0.7.5 // Project: https://github.com/digitalbazaar/forge // Definitions by: Seth Westphal // Kay Schecker From fdb0cdc4ad2d860ef02bcf3e4db1c4edbc733f98 Mon Sep 17 00:00:00 2001 From: Gerhard Stoebich Date: Tue, 8 May 2018 15:55:39 +0200 Subject: [PATCH 05/53] [node] Add some NodeJS 10 changes --- types/node/index.d.ts | 20 +++++++++++++++----- types/node/node-tests.ts | 1 + 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 12c9551bec..762b0f6be6 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -561,6 +561,7 @@ declare namespace NodeJS { on(event: string | symbol, listener: (...args: any[]) => void): this; once(event: string | symbol, listener: (...args: any[]) => void): this; removeListener(event: string | symbol, listener: (...args: any[]) => void): this; + off(event: string | symbol, listener: (...args: any[]) => void): this; removeAllListeners(event?: string | symbol): this; setMaxListeners(n: number): this; getMaxListeners(): number; @@ -1004,7 +1005,8 @@ declare module "events" { namespace internal { export class EventEmitter extends internal { - static listenerCount(emitter: EventEmitter, event: string | symbol): number; // deprecated + /** @deprecated since v4.0.0 */ + static listenerCount(emitter: EventEmitter, event: string | symbol): number; static defaultMaxListeners: number; addListener(event: string | symbol, listener: (...args: any[]) => void): this; @@ -1013,6 +1015,7 @@ declare module "events" { prependListener(event: string | symbol, listener: (...args: any[]) => void): this; prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; removeListener(event: string | symbol, listener: (...args: any[]) => void): this; + off(event: string | symbol, listener: (...args: any[]) => void): this; removeAllListeners(event?: string | symbol): this; setMaxListeners(n: number): this; getMaxListeners(): number; @@ -5732,6 +5735,8 @@ declare module "crypto" { digest(): Buffer; digest(encoding: HexBase64Latin1Encoding): string; } + + /** @deprecated since v10.0.0 use createCipheriv() */ export function createCipher(algorithm: string, password: any): Cipher; export function createCipheriv(algorithm: string, key: any, iv: any): Cipher; export interface Cipher extends NodeJS.ReadWriteStream { @@ -5745,6 +5750,7 @@ declare module "crypto" { getAuthTag(): Buffer; setAAD(buffer: Buffer): this; } + /** @deprecated since v10.0.0 use createCipheriv() */ export function createDecipher(algorithm: string, password: any): Decipher; export function createDecipheriv(algorithm: string, key: any, iv: any): Decipher; export interface Decipher extends NodeJS.ReadWriteStream { @@ -5830,17 +5836,16 @@ declare module "crypto" { export function getCurves(): string[]; export function getHashes(): string[]; export interface ECDH { + convertKey(key: string | Buffer /*| TypedArray*/ | DataView, curve: string, inputEncoding?: string, outputEncoding?: string, format?: string): Buffer | string; generateKeys(): Buffer; - generateKeys(encoding: HexBase64Latin1Encoding): string; - generateKeys(encoding: HexBase64Latin1Encoding, format: ECDHKeyFormat): string; + generateKeys(encoding: HexBase64Latin1Encoding, format?: ECDHKeyFormat): string; computeSecret(other_public_key: Buffer): Buffer; computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding): Buffer; computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding, output_encoding: HexBase64Latin1Encoding): string; getPrivateKey(): Buffer; getPrivateKey(encoding: HexBase64Latin1Encoding): string; getPublicKey(): Buffer; - getPublicKey(encoding: HexBase64Latin1Encoding): string; - getPublicKey(encoding: HexBase64Latin1Encoding, format: ECDHKeyFormat): string; + getPublicKey(encoding: HexBase64Latin1Encoding, format?: ECDHKeyFormat): string; setPrivateKey(private_key: Buffer): void; setPrivateKey(private_key: string, encoding: HexBase64Latin1Encoding): void; } @@ -6257,11 +6262,16 @@ declare module "assert" { } export function fail(message: string): never; + /** @deprecated since v10.0.0 */ export function fail(actual: any, expected: any, message?: string, operator?: string): never; export function ok(value: any, message?: string): void; + /** @deprecated use strictEqual() */ export function equal(actual: any, expected: any, message?: string): void; + /** @deprecated use notStrictEqual() */ export function notEqual(actual: any, expected: any, message?: string): void; + /** @deprecated use deepStrictEqual() */ export function deepEqual(actual: any, expected: any, message?: string): void; + /** @deprecated use notDeepStrictEqual() */ export function notDeepEqual(acutal: any, expected: any, message?: string): void; export function strictEqual(actual: any, expected: any, message?: string): void; export function notStrictEqual(actual: any, expected: any, message?: string): void; diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index efc00ef201..5d9c80c168 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -109,6 +109,7 @@ namespace events_tests { result = emitter.prependListener(event, listener); result = emitter.prependOnceListener(event, listener); result = emitter.removeListener(event, listener); + result = emitter.off(event, listener); result = emitter.removeAllListeners(); result = emitter.removeAllListeners(event); result = emitter.setMaxListeners(42); From 0913d50a3c465569a601b5c05989344c468a474d Mon Sep 17 00:00:00 2001 From: Sam Walsh Date: Thu, 10 May 2018 15:05:36 +1200 Subject: [PATCH 06/53] [react-content-loader] Introduce `primaryOpacity` and `secondaryOpacity` props + bump version to 3.1.2 --- types/react-content-loader/index.d.ts | 35 +++++++++++++++---- .../react-content-loader-tests.tsx | 8 +++-- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/types/react-content-loader/index.d.ts b/types/react-content-loader/index.d.ts index 21f58664ca..8f677125c1 100644 --- a/types/react-content-loader/index.d.ts +++ b/types/react-content-loader/index.d.ts @@ -1,22 +1,43 @@ -// Type definitions for react-content-loader 2.0 +// Type definitions for react-content-loader 3.1.2 // Project: https://github.com/danilowoz/react-content-loader // Definitions by: Alaa Masoud // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 -import * as React from 'react'; +import * as React from "react"; export interface ContentLoaderProps { style?: React.CSSProperties; - type?: 'facebook' | 'instagram' | 'list' | 'bullet-list' | 'code'; + type?: "facebook" | "instagram" | "list" | "bullet-list" | "code"; speed?: number; width?: number; height?: number; primaryColor?: string; secondaryColor?: string; - preserveAspectRatio?: 'none' | 'xMinYMin meet' | 'xMidYMin meet' | 'xMaxYMin meet' | 'xMinYMid meet' | 'xMidYMid meet' | 'xMaxYMid meet' | - 'xMinYMax meet' | 'xMidYMax meet' | 'xMaxYMax meet' | 'xMinYMin slice' | 'xMidYMin slice' | 'xMaxYMin slice' | 'xMinYMid slice' | - 'xMidYMid slice' | 'xMaxYMid slice' | 'xMinYMax slice' | 'xMidYMax slice' | 'xMaxYMax slice'; + primaryOpacity?: number; + secondaryOpacity?: number; + preserveAspectRatio?: + | "none" + | "xMinYMin meet" + | "xMidYMin meet" + | "xMaxYMin meet" + | "xMinYMid meet" + | "xMidYMid meet" + | "xMaxYMid meet" + | "xMinYMax meet" + | "xMidYMax meet" + | "xMaxYMax meet" + | "xMinYMin slice" + | "xMidYMin slice" + | "xMaxYMin slice" + | "xMinYMid slice" + | "xMidYMid slice" + | "xMaxYMid slice" + | "xMinYMax slice" + | "xMidYMax slice" + | "xMaxYMax slice"; className?: string; } -export default class ContentLoader extends React.Component { } +export default class ContentLoader extends React.Component< + ContentLoaderProps +> {} diff --git a/types/react-content-loader/react-content-loader-tests.tsx b/types/react-content-loader/react-content-loader-tests.tsx index 4eeeecedc1..7ec300639c 100644 --- a/types/react-content-loader/react-content-loader-tests.tsx +++ b/types/react-content-loader/react-content-loader-tests.tsx @@ -1,15 +1,17 @@ -import * as React from 'react'; -import ContentLoader from 'react-content-loader'; +import * as React from "react"; +import ContentLoader from "react-content-loader"; const CustomComponent = () => { return ( From 87c10bee3de52d67cbf82387779c5dc880317230 Mon Sep 17 00:00:00 2001 From: Sam Walsh Date: Thu, 10 May 2018 15:11:09 +1200 Subject: [PATCH 07/53] Change to 3.1 instead of 3.1.2 --- types/react-content-loader/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-content-loader/index.d.ts b/types/react-content-loader/index.d.ts index 8f677125c1..21a3d7f3a5 100644 --- a/types/react-content-loader/index.d.ts +++ b/types/react-content-loader/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-content-loader 3.1.2 +// Type definitions for react-content-loader 3.1 // Project: https://github.com/danilowoz/react-content-loader // Definitions by: Alaa Masoud // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 5bd088f20f254368d4f3dc1a4287dabce8c20501 Mon Sep 17 00:00:00 2001 From: Sam Walsh Date: Thu, 10 May 2018 16:16:52 +1200 Subject: [PATCH 08/53] Add samwalshnz as contributor to react-content-loader --- types/react-content-loader/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-content-loader/index.d.ts b/types/react-content-loader/index.d.ts index 21a3d7f3a5..508d3eb719 100644 --- a/types/react-content-loader/index.d.ts +++ b/types/react-content-loader/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for react-content-loader 3.1 // Project: https://github.com/danilowoz/react-content-loader // Definitions by: Alaa Masoud +// Sam Walsh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 From 043c18633eb26b41cb403de2af680236b67b0eac Mon Sep 17 00:00:00 2001 From: denis Date: Thu, 10 May 2018 12:48:54 +0200 Subject: [PATCH 09/53] Add trim format specifier --- types/d3-format/d3-format-tests.ts | 1 + types/d3-format/index.d.ts | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/types/d3-format/d3-format-tests.ts b/types/d3-format/d3-format-tests.ts index 5ab53a45a7..5702870640 100644 --- a/types/d3-format/d3-format-tests.ts +++ b/types/d3-format/d3-format-tests.ts @@ -64,6 +64,7 @@ const zero: boolean = specifier.zero; const width: number | undefined = specifier.width; const comma: boolean = specifier.comma; const precision: number | undefined = specifier.precision; +const trim: boolean = specifier.trim; const type: 'e' | 'f' | 'g' | 'r' | 's' | '%' | 'p' | 'b' | 'o' | 'd' | 'x' | 'X' | 'c' | '' | 'n' = specifier.type; const formatString: string = specifier.toString(); diff --git a/types/d3-format/index.d.ts b/types/d3-format/index.d.ts index bb0473a4fb..0508606148 100644 --- a/types/d3-format/index.d.ts +++ b/types/d3-format/index.d.ts @@ -1,12 +1,12 @@ -// Type definitions for D3JS d3-format module 1.2 +// Type definitions for D3JS d3-format module 1.3 // Project: https://github.com/d3/d3-format/ // Definitions by: Tom Wanzek -// Alex Ford -// Boris Yankov -// denisname +// Alex Ford +// Boris Yankov +// denisname // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Last module patch version validated against: 1.2.0 +// Last module patch version validated against: 1.3.0 /** * Specification of locale to use when creating a new FormatLocaleObject @@ -124,6 +124,11 @@ export interface FormatSpecifier { * See precisionFixed and precisionRound for help picking an appropriate precision. */ precision: number | undefined; + /** + * The '~' option trims insignificant trailing zeros across all format types. + * This is most commonly used in conjunction with types 'r', 'e', 's' and '%'. + */ + trim: boolean; /** * The available type values are: * @@ -140,9 +145,9 @@ export interface FormatSpecifier { * 'x' - hexadecimal notation, using lower-case letters, rounded to integer. * 'X' - hexadecimal notation, using upper-case letters, rounded to integer. * 'c' - converts the integer to the corresponding unicode character before printing. - * '' (none) - like g, but trim insignificant trailing zeros. * - * The type 'n' is also supported as shorthand for ',g'. For the 'g', 'n' and '' (none) types, + * The type '' (none) is also supported as shorthand for '~g' (with a default precision of 12 instead of 6), and + * the type 'n' is shorthand for ',g'. For the 'g', 'n' and '' (none) types, * decimal notation is used if the resulting string would have precision or fewer digits; otherwise, exponent notation is used. */ type: 'e' | 'f' | 'g' | 'r' | 's' | '%' | 'p' | 'b' | 'o' | 'd' | 'x' | 'X' | 'c' | '' | 'n'; @@ -175,7 +180,7 @@ export function formatDefaultLocale(defaultLocale: FormatLocaleDefinition): Form * * Uses the current default locale. * - * The general form of a specifier is [[fill]align][sign][symbol][0][width][,][.precision][type]. + * The general form of a specifier is [[fill]align][sign][symbol][0][width][,][.precision][~][type]. * For reference, an explanation of the segments of the specifier string, refer to the FormatSpecifier interface properties. * * @param specifier A Specifier string. @@ -191,7 +196,7 @@ export function format(specifier: string): (n: number | { valueOf(): number }) = * * Uses the current default locale. * - * The general form of a specifier is [[fill]align][sign][symbol][0][width][,][.precision][type]. + * The general form of a specifier is [[fill]align][sign][symbol][0][width][,][.precision][~][type]. * For reference, an explanation of the segments of the specifier string, refer to the FormatSpecifier interface properties. * * @param specifier A Specifier string. @@ -204,7 +209,7 @@ export function formatPrefix(specifier: string, value: number): (n: number | { v * Parses the specified specifier, returning an object with exposed fields that correspond to the * format specification mini-language and a toString method that reconstructs the specifier. * - * The general form of a specifier is [[fill]align][sign][symbol][0][width][,][.precision][type]. + * The general form of a specifier is [[fill]align][sign][symbol][0][width][,][.precision][~][type]. * For reference, an explanation of the segments of the specifier string, refer to the FormatSpecifier interface properties. * * @param specifier A specifier string. From baa3dc9f9c5065bc6208877fdbf2f7b46b54a553 Mon Sep 17 00:00:00 2001 From: Sergio Freitas Date: Thu, 10 May 2018 11:49:31 +0100 Subject: [PATCH 10/53] Added Definitions for Component Class. --- types/video.js/index.d.ts | 126 +++++++++++++++++++++++++++++--------- 1 file changed, 97 insertions(+), 29 deletions(-) diff --git a/types/video.js/index.d.ts b/types/video.js/index.d.ts index eaf49a1833..3a658fc05f 100644 --- a/types/video.js/index.d.ts +++ b/types/video.js/index.d.ts @@ -4,6 +4,7 @@ // Simon Clériot // Sean Bennett // Christoph Wagner +// Gio Freitas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // The Video.js API allows you to interact with the video through @@ -15,6 +16,9 @@ export = videojs; export as namespace videojs; declare namespace videojs { + const getComponent: typeof Component.getComponent; + const registerComponent: typeof Component.registerComponent; + interface PlayerOptions { techOrder?: string[]; sourceOrder?: boolean; @@ -35,6 +39,7 @@ declare namespace videojs { language?: string; notSupportedMessage?: string; plugins?: any; + poster?: string; } interface Source { @@ -42,39 +47,102 @@ declare namespace videojs { src: string; } - interface Player { - play(): Player; - pause(): Player; - paused(): boolean; - src(newSource: string | Source | Source[]): Player; - currentTime(seconds: number): Player; - currentTime(): number; - duration(): number; + interface Dimensions { + width: number; + height: number; + } + + class Component { + constructor(player: Player, options: any); + + static getComponent(name: 'Player'|'player'): typeof Player; + static getComponent(name: 'Component'|'component' | string): typeof Component; + static registerComponent(name: string, ComponentToRegister: typeof Component): typeof Component; + + $(selector: string, context?: string|Element): Element; + $$(selector: string, context?: string|Element): NodeList; + addClass(classToAdd: string): void; + blur(): void; + cancelAnimationFrame(id: number): number; + children(): Component[]; + clearInterval(intervalId: number): number; + clearTimeout(timeoutId: number): number; + contentEl(): Element; + createEl(tagNameopt?: string, properties?: any, attributes?: any): Element; + currentDimension(widthOrHeight: 'width'|'height'): number; + currentDimensions(): Dimensions; + currentHeight(): number; + currentWidth(): number; + dimension(widthOrHeight: 'width'|'height'): number; + dimension(widthOrHeight: 'width'|'height', num: string|number, skipListenersopt?: boolean): void; + dimensions(width: string|number, height: string|number): void; + dispose(): void; + el(): Element; + enableTouchActivity(): void; + focus(): void; + getAttribute(attribute: string): string|null; + getChild(name: string): Component|undefined; + getChildById(id: string): Component|undefined; + hasClass(classToCheck: string): boolean; + height(): number|string; + height(num: number|string, skipListeners?: boolean): void; + hide(): void; + id(): string; + initChildren(): void; + localize(key: string, tokens?: string[], defaultValue?: string): string; + name(): string; + options(obj: any): any; + player(): Player; + ready(callback: (this: this) => void): this; + removeAttribute(attribute: string): void; + removeChild(component: Component): void; + removeClass(classToRemove: string): void; + requestAnimationFrame(fn: () => void): number; + setAttribute(attribute: string, value: string): void; + setInterval(fn: () => void, interval: number): number; + setTimeout(fn: () => void, timeout: number): number; + show(): void; + toggleClass(classToToggle: string, predicate?: string): void; + triggerReady(): void; + width(): string | number; + width(num: number, skipListeners?: number): void; + } + + class Player extends Component { + autoplay(value?: boolean): string; + addRemoteTextTrack(options: {}): HTMLTrackElement; buffered(): TimeRanges; bufferedPercent(): number; - volume(percentAsDecimal: number): TimeRanges; - volume(): number; - width(): number; - width(pixels: number): Player; - height(): number; - height(pixels: number): Player; - size(width: number, height: number): Player; - requestFullScreen(): Player; cancelFullScreen(): Player; - requestFullscreen(): Player; - exitFullscreen(): Player; - ready(callback: (this: Player) => void): Player; - on(eventName: string, callback: (eventObject: Event) => void): void; - off(eventName?: string, callback?: (eventObject: Event) => void): void; - dispose(): void; - addRemoteTextTrack(options: {}): HTMLTrackElement; - removeRemoteTextTrack(track: HTMLTrackElement): void; - poster(val?: string): string | Player; - playbackRate(rate?: number): number; controls(bool?: boolean): boolean; - muted(muted?: boolean): boolean; - preload(value?: boolean): string; - autoplay(value?: boolean): string; + currentTime(): number; + currentTime(seconds: number): Player; + duration(): number; + exitFullscreen(): Player; + height(): number; + height(num: number): void; + languageSwitch(options: any): void; loop(value?: boolean): string; + muted(muted?: boolean): boolean; + off(eventName?: string, callback?: (eventObject: Event) => void): void; + on(eventName: string, callback: (eventObject: Event) => void): void; + pause(): Player; + paused(): boolean; + play(): Player; + playbackRate(rate?: number): number; + poster(val?: string): string | Player; + preload(value?: boolean): string; + removeRemoteTextTrack(track: HTMLTrackElement): void; + requestFullScreen(): Player; + size(width: number, height: number): Player; + src(newSource: string | Source | Source[]): Player; + volume(): number; + volume(percentAsDecimal: number): TimeRanges; + width(): number; + width(num: number): void; + } + + namespace dom { + function appendContent(element: Element, content: any): Element; } } From e0695202ae2dca81d5fbecacc07ee2eab7ea9d1d Mon Sep 17 00:00:00 2001 From: Felipe Vaz Date: Thu, 10 May 2018 20:20:54 -0500 Subject: [PATCH 11/53] Adding 2 missing props on GridProps: rowActionsCell and selectAllRenderer --- types/react-data-grid/index.d.ts | 10 ++++++ .../react-data-grid/react-data-grid-tests.tsx | 31 +++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/types/react-data-grid/index.d.ts b/types/react-data-grid/index.d.ts index af6edce257..f66aad2e41 100644 --- a/types/react-data-grid/index.d.ts +++ b/types/react-data-grid/index.d.ts @@ -203,6 +203,16 @@ declare namespace AdazzleReactDataGrid { isSelectedKey?: string; } } + /** + * A custom formatter for the select all checkbox cell + * @default react-data-grid/src/formatters/SelectAll.js + */ + selectAllRenderer?: React.ReactElement | React.ComponentClass | React.StatelessComponent; + /** + * A custom formatter for select row column + * @default AdazzleReactDataGridPlugins.Editors.CheckboxEditor + */ + rowActionsCell?: React.ReactElement | React.ComponentClass | React.StatelessComponent; /** * An event function called when a row is clicked. * Clicking the header row will trigger a call with -1 for the rowIdx. diff --git a/types/react-data-grid/react-data-grid-tests.tsx b/types/react-data-grid/react-data-grid-tests.tsx index 827e20c820..8c0feb8f64 100644 --- a/types/react-data-grid/react-data-grid-tests.tsx +++ b/types/react-data-grid/react-data-grid-tests.tsx @@ -31,6 +31,35 @@ class CustomFilterHeaderCell extends React.Component { } } +class CustomRowSelectorCell extends ReactDataGridPlugins.Editors.CheckboxEditor { + render(){ + return super.render(); + } +} + +export interface ICustomSelectAllProps { + onChange: any; + inputRef: any; +} + +class CustomSelectAll extends React.Component { + render() { + return ( +
+ + +
+ ); + } +} + faker.locale = 'en_GB'; function createFakeRowObjectData(index:number):Object { @@ -327,6 +356,8 @@ class Example extends React.Component { keys: {rowKey: 'id', values: selectedRows} } }} + rowActionsCell={CustomRowSelectorCell} + selectAllRenderer={CustomSelectAll} onRowClick={this.onRowClick} /> From 473658826f852bd5051e4b30dc1879e2c0c24f2d Mon Sep 17 00:00:00 2001 From: Felipe Nunes Vaz Date: Fri, 11 May 2018 08:25:59 -0500 Subject: [PATCH 12/53] Fixed PR comments --- types/react-data-grid/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-data-grid/index.d.ts b/types/react-data-grid/index.d.ts index f66aad2e41..82070c673c 100644 --- a/types/react-data-grid/index.d.ts +++ b/types/react-data-grid/index.d.ts @@ -207,12 +207,12 @@ declare namespace AdazzleReactDataGrid { * A custom formatter for the select all checkbox cell * @default react-data-grid/src/formatters/SelectAll.js */ - selectAllRenderer?: React.ReactElement | React.ComponentClass | React.StatelessComponent; + selectAllRenderer?: React.ComponentClass | React.StatelessComponent; /** * A custom formatter for select row column * @default AdazzleReactDataGridPlugins.Editors.CheckboxEditor */ - rowActionsCell?: React.ReactElement | React.ComponentClass | React.StatelessComponent; + rowActionsCell?: React.ComponentClass | React.StatelessComponent; /** * An event function called when a row is clicked. * Clicking the header row will trigger a call with -1 for the rowIdx. From 7a45c8a4d65ae1c344952deacde9d0e9927dc6fe Mon Sep 17 00:00:00 2001 From: "Jon.Hallander" Date: Fri, 11 May 2018 12:50:39 -0400 Subject: [PATCH 13/53] Replaced introduced tabs Replace tabs with spaces in my introduced methods as well as interface ObjectPEM which I did not define. --- types/node-forge/index.d.ts | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/types/node-forge/index.d.ts b/types/node-forge/index.d.ts index dafed52047..016b9b7b1a 100644 --- a/types/node-forge/index.d.ts +++ b/types/node-forge/index.d.ts @@ -16,22 +16,22 @@ declare module "node-forge" { namespace pem { - interface EncodeOptions { - maxline?: number; - } + interface EncodeOptions { + maxline?: number; + } - interface ObjectPEM { - type: string; - body: Bytes; - procType?: any; - contentDomain?: any; - dekInfo?: any; - headers?: any[]; - } + interface ObjectPEM { + type: string; + body: Bytes; + procType?: any; + contentDomain?: any; + dekInfo?: any; + headers?: any[]; + } - function encode(msg: ObjectPEM, options?: EncodeOptions): string; - function decode(str: string): ObjectPEM[]; - } + function encode(msg: ObjectPEM, options?: EncodeOptions): string; + function decode(str: string): ObjectPEM[]; + } namespace pki { @@ -43,9 +43,9 @@ declare module "node-forge" { privateKey: Key; } - function pemToDer(pem: PEM): util.ByteStringBuffer; + function pemToDer(pem: PEM): util.ByteStringBuffer; function privateKeyToPem(key: Key, maxline?: number): PEM; - function privateKeyInfoToPem(key: Key, maxline?: number): PEM; + function privateKeyInfoToPem(key: Key, maxline?: number): PEM; function publicKeyToPem(key: Key, maxline?: number): PEM; function publicKeyFromPem(pem: PEM): Key; function privateKeyFromPem(pem: PEM): Key; From e41dcf12be9a34a251ecaec0c7a87b1aa0b9958d Mon Sep 17 00:00:00 2001 From: "Anders E. Andersen" Date: Sat, 12 May 2018 09:47:57 +0200 Subject: [PATCH 14/53] Support stricter covariant contravariant checks --- types/node-red/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/node-red/index.d.ts b/types/node-red/index.d.ts index 4c9a1f093a..bc58257e2c 100644 --- a/types/node-red/index.d.ts +++ b/types/node-red/index.d.ts @@ -215,5 +215,6 @@ export interface Nodes { * @param constructor - the constructor function for this node type * @param opts - optional additional options for the node */ - registerType(type: string, constructor: (props: NodeProperties) => any, opts?: any): void; + // tslint:disable-next-line no-unnecessary-generics + registerType(type: string, constructor: (props: T) => any, opts?: any): void; } From 9d85152b0c31868a4adf4d06e62a310fc18080a5 Mon Sep 17 00:00:00 2001 From: Gareth Parker Date: Sat, 12 May 2018 15:41:54 +0100 Subject: [PATCH 15/53] Glue - Fixed compose to return promise --- types/glue/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/glue/index.d.ts b/types/glue/index.d.ts index f347e69746..71c7714827 100644 --- a/types/glue/index.d.ts +++ b/types/glue/index.d.ts @@ -28,4 +28,4 @@ export interface Manifest { }; } -export function compose(manifest: Manifest, options?: Options): Server; +export function compose(manifest: Manifest, options?: Options): Promise; From 64d8a682dc73cd0932e8c889a08169ed9a4cb201 Mon Sep 17 00:00:00 2001 From: Gareth Parker Date: Sat, 12 May 2018 15:47:07 +0100 Subject: [PATCH 16/53] Glue - Updated Test --- types/glue/glue-tests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/glue/glue-tests.ts b/types/glue/glue-tests.ts index 7ac309352c..577434661a 100644 --- a/types/glue/glue-tests.ts +++ b/types/glue/glue-tests.ts @@ -7,6 +7,7 @@ const manifest: Glue.Manifest = { }, register: { plugins: [ + "test-plugin", { plugin: "./test", routes: { From fc3ff10ba010411871da782f24a5b2d4b5286d6c Mon Sep 17 00:00:00 2001 From: Gareth Parker Date: Sat, 12 May 2018 17:16:18 +0100 Subject: [PATCH 17/53] Glue - Added union types for plugins --- types/glue/glue-tests.ts | 4 ++-- types/glue/index.d.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/glue/glue-tests.ts b/types/glue/glue-tests.ts index 577434661a..dd400697e6 100644 --- a/types/glue/glue-tests.ts +++ b/types/glue/glue-tests.ts @@ -7,9 +7,9 @@ const manifest: Glue.Manifest = { }, register: { plugins: [ - "test-plugin", + "./test-plugin.js", { - plugin: "./test", + plugin: "./test.js", routes: { prefix: "test" } diff --git a/types/glue/index.d.ts b/types/glue/index.d.ts index 71c7714827..060d729d66 100644 --- a/types/glue/index.d.ts +++ b/types/glue/index.d.ts @@ -24,7 +24,7 @@ export interface Plugin { export interface Manifest { server: ServerOptions; register?: { - plugins: string[] | Plugin[] + plugins: string[] | Plugin[] | Array<(string|Plugin)> }; } From f85390fff4d1b7145f7de7019a860a06b00b6df7 Mon Sep 17 00:00:00 2001 From: Justin Stanley Date: Sat, 12 May 2018 12:20:39 -0500 Subject: [PATCH 18/53] Added allowFontScaling prop to TextInputProps --- types/react-native/index.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 756ef2b340..b0a0f89010 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -1088,6 +1088,14 @@ export type ReturnKeyTypeOptions = ReturnKeyType | ReturnKeyTypeAndroid | Return */ export interface TextInputProps extends ViewProps, TextInputIOSProps, TextInputAndroidProps, AccessibilityProps { + /** + * Specifies whether fonts should scale to respect Text Size accessibility settings. + * The default is true. + * + * https://facebook.github.io/react-native/docs/textinput.html#allowfontscaling + */ + allowFontScaling?: boolean; + /** * Can tell TextInput to automatically capitalize certain characters. * characters: all characters, From ec90482869920fd2482d34a94328ba23be3f5698 Mon Sep 17 00:00:00 2001 From: Justin Stanley Date: Sat, 12 May 2018 12:29:56 -0500 Subject: [PATCH 19/53] Moved allowFontScaling from TextPropsIOS to TextProps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - `allowFontScaling` is not an iOS-only prop on Text. - also removed the link to `allowFontScaling` for TextInput as there’s already a link to the TextInput docs above the interface declaration. --- types/react-native/index.d.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index b0a0f89010..83266b6383 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -800,12 +800,6 @@ export interface TextStyle extends TextStyleIOS, TextStyleAndroid, ViewStyle { } export interface TextPropsIOS { - /** - * Specifies whether fonts should scale to respect Text Size accessibility setting on iOS. The - * default is `true`. - */ - allowFontScaling?: boolean; - /** * Specifies whether font should be scaled down automatically to fit given style constraints. */ @@ -843,6 +837,12 @@ export interface TextPropsAndroid { // https://facebook.github.io/react-native/docs/text.html#props export interface TextProps extends TextPropsIOS, TextPropsAndroid, AccessibilityProps { + /** + * Specifies whether fonts should scale to respect Text Size accessibility settings. + * The default is `true`. + */ + allowFontScaling?: boolean; + /** * This can be one of the following values: * @@ -1090,9 +1090,7 @@ export interface TextInputProps extends ViewProps, TextInputIOSProps, TextInputAndroidProps, AccessibilityProps { /** * Specifies whether fonts should scale to respect Text Size accessibility settings. - * The default is true. - * - * https://facebook.github.io/react-native/docs/textinput.html#allowfontscaling + * The default is `true`. */ allowFontScaling?: boolean; From e8e62acb43e9705dcdca8838ece885cfd10c8c36 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Sat, 12 May 2018 17:34:11 +0000 Subject: [PATCH 20/53] Replace some string[] arguments by ReadonlyArray `spawnSync`, `execFile`, ... take `string[]` as arguments which makes it inconvenient to pass a ReadonlyArray --- types/node/index.d.ts | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index d228742629..b90c17fa0a 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -2253,33 +2253,33 @@ declare module "child_process" { export function execFile(file: string): ChildProcess; export function execFile(file: string, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): ChildProcess; - export function execFile(file: string, args: string[] | undefined | null): ChildProcess; - export function execFile(file: string, args: string[] | undefined | null, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): ChildProcess; + export function execFile(file: string, args?: ReadonlyArray | null): ChildProcess; + export function execFile(file: string, args: ReadonlyArray | undefined | null, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): ChildProcess; // no `options` definitely means stdout/stderr are `string`. export function execFile(file: string, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess; - export function execFile(file: string, args: string[] | undefined | null, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess; + export function execFile(file: string, args: ReadonlyArray | undefined | null, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess; // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`. export function execFile(file: string, options: ExecFileOptionsWithBufferEncoding, callback: (error: Error | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess; - export function execFile(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithBufferEncoding, callback: (error: Error | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess; + export function execFile(file: string, args: ReadonlyArray | undefined | null, options: ExecFileOptionsWithBufferEncoding, callback: (error: Error | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess; // `options` with well known `encoding` means stdout/stderr are definitely `string`. export function execFile(file: string, options: ExecFileOptionsWithStringEncoding, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess; - export function execFile(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithStringEncoding, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess; + export function execFile(file: string, args: ReadonlyArray | undefined | null, options: ExecFileOptionsWithStringEncoding, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess; // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`. // There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`. export function execFile(file: string, options: ExecFileOptionsWithOtherEncoding, callback: (error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void): ChildProcess; - export function execFile(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithOtherEncoding, callback: (error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void): ChildProcess; + export function execFile(file: string, args: ReadonlyArray | undefined | null, options: ExecFileOptionsWithOtherEncoding, callback: (error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void): ChildProcess; // `options` without an `encoding` means stdout/stderr are definitely `string`. export function execFile(file: string, options: ExecFileOptions, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess; - export function execFile(file: string, args: string[] | undefined | null, options: ExecFileOptions, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess; + export function execFile(file: string, args: ReadonlyArray | undefined | null, options: ExecFileOptions, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess; // fallback if nothing else matches. Worst case is always `string | Buffer`. export function execFile(file: string, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null, callback: ((error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null): ChildProcess; - export function execFile(file: string, args: string[] | undefined | null, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null, callback: ((error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null): ChildProcess; + export function execFile(file: string, args: ReadonlyArray | undefined | null, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null, callback: ((error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null): ChildProcess; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace execFile { @@ -2308,7 +2308,7 @@ declare module "child_process" { gid?: number; windowsVerbatimArguments?: boolean; } - export function fork(modulePath: string, args?: string[], options?: ForkOptions): ChildProcess; + export function fork(modulePath: string, args?: ReadonlyArray, options?: ForkOptions): ChildProcess; export interface SpawnSyncOptions { cwd?: string; @@ -2344,9 +2344,9 @@ declare module "child_process" { export function spawnSync(command: string, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns; export function spawnSync(command: string, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns; export function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns; - export function spawnSync(command: string, args?: string[], options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns; - export function spawnSync(command: string, args?: string[], options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns; - export function spawnSync(command: string, args?: string[], options?: SpawnSyncOptions): SpawnSyncReturns; + export function spawnSync(command: string, args?: ReadonlyArray, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns; + export function spawnSync(command: string, args?: ReadonlyArray, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns; + export function spawnSync(command: string, args?: ReadonlyArray, options?: SpawnSyncOptions): SpawnSyncReturns; export interface ExecSyncOptions { cwd?: string; @@ -2396,9 +2396,9 @@ declare module "child_process" { export function execFileSync(command: string, options?: ExecFileSyncOptionsWithStringEncoding): string; export function execFileSync(command: string, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer; export function execFileSync(command: string, options?: ExecFileSyncOptions): Buffer; - export function execFileSync(command: string, args?: string[], options?: ExecFileSyncOptionsWithStringEncoding): string; - export function execFileSync(command: string, args?: string[], options?: ExecFileSyncOptionsWithBufferEncoding): Buffer; - export function execFileSync(command: string, args?: string[], options?: ExecFileSyncOptions): Buffer; + export function execFileSync(command: string, args?: ReadonlyArray, options?: ExecFileSyncOptionsWithStringEncoding): string; + export function execFileSync(command: string, args?: ReadonlyArray, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer; + export function execFileSync(command: string, args?: ReadonlyArray, options?: ExecFileSyncOptions): Buffer; } declare module "url" { From 57c2a02c4d732fcf535d79b113ecd0d78eaab5d4 Mon Sep 17 00:00:00 2001 From: Matthew Tebbs Date: Sat, 12 May 2018 11:30:33 -0700 Subject: [PATCH 21/53] Add missing dispose() method type. --- types/three/three-trackballcontrols.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/three/three-trackballcontrols.d.ts b/types/three/three-trackballcontrols.d.ts index 88770ef79f..f5fb324079 100644 --- a/types/three/three-trackballcontrols.d.ts +++ b/types/three/three-trackballcontrols.d.ts @@ -31,6 +31,8 @@ export class TrackballControls extends EventDispatcher { reset(): void; + dispose(): void; + checkDistances(): void; zoomCamera(): void; From 83e3a609f0280150301905490e4fa50674b2467d Mon Sep 17 00:00:00 2001 From: Ivan Akulov Date: Sat, 12 May 2018 21:55:45 +0300 Subject: [PATCH 22/53] [read-package-tree] Add the missing `name` field --- types/read-package-tree/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/read-package-tree/index.d.ts b/types/read-package-tree/index.d.ts index e67083ffca..c4c4112aa9 100644 --- a/types/read-package-tree/index.d.ts +++ b/types/read-package-tree/index.d.ts @@ -9,6 +9,7 @@ declare function rpt(root: string, filterWith: (node: rpt.Node, kidName: string) declare namespace rpt { class Node { id: number; + name: string; package: any; children: Node[]; parent: Node | null; From fb0c888f4ed49e531e3ec5f2f50b5936e50ba1d4 Mon Sep 17 00:00:00 2001 From: Ivan Akulov Date: Sat, 12 May 2018 23:12:13 +0300 Subject: [PATCH 23/53] Bump the package version --- types/read-package-tree/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/read-package-tree/index.d.ts b/types/read-package-tree/index.d.ts index c4c4112aa9..9a5d66214c 100644 --- a/types/read-package-tree/index.d.ts +++ b/types/read-package-tree/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for read-package-tree 5.1 +// Type definitions for read-package-tree 5.2 // Project: https://github.com/npm/read-package-tree // Definitions by: Melvin Groenhoff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 3438d5214117cec848384d9d3def034f440fd13e Mon Sep 17 00:00:00 2001 From: knuthelgesen Date: Sat, 12 May 2018 22:31:04 +0200 Subject: [PATCH 24/53] Added the method "get()" from the Croppie library so it's possible to read crop data (points, zoom and orientation) Added an interface for the crop data --- types/croppie/croppie-tests.ts | 2 ++ types/croppie/index.d.ts | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/types/croppie/croppie-tests.ts b/types/croppie/croppie-tests.ts index 581d01435d..a82b04fabb 100644 --- a/types/croppie/croppie-tests.ts +++ b/types/croppie/croppie-tests.ts @@ -22,4 +22,6 @@ c.result({ type: 'blob' }).then(blob => { x = blob; }); +c.get(); + c.destroy(); diff --git a/types/croppie/index.d.ts b/types/croppie/index.d.ts index 97f53f84c8..a8b53c54e5 100644 --- a/types/croppie/index.d.ts +++ b/types/croppie/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Connor Peet // dklmuc // Sarun Intaralawan +// Knut Erik Helgesen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export as namespace Croppie; @@ -26,6 +27,8 @@ declare class Croppie { result(options: Croppie.ResultOptions & { type: 'rawcanvas' }): Promise; result(options?: Croppie.ResultOptions): Promise; + get(): Croppie.CropData; + rotate(degrees: 90 | 180 | 270 | -90 | -180 | -270): void; setZoom(zoom: number): void; @@ -59,4 +62,10 @@ declare namespace Croppie { showZoomer?: boolean; viewport?: { width: number, height: number, type?: CropType }; } + + interface CropData { + points?: number[]; + orientation?: number; + zoom?: number; + } } From 9028a63234ef076b85dfabe89607e898ce720947 Mon Sep 17 00:00:00 2001 From: Dominique Rau Date: Sat, 12 May 2018 22:58:25 +0200 Subject: [PATCH 25/53] state can be typed (#25640) --- types/noble/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/noble/index.d.ts b/types/noble/index.d.ts index ee4fbf1654..41704bef05 100644 --- a/types/noble/index.d.ts +++ b/types/noble/index.d.ts @@ -42,7 +42,7 @@ export declare class Peripheral extends events.EventEmitter { advertisement: Advertisement; rssi: number; services: Service[]; - state: string; + state: 'error' | 'connecting' | 'connected' | 'disconnecting' | 'disconnected'; connect(callback?: (error: string) => void): void; disconnect(callback?: () => void): void; From 6c416c39c3275591fa6954e81cd2fc71d10084d9 Mon Sep 17 00:00:00 2001 From: Shude Li Date: Sun, 13 May 2018 18:56:18 +0800 Subject: [PATCH 26/53] fix: add witness field to interface In https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/src/transaction.js#L111 --- types/bitcoinjs-lib/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/bitcoinjs-lib/index.d.ts b/types/bitcoinjs-lib/index.d.ts index 920df43d6e..e36a05dbca 100644 --- a/types/bitcoinjs-lib/index.d.ts +++ b/types/bitcoinjs-lib/index.d.ts @@ -23,6 +23,7 @@ export interface In { hash: Buffer; index: number; sequence: number; + witness: string[]; } export interface Network { From 58379cb18044fb284e89be52a47d4876725a3bff Mon Sep 17 00:00:00 2001 From: islishude Date: Sun, 13 May 2018 19:13:40 +0800 Subject: [PATCH 27/53] feat(node9&10): add `TextDecoder` and `TextEncoder` for `util` module --- types/node/index.d.ts | 33 +++++++++++++++++++++++++++++++++ types/node/node-tests.ts | 29 +++++++++++++++++++++++++++++ types/node/v9/index.d.ts | 33 +++++++++++++++++++++++++++++++++ types/node/v9/node-tests.ts | 29 +++++++++++++++++++++++++++++ 4 files changed, 124 insertions(+) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index d228742629..09f8498359 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -23,6 +23,7 @@ // Mohsen Azimi // Hoàng Văn Khải // Alexander T. +// Lishude // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** inspector module types */ @@ -6220,6 +6221,38 @@ declare module "util" { export function isWeakSet(object: any): object is WeakSet; export function isWebAssemblyCompiledModule(object: any): boolean; } + + export class TextDecoder { + readonly encoding: string; + readonly fatal: boolean; + readonly ignoreBOM: boolean; + constructor( + encoding?: string, + options?: { fatal?: boolean; ignoreBOM?: boolean } + ); + decode( + input?: + | Int8Array + | Int16Array + | Int32Array + | Uint8Array + | Uint16Array + | Uint32Array + | Uint8ClampedArray + | Float32Array + | Float64Array + | DataView + | ArrayBuffer + | null, + options?: { stream?: boolean } + ): string; + } + + export class TextEncoder { + readonly encoding: string; + constructor(); + encode(input?: string): Uint8Array; + } } declare module "assert" { diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index d428cf8753..e5d7576fce 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -857,6 +857,35 @@ namespace util_tests { // util.isDeepStrictEqual util.isDeepStrictEqual({foo: 'bar'}, {foo: 'bar'}); + + // util.TextDecoder() + var td = new util.TextDecoder(); + new util.TextDecoder("utf-8"); + new util.TextDecoder("utf-8", { fatal: true }); + new util.TextDecoder("utf-8", { fatal: true, ignoreBOM: true }); + var ignoreBom: boolean = td.ignoreBOM; + var fatal: boolean = td.fatal; + var encoding: string = td.encoding; + td.decode(new Int8Array(1)); + td.decode(new Int16Array(1)); + td.decode(new Int32Array(1)); + td.decode(new Uint8Array(1)); + td.decode(new Uint16Array(1)); + td.decode(new Uint32Array(1)); + td.decode(new Uint8ClampedArray(1)); + td.decode(new Float32Array(1)); + td.decode(new Float64Array(1)); + td.decode(new DataView(new Int8Array(1).buffer)); + td.decode(new ArrayBuffer(1)); + td.decode(null); + td.decode(null, { stream: true }); + td.decode(new Int8Array(1), { stream: true }); + var decode: string = td.decode(new Int8Array(1)); + + // util.TextEncoder() + var te = new util.TextEncoder(); + var teEncoding: string = te.encoding; + var teEncodeRes: Uint8Array = te.encode("TextEncoder"); } } diff --git a/types/node/v9/index.d.ts b/types/node/v9/index.d.ts index 5a76e4cc45..65c55878cd 100644 --- a/types/node/v9/index.d.ts +++ b/types/node/v9/index.d.ts @@ -24,6 +24,7 @@ // Mohsen Azimi // Hoàng Văn Khải // Alexander T. +// Lishude // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** inspector module types */ @@ -5659,6 +5660,38 @@ declare module "util" { export namespace promisify { const custom: symbol; } + + export class TextDecoder { + readonly encoding: string; + readonly fatal: boolean; + readonly ignoreBOM: boolean; + constructor( + encoding?: string, + options?: { fatal?: boolean; ignoreBOM?: boolean } + ); + decode( + input?: + | Int8Array + | Int16Array + | Int32Array + | Uint8Array + | Uint16Array + | Uint32Array + | Uint8ClampedArray + | Float32Array + | Float64Array + | DataView + | ArrayBuffer + | null, + options?: { stream?: boolean } + ): string; + } + + export class TextEncoder { + readonly encoding: string; + constructor(); + encode(input?: string): Uint8Array; + } } declare module "assert" { diff --git a/types/node/v9/node-tests.ts b/types/node/v9/node-tests.ts index d6751541b9..b7c7471fe1 100644 --- a/types/node/v9/node-tests.ts +++ b/types/node/v9/node-tests.ts @@ -854,6 +854,35 @@ namespace util_tests { // util.isDeepStrictEqual util.isDeepStrictEqual({foo: 'bar'}, {foo: 'bar'}); + + // util.TextDecoder() + var td = new util.TextDecoder(); + new util.TextDecoder("utf-8"); + new util.TextDecoder("utf-8", { fatal: true }); + new util.TextDecoder("utf-8", { fatal: true, ignoreBOM: true }); + var ignoreBom: boolean = td.ignoreBOM; + var fatal: boolean = td.fatal; + var encoding: string = td.encoding; + td.decode(new Int8Array(1)); + td.decode(new Int16Array(1)); + td.decode(new Int32Array(1)); + td.decode(new Uint8Array(1)); + td.decode(new Uint16Array(1)); + td.decode(new Uint32Array(1)); + td.decode(new Uint8ClampedArray(1)); + td.decode(new Float32Array(1)); + td.decode(new Float64Array(1)); + td.decode(new DataView(new Int8Array(1).buffer)); + td.decode(new ArrayBuffer(1)); + td.decode(null); + td.decode(null, { stream: true }); + td.decode(new Int8Array(1), { stream: true }); + var decode: string = td.decode(new Int8Array(1)); + + // util.TextEncoder() + var te = new util.TextEncoder(); + var teEncoding: string = te.encoding; + var teEncodeRes: Uint8Array = te.encode("TextEncoder"); } } From 797b4c362207ca5ed8ddbde29ac1561fc891559a Mon Sep 17 00:00:00 2001 From: wind-rider Date: Sun, 13 May 2018 14:17:43 +0200 Subject: [PATCH 28/53] Remove myself from Noble authors list --- .github/CODEOWNERS | 2 +- types/noble/index.d.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 3938bc24d1..f9324d1bdd 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2639,7 +2639,7 @@ /types/nightmare/ @horiuchi @samyang-au @Bleser92 /types/nightwatch/ @rkavalap @schlesiger /types/nivo-slider/ @AndersonFriaca -/types/noble/ @swook @wind-rider @shantanubhadoria @lukel99 @bioball @keton @thegecko +/types/noble/ @swook @shantanubhadoria @lukel99 @bioball @keton @thegecko /types/nock/ @bonnici @horiuchi @afharo @mastermatt @damour /types/nodal/ @charrondev /types/node/v4/ @eps1lon diff --git a/types/noble/index.d.ts b/types/noble/index.d.ts index 41704bef05..61ca1f2113 100644 --- a/types/noble/index.d.ts +++ b/types/noble/index.d.ts @@ -1,7 +1,6 @@ // Type definitions for noble // Project: https://github.com/sandeepmistry/noble // Definitions by: Seon-Wook Park -// Hans Bakker // Shantanu Bhadoria // Luke Libraro // Dan Chao From fc2b440fc80f049792a9c76b41ef3059465d196b Mon Sep 17 00:00:00 2001 From: islishude Date: Sun, 13 May 2018 20:32:31 +0800 Subject: [PATCH 29/53] fix: fix ts version --- types/node/index.d.ts | 1 + types/node/v9/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 09f8498359..f6b25c85c5 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -6222,6 +6222,7 @@ declare module "util" { export function isWebAssemblyCompiledModule(object: any): boolean; } + // TypeScript Version: 2.1 export class TextDecoder { readonly encoding: string; readonly fatal: boolean; diff --git a/types/node/v9/index.d.ts b/types/node/v9/index.d.ts index 65c55878cd..def77c2337 100644 --- a/types/node/v9/index.d.ts +++ b/types/node/v9/index.d.ts @@ -5660,7 +5660,7 @@ declare module "util" { export namespace promisify { const custom: symbol; } - + // TypeScript Version: 2.1 export class TextDecoder { readonly encoding: string; readonly fatal: boolean; From f31b54d5b7b33b8d5385a87c7db5fd8a69c915fc Mon Sep 17 00:00:00 2001 From: Saad Quadri Date: Sun, 13 May 2018 17:09:06 -0400 Subject: [PATCH 30/53] cosmiconfig options should be optional --- types/cosmiconfig/cosmiconfig-tests.ts | 2 ++ types/cosmiconfig/index.d.ts | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/types/cosmiconfig/cosmiconfig-tests.ts b/types/cosmiconfig/cosmiconfig-tests.ts index 632569c6f9..73010d01ac 100644 --- a/types/cosmiconfig/cosmiconfig-tests.ts +++ b/types/cosmiconfig/cosmiconfig-tests.ts @@ -11,6 +11,8 @@ const explorer = cosmiconfig("yourModuleName", { ignoreEmptySearchPlaces: false, }); +const explorer2 = cosmiconfig("yourModuleName"); + Promise.all([ explorer.search(path.join(__dirname)), explorer.searchSync(path.join(__dirname)), diff --git a/types/cosmiconfig/index.d.ts b/types/cosmiconfig/index.d.ts index bdafc922ec..e8fd3fed17 100644 --- a/types/cosmiconfig/index.d.ts +++ b/types/cosmiconfig/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/davidtheclark/cosmiconfig // Definitions by: ozum // szeck87 +// saadq // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -55,4 +56,4 @@ export interface ExplorerOptions { ignoreEmptySearchPlaces?: boolean; } -export default function cosmiconfig(moduleName: string, options: ExplorerOptions): Explorer; +export default function cosmiconfig(moduleName: string, options?: ExplorerOptions): Explorer; From 835021372fbd4124ed4166c6150ff1145a376122 Mon Sep 17 00:00:00 2001 From: Sam Walsh Date: Mon, 14 May 2018 09:26:27 +1200 Subject: [PATCH 31/53] Fix double quotes autoformatting --- types/react-content-loader/index.d.ts | 27 ++++--------------- .../react-content-loader-tests.tsx | 6 ++--- 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/types/react-content-loader/index.d.ts b/types/react-content-loader/index.d.ts index 508d3eb719..6762de7274 100644 --- a/types/react-content-loader/index.d.ts +++ b/types/react-content-loader/index.d.ts @@ -5,11 +5,11 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 -import * as React from "react"; +import * as React from 'react'; export interface ContentLoaderProps { style?: React.CSSProperties; - type?: "facebook" | "instagram" | "list" | "bullet-list" | "code"; + type?: 'facebook' | 'instagram' | 'list' | 'bullet-list' | 'code'; speed?: number; width?: number; height?: number; @@ -17,26 +17,9 @@ export interface ContentLoaderProps { secondaryColor?: string; primaryOpacity?: number; secondaryOpacity?: number; - preserveAspectRatio?: - | "none" - | "xMinYMin meet" - | "xMidYMin meet" - | "xMaxYMin meet" - | "xMinYMid meet" - | "xMidYMid meet" - | "xMaxYMid meet" - | "xMinYMax meet" - | "xMidYMax meet" - | "xMaxYMax meet" - | "xMinYMin slice" - | "xMidYMin slice" - | "xMaxYMin slice" - | "xMinYMid slice" - | "xMidYMid slice" - | "xMaxYMid slice" - | "xMinYMax slice" - | "xMidYMax slice" - | "xMaxYMax slice"; + preserveAspectRatio?: | 'none' | 'xMinYMin meet' | 'xMidYMin meet' | 'xMaxYMin meet' | 'xMinYMid meet' | 'xMidYMid meet' | 'xMaxYMid meet' | + 'xMinYMax meet' | 'xMidYMax meet' | 'xMaxYMax meet' | 'xMinYMin slice' | 'xMidYMin slice' | 'xMaxYMin slice' | 'xMinYMid slice' | + 'xMidYMid slice' | 'xMaxYMid slice' | 'xMinYMax slice' | 'xMidYMax slice' | 'xMaxYMax slice'; className?: string; } export default class ContentLoader extends React.Component< diff --git a/types/react-content-loader/react-content-loader-tests.tsx b/types/react-content-loader/react-content-loader-tests.tsx index 7ec300639c..22e3dbaa7d 100644 --- a/types/react-content-loader/react-content-loader-tests.tsx +++ b/types/react-content-loader/react-content-loader-tests.tsx @@ -1,10 +1,10 @@ -import * as React from "react"; -import ContentLoader from "react-content-loader"; +import * as React from 'react'; +import ContentLoader from 'react-content-loader'; const CustomComponent = () => { return ( Date: Mon, 14 May 2018 09:28:56 +1200 Subject: [PATCH 32/53] More code formatting fixes --- types/react-content-loader/index.d.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/types/react-content-loader/index.d.ts b/types/react-content-loader/index.d.ts index 6762de7274..da2cee32b1 100644 --- a/types/react-content-loader/index.d.ts +++ b/types/react-content-loader/index.d.ts @@ -17,11 +17,9 @@ export interface ContentLoaderProps { secondaryColor?: string; primaryOpacity?: number; secondaryOpacity?: number; - preserveAspectRatio?: | 'none' | 'xMinYMin meet' | 'xMidYMin meet' | 'xMaxYMin meet' | 'xMinYMid meet' | 'xMidYMid meet' | 'xMaxYMid meet' | + preserveAspectRatio?: 'none' | 'xMinYMin meet' | 'xMidYMin meet' | 'xMaxYMin meet' | 'xMinYMid meet' | 'xMidYMid meet' | 'xMaxYMid meet' | 'xMinYMax meet' | 'xMidYMax meet' | 'xMaxYMax meet' | 'xMinYMin slice' | 'xMidYMin slice' | 'xMaxYMin slice' | 'xMinYMid slice' | 'xMidYMid slice' | 'xMaxYMid slice' | 'xMinYMax slice' | 'xMidYMax slice' | 'xMaxYMax slice'; className?: string; } -export default class ContentLoader extends React.Component< - ContentLoaderProps -> {} +export default class ContentLoader extends React.Component {} From b16ee314f5cb78241832cae5fcc0d3f86a336c62 Mon Sep 17 00:00:00 2001 From: Sam Walsh Date: Mon, 14 May 2018 09:29:27 +1200 Subject: [PATCH 33/53] The last of code formatting fixes --- types/react-content-loader/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-content-loader/index.d.ts b/types/react-content-loader/index.d.ts index da2cee32b1..d0e23901cc 100644 --- a/types/react-content-loader/index.d.ts +++ b/types/react-content-loader/index.d.ts @@ -22,4 +22,4 @@ export interface ContentLoaderProps { 'xMidYMid slice' | 'xMaxYMid slice' | 'xMinYMax slice' | 'xMidYMax slice' | 'xMaxYMax slice'; className?: string; } -export default class ContentLoader extends React.Component {} +export default class ContentLoader extends React.Component { } From aaaa2a08e657edcf3fd953b9ec8c1583627650c5 Mon Sep 17 00:00:00 2001 From: Mohsen Azimi Date: Sun, 13 May 2018 14:32:32 -0700 Subject: [PATCH 34/53] Add typing for webpack profiling plugin --- types/webpack/index.d.ts | 21 +++++++++++++++++++++ types/webpack/webpack-tests.ts | 7 +++++++ 2 files changed, 28 insertions(+) diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts index 5be4abdcbd..403036d378 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -648,6 +648,27 @@ declare namespace webpack { portableRecords?: boolean; } } + + namespace debug { + interface ProfilingPluginOptions { + /** A relative path to a custom output file (json) */ + outputPath?: string; + } + /** + * Generate Chrome profile file which includes timings of plugins execution. Outputs `events.json` file by + * default. It is possible to provide custom file path using `outputPath` option. + * + * In order to view the profile file: + * * Run webpack with ProfilingPlugin. + * * Go to Chrome, open the Profile Tab. + * * Drag and drop generated file (events.json by default) into the profiler. + * + * It will then display timeline stats and calls per plugin! + */ + class ProfilingPlugin extends Plugin { + constructor(options?: ProfilingPluginOptions); + } + } namespace compilation { class Asset { } diff --git a/types/webpack/webpack-tests.ts b/types/webpack/webpack-tests.ts index b42d836c0c..ec5d0236a8 100644 --- a/types/webpack/webpack-tests.ts +++ b/types/webpack/webpack-tests.ts @@ -732,3 +732,10 @@ configuration = { ] } }; + +let profiling = new webpack.debug.ProfilingPlugin(); +profiling = new webpack.debug.ProfilingPlugin({ outputPath: './path.json' }); + +configuration = { + plugins: [profiling] +}; From e3cfa5348b8cc1b1afcf28de4cf1f03801de9c50 Mon Sep 17 00:00:00 2001 From: saadq Date: Sun, 13 May 2018 17:53:05 -0400 Subject: [PATCH 35/53] add optional types to other explorer methods --- types/cosmiconfig/cosmiconfig-tests.ts | 2 ++ types/cosmiconfig/index.d.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/cosmiconfig/cosmiconfig-tests.ts b/types/cosmiconfig/cosmiconfig-tests.ts index 73010d01ac..508ad00aa0 100644 --- a/types/cosmiconfig/cosmiconfig-tests.ts +++ b/types/cosmiconfig/cosmiconfig-tests.ts @@ -14,7 +14,9 @@ const explorer = cosmiconfig("yourModuleName", { const explorer2 = cosmiconfig("yourModuleName"); Promise.all([ + explorer.search(), explorer.search(path.join(__dirname)), + explorer.searchSync(), explorer.searchSync(path.join(__dirname)), explorer.load(path.join(__dirname, "sample-config.json")), explorer.loadSync(path.join(__dirname, "sample-config.json")), diff --git a/types/cosmiconfig/index.d.ts b/types/cosmiconfig/index.d.ts index e8fd3fed17..eb876b6ef2 100644 --- a/types/cosmiconfig/index.d.ts +++ b/types/cosmiconfig/index.d.ts @@ -36,8 +36,8 @@ export interface Loaders { } export interface Explorer { - search(searchFrom: string): Promise; - searchSync(searchFrom: string): null | CosmiconfigResult; + search(searchFrom?: string): Promise; + searchSync(searchFrom?: string): null | CosmiconfigResult; load(loadPath: string): Promise; loadSync(loadPath: string): CosmiconfigResult; clearLoadCache(): void; From ed35a5e5f291c1dfb53fd1f8c88b44258bc98ad3 Mon Sep 17 00:00:00 2001 From: islishude Date: Mon, 14 May 2018 07:47:28 +0800 Subject: [PATCH 36/53] fix: fix witness type --- types/bitcoinjs-lib/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/bitcoinjs-lib/index.d.ts b/types/bitcoinjs-lib/index.d.ts index e36a05dbca..1e8255e7ef 100644 --- a/types/bitcoinjs-lib/index.d.ts +++ b/types/bitcoinjs-lib/index.d.ts @@ -23,7 +23,7 @@ export interface In { hash: Buffer; index: number; sequence: number; - witness: string[]; + witness: Buffer[]; } export interface Network { From 626ba446b85d7a57caf2070a62b09d046f7f7269 Mon Sep 17 00:00:00 2001 From: Wang Zishi Date: Mon, 14 May 2018 10:46:43 +0800 Subject: [PATCH 37/53] fix missing protected _oauth2 property --- types/passport-oauth2/index.d.ts | 9 +++++++++ types/passport-oauth2/passport-oauth2-tests.ts | 10 ++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/types/passport-oauth2/index.d.ts b/types/passport-oauth2/index.d.ts index 5dd811f342..323d39853d 100644 --- a/types/passport-oauth2/index.d.ts +++ b/types/passport-oauth2/index.d.ts @@ -1,15 +1,24 @@ // Type definitions for passport-oauth2 1.4 // Project: https://github.com/jaredhanson/passport-oauth2#readme // Definitions by: Pasi Eronen +// Wang Zishi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 import { Request } from 'express'; import { Strategy } from 'passport'; +import { OAuth2 } from 'oauth'; declare class OAuth2Strategy extends Strategy { name: string; + /** + * NOTE: The _oauth2 property is considered "protected". Subclasses are + * allowed to use it when making protected resource requests to retrieve + * the user profile. + */ + protected _oauth2: OAuth2; + constructor(options: OAuth2Strategy.StrategyOptions, verify: OAuth2Strategy.VerifyFunction); constructor(options: OAuth2Strategy.StrategyOptionsWithRequest, verify: OAuth2Strategy.VerifyFunctionWithRequest); diff --git a/types/passport-oauth2/passport-oauth2-tests.ts b/types/passport-oauth2/passport-oauth2-tests.ts index bfedf67dad..57568ff452 100644 --- a/types/passport-oauth2/passport-oauth2-tests.ts +++ b/types/passport-oauth2/passport-oauth2-tests.ts @@ -24,11 +24,11 @@ const strategy1: OAuth2Strategy = new OAuth2Strategy(strategyOptions1, verifyFun const strategy2: Strategy = new OAuth2Strategy(strategyOptions1, verifyFunction2); function verifyFunction3(_req: Request, _accessToken: string, _refreshToken: string, _profile: any, verifyCallback: VerifyCallback) { - verifyCallback(undefined, {userid: '1'}); + verifyCallback(undefined, { userid: '1' }); } function verifyFunction4(_req: Request, _accessToken: string, _refreshToken: string, _results: any, _profile: any, verifyCallback: VerifyCallback) { - verifyCallback(undefined, {userid: '1'}); + verifyCallback(undefined, { userid: '1' }); } const strategyOptions2: StrategyOptionsWithRequest = { @@ -49,3 +49,9 @@ const err1 = new AuthorizationError('Description', 'invalid_request', undefined) const err2 = new TokenError(undefined, 'invalid_request', undefined); const err3 = new InternalOAuthError('Hello', {}); + +class MyStrategy extends OAuth2Strategy { + useProtectedMethod() { + this._oauth2.get('http://www.example.com/profile', 'token', 'http://www.example.com/callback'); + } +} From 8a1acc010fdf4f46eec21a91636774f0dbe85b19 Mon Sep 17 00:00:00 2001 From: Wang Zishi Date: Mon, 14 May 2018 10:50:53 +0800 Subject: [PATCH 38/53] fix test --- types/passport-oauth2/passport-oauth2-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/passport-oauth2/passport-oauth2-tests.ts b/types/passport-oauth2/passport-oauth2-tests.ts index 57568ff452..133bf5ec4e 100644 --- a/types/passport-oauth2/passport-oauth2-tests.ts +++ b/types/passport-oauth2/passport-oauth2-tests.ts @@ -51,7 +51,7 @@ const err2 = new TokenError(undefined, 'invalid_request', undefined); const err3 = new InternalOAuthError('Hello', {}); class MyStrategy extends OAuth2Strategy { - useProtectedMethod() { + useProtectedProperty() { this._oauth2.get('http://www.example.com/profile', 'token', 'http://www.example.com/callback'); } } From 0d1ee2470cdf7883f8d5cc074aef97d9450c9081 Mon Sep 17 00:00:00 2001 From: Haroen Viaene Date: Mon, 14 May 2018 13:21:16 +0200 Subject: [PATCH 39/53] fix(algolia): correct signature of copyIndex the scope is optional --- types/algoliasearch/index.d.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/types/algoliasearch/index.d.ts b/types/algoliasearch/index.d.ts index 87c1f79a0e..74fa64d0d5 100644 --- a/types/algoliasearch/index.d.ts +++ b/types/algoliasearch/index.d.ts @@ -88,7 +88,16 @@ declare namespace algoliasearch { */ deleteIndex(name: string): Promise; /** - * Copy an index from a specific index to a new one + * Copy an index from a specific index to a new one + * https://github.com/algolia/algoliasearch-client-js#copy-index---copyindex + */ + copyIndex( + from: string, + to: string, + cb: (err: Error, res: Task) => void + ): void; + /** + * Copy settings of an index from a specific index to a new one * https://github.com/algolia/algoliasearch-client-js#copy-index---copyindex */ copyIndex( @@ -98,13 +107,13 @@ declare namespace algoliasearch { cb: (err: Error, res: Task) => void ): void; /** - * Copy an index from a specific index to a new one + * Copy settings of an index from a specific index to a new one * https://github.com/algolia/algoliasearch-client-js#copy-index---copyindex */ copyIndex( from: string, to: string, - scope: ('settings' | 'synonyms' | 'rules')[] + scope?: ('settings' | 'synonyms' | 'rules')[] ): Promise; /** * Move index to a new one (and will overwrite the original one) @@ -230,6 +239,7 @@ declare namespace algoliasearch { * Interface for the index algolia object */ interface Index { + indexName: string; /** * Gets a specific object * https://github.com/algolia/algoliasearch-client-js#find-by-ids---getobjects From a77cf124c2b2681a5494dec6ead7e8ae39bc05f3 Mon Sep 17 00:00:00 2001 From: Haroen Viaene Date: Mon, 14 May 2018 13:27:42 +0200 Subject: [PATCH 40/53] chore: add tests --- types/algoliasearch/algoliasearch-tests.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/types/algoliasearch/algoliasearch-tests.ts b/types/algoliasearch/algoliasearch-tests.ts index 2898f889fc..dcc1fdcc9e 100644 --- a/types/algoliasearch/algoliasearch-tests.ts +++ b/types/algoliasearch/algoliasearch-tests.ts @@ -10,6 +10,7 @@ import { IndexSettings, QueryParameters, } from 'algoliasearch'; +import { Client } from './lite'; let _algoliaResponse: Response = { hits: [{}, {}], @@ -147,6 +148,7 @@ let _algoliaQueryParameters: QueryParameters = { minProximity: 0, }; +let client: Client = algoliasearch('', ''); let index: Index = algoliasearch('', '').initIndex(''); let search = index.search({ query: '' }); @@ -164,3 +166,12 @@ index.partialUpdateObjects([{}], () => {}); index.partialUpdateObjects([{}], false, () => {}); index.partialUpdateObjects([{}]).then(() => {}); index.partialUpdateObjects([{}], false).then(() => {}); + +let indexName : string = index.indexName; + +// complete copy +algoliasearch('','').copyIndex('from', 'to').then(()=>{}) +algoliasearch('','').copyIndex('from', 'to', ()=> {}) +// with scope +algoliasearch('','').copyIndex('from', 'to', ['settings']).then(()=>{}) +algoliasearch('','').copyIndex('from', 'to', ['synonyms', 'rules'], ()=> {}) From 0d005626d507a2e482dfeb5cd546eaef9357828a Mon Sep 17 00:00:00 2001 From: Haroen Viaene Date: Mon, 14 May 2018 13:30:37 +0200 Subject: [PATCH 41/53] fix: correct import --- types/algoliasearch/algoliasearch-tests.ts | 12 ++++++------ types/algoliasearch/lite/index.d.ts | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/types/algoliasearch/algoliasearch-tests.ts b/types/algoliasearch/algoliasearch-tests.ts index dcc1fdcc9e..2a3fcd2eb2 100644 --- a/types/algoliasearch/algoliasearch-tests.ts +++ b/types/algoliasearch/algoliasearch-tests.ts @@ -9,8 +9,8 @@ import { Response, IndexSettings, QueryParameters, + Client } from 'algoliasearch'; -import { Client } from './lite'; let _algoliaResponse: Response = { hits: [{}, {}], @@ -149,7 +149,7 @@ let _algoliaQueryParameters: QueryParameters = { }; let client: Client = algoliasearch('', ''); -let index: Index = algoliasearch('', '').initIndex(''); +let index: Index = client.initIndex(''); let search = index.search({ query: '' }); @@ -170,8 +170,8 @@ index.partialUpdateObjects([{}], false).then(() => {}); let indexName : string = index.indexName; // complete copy -algoliasearch('','').copyIndex('from', 'to').then(()=>{}) -algoliasearch('','').copyIndex('from', 'to', ()=> {}) +client.copyIndex('from', 'to').then(()=>{}) +client.copyIndex('from', 'to', ()=> {}) // with scope -algoliasearch('','').copyIndex('from', 'to', ['settings']).then(()=>{}) -algoliasearch('','').copyIndex('from', 'to', ['synonyms', 'rules'], ()=> {}) +client.copyIndex('from', 'to', ['settings']).then(()=>{}) +client.copyIndex('from', 'to', ['synonyms', 'rules'], ()=> {}) diff --git a/types/algoliasearch/lite/index.d.ts b/types/algoliasearch/lite/index.d.ts index 588e2ac543..1bb8254de9 100644 --- a/types/algoliasearch/lite/index.d.ts +++ b/types/algoliasearch/lite/index.d.ts @@ -67,6 +67,7 @@ declare namespace algoliasearch { * Interface for the index algolia object */ interface Index { + indexName: string; /** * Gets a specific object * https://github.com/algolia/algoliasearch-client-js#find-by-ids---getobjects From 7dcbb8074cd747ae7e5095b91e1121d56371a1b5 Mon Sep 17 00:00:00 2001 From: Haroen Viaene Date: Mon, 14 May 2018 13:32:57 +0200 Subject: [PATCH 42/53] feat: add Sam --- types/algoliasearch/index.d.ts | 1 + types/algoliasearch/lite/index.d.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/types/algoliasearch/index.d.ts b/types/algoliasearch/index.d.ts index 74fa64d0d5..b2e8f95663 100644 --- a/types/algoliasearch/index.d.ts +++ b/types/algoliasearch/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Baptiste Coquelle // Haroen Viaene // Aurélien Hervé +// Samuel Vaillant // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 diff --git a/types/algoliasearch/lite/index.d.ts b/types/algoliasearch/lite/index.d.ts index 1bb8254de9..b9932f1346 100644 --- a/types/algoliasearch/lite/index.d.ts +++ b/types/algoliasearch/lite/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Baptiste Coquelle // Haroen Viaene // Aurélien Hervé +// Samuel Vaillant // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 From 44b53c0f1e75b1ca625962af3aa8fb87d6315a20 Mon Sep 17 00:00:00 2001 From: Haroen Viaene Date: Mon, 14 May 2018 13:43:08 +0200 Subject: [PATCH 43/53] chore: add more info about tasks --- types/algoliasearch/index.d.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/types/algoliasearch/index.d.ts b/types/algoliasearch/index.d.ts index b2e8f95663..21ad90e665 100644 --- a/types/algoliasearch/index.d.ts +++ b/types/algoliasearch/index.d.ts @@ -340,7 +340,7 @@ declare namespace algoliasearch { * Wait for an indexing task to be compete * https://github.com/algolia/algoliasearch-client-js#wait-for-operations---waittask */ - waitTask(taskID: number, cb: (err: Error, res: any) => void): void; + waitTask(taskID: number, cb: (err: Error, res: TaskStatus) => void): void; /** * Get an index settings * https://github.com/algolia/algoliasearch-client-js#get-settings---getsettings @@ -572,7 +572,7 @@ declare namespace algoliasearch { * Wait for an indexing task to be compete * https://github.com/algolia/algoliasearch-client-js#wait-for-operations---waittask */ - waitTask(taskID: number): Promise; + waitTask(taskID: number): Promise; /** * Get an index settings * https://github.com/algolia/algoliasearch-client-js#get-settings---getsettings @@ -1492,6 +1492,13 @@ declare namespace algoliasearch { interface Task { taskID: number; + createdAt: string; + objectID?: string; + } + + interface TaskStatus { + status: 'published' | 'notPublished', + pendingTask: boolean, } interface IndexSettings { From a36bb6891a65c87b7b35be5240db1106594c2c8d Mon Sep 17 00:00:00 2001 From: Haroen Viaene Date: Mon, 14 May 2018 13:48:42 +0200 Subject: [PATCH 44/53] chore: stricter settings type --- types/algoliasearch/algoliasearch-tests.ts | 4 ++-- types/algoliasearch/index.d.ts | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/types/algoliasearch/algoliasearch-tests.ts b/types/algoliasearch/algoliasearch-tests.ts index 2a3fcd2eb2..96270b31eb 100644 --- a/types/algoliasearch/algoliasearch-tests.ts +++ b/types/algoliasearch/algoliasearch-tests.ts @@ -79,7 +79,7 @@ let _algoliaIndexSettings: IndexSettings = { ignorePlurals: false, disableTypoToleranceOnAttributes: '', separatorsToIndex: '', - queryType: '', + queryType: 'prefixAll', removeWordsIfNoResults: '', advancedSyntax: false, optionalWords: [''], @@ -87,7 +87,7 @@ let _algoliaIndexSettings: IndexSettings = { disablePrefixOnAttributes: [''], disableExactOnAttributes: [''], exactOnSingleWordQuery: '', - alternativesAsExact: false, + alternativesAsExact: ['ignorePlurals'], attributeForDistinct: '', distinct: false, numericAttributesToIndex: [''], diff --git a/types/algoliasearch/index.d.ts b/types/algoliasearch/index.d.ts index 21ad90e665..ba46f37ce6 100644 --- a/types/algoliasearch/index.d.ts +++ b/types/algoliasearch/index.d.ts @@ -1619,7 +1619,7 @@ declare namespace algoliasearch { * 'strict' Hits matching with 2 typos are not retrieved if there are some matching without typos. * https://github.com/algolia/algoliasearch-client-js#typotolerance */ - typoTolerance?: any; + typoTolerance?: boolean | 'min' | 'strict'; /** * If set to false, disables typo tolerance on numeric tokens (numbers). * default: true @@ -1652,7 +1652,7 @@ declare namespace algoliasearch { * 'prefixNone' No query word is interpreted as a prefix. This option is not recommended. * https://github.com/algolia/algoliasearch-client-js#querytype */ - queryType?: any; + queryType?: 'prefixAll' | 'prefixLast' | 'prefixNone'; /** * This option is used to select a strategy in order to avoid having an empty result page * default: 'none' @@ -1718,7 +1718,10 @@ declare namespace algoliasearch { * 'multiWordsSynonym': multiple-words synonym * https://github.com/algolia/algoliasearch-client-js#alternativesasexact */ - alternativesAsExact?: any; + alternativesAsExact?: ( + | "ignorePlurals" + | "singleWordSynonym" + | "multiWordsSynonym")[]; /** * The name of the attribute used for the Distinct feature * default: null @@ -1729,7 +1732,7 @@ declare namespace algoliasearch { * If set to 1, enables the distinct feature, disabled by default, if the attributeForDistinct index setting is set. * https://github.com/algolia/algoliasearch-client-js#distinct */ - distinct?: any; + distinct?: boolean | number; /** * All numerical attributes are automatically indexed as numerical filters * default '' From c31b37eb1699801d42bcc24f790858c6820798eb Mon Sep 17 00:00:00 2001 From: islishude Date: Mon, 14 May 2018 21:00:14 +0800 Subject: [PATCH 45/53] fix: fix typos --- types/node/index.d.ts | 2 +- types/node/v8/index.d.ts | 2 +- types/node/v9/index.d.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index f6b25c85c5..96416a4529 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -6233,7 +6233,7 @@ declare module "util" { ); decode( input?: - | Int8Array + Int8Array | Int16Array | Int32Array | Uint8Array diff --git a/types/node/v8/index.d.ts b/types/node/v8/index.d.ts index 45f1c85b64..32530306c2 100644 --- a/types/node/v8/index.d.ts +++ b/types/node/v8/index.d.ts @@ -5588,7 +5588,7 @@ declare module "util" { ); decode( input?: - | Int8Array + Int8Array | Int16Array | Int32Array | Uint8Array diff --git a/types/node/v9/index.d.ts b/types/node/v9/index.d.ts index def77c2337..cd8d58c6b9 100644 --- a/types/node/v9/index.d.ts +++ b/types/node/v9/index.d.ts @@ -5671,7 +5671,7 @@ declare module "util" { ); decode( input?: - | Int8Array + Int8Array | Int16Array | Int32Array | Uint8Array From f615387b62ff7edb6422a419bce50ea1c9568132 Mon Sep 17 00:00:00 2001 From: Otto Paaso Date: Mon, 14 May 2018 16:05:22 +0300 Subject: [PATCH 46/53] Add keepAlive configuration option Introduced to pg in https://github.com/brianc/node-postgres/pull/1058 --- types/pg/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/pg/index.d.ts b/types/pg/index.d.ts index 7437976d44..ffb2379a7c 100644 --- a/types/pg/index.d.ts +++ b/types/pg/index.d.ts @@ -16,6 +16,7 @@ export interface ConnectionConfig { port?: number; host?: string; connectionString?: string; + keepAlive?: boolean; } export interface Defaults extends ConnectionConfig { From ee6b647dbb7c2601fa25f5a4a11b2df58cd9e3fa Mon Sep 17 00:00:00 2001 From: islishude Date: Mon, 14 May 2018 21:15:04 +0800 Subject: [PATCH 47/53] chore: remove ts version statements --- types/node/index.d.ts | 1 - types/node/v9/index.d.ts | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 96416a4529..64834338b8 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -6222,7 +6222,6 @@ declare module "util" { export function isWebAssemblyCompiledModule(object: any): boolean; } - // TypeScript Version: 2.1 export class TextDecoder { readonly encoding: string; readonly fatal: boolean; diff --git a/types/node/v9/index.d.ts b/types/node/v9/index.d.ts index cd8d58c6b9..e7112daa25 100644 --- a/types/node/v9/index.d.ts +++ b/types/node/v9/index.d.ts @@ -5660,7 +5660,7 @@ declare module "util" { export namespace promisify { const custom: symbol; } - // TypeScript Version: 2.1 + export class TextDecoder { readonly encoding: string; readonly fatal: boolean; From 7ad5c037366a4fd03ced4d9cf605804a7233ac8f Mon Sep 17 00:00:00 2001 From: Otto Paaso Date: Mon, 14 May 2018 16:15:14 +0300 Subject: [PATCH 48/53] Use keepAlive config in tests --- types/pg/pg-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/pg/pg-tests.ts b/types/pg/pg-tests.ts index ae60f1bb6f..5051447667 100644 --- a/types/pg/pg-tests.ts +++ b/types/pg/pg-tests.ts @@ -9,6 +9,7 @@ const client = new Client({ port: 5334, user: 'database-user', password: 'secretpassword!!', + keepAlive: true, }); client.connect(err => { if (err) { @@ -125,6 +126,7 @@ const pool = new Pool({ max: 20, idleTimeoutMillis: 30000, connectionTimeoutMillis: 2000, + keepAlive: false, }); console.log(pool.totalCount); pool.connect((err, client, done) => { From ae6cbcf39298ad2c3f0a476d3b7e66b95176b9c4 Mon Sep 17 00:00:00 2001 From: Armands Baurovskis Date: Mon, 14 May 2018 17:04:46 +0300 Subject: [PATCH 49/53] = SectionList missing methods --- types/react-native/index.d.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 83266b6383..0ad2e8279f 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -3843,6 +3843,19 @@ export interface SectionListProps extends ScrollViewProps { */ initialNumToRender?: number; + /** + * Called once when the scroll position gets within onEndReachedThreshold of the rendered content. + */ + onEndReached?: ((info: { distanceFromEnd: number }) => void) | null; + + /** + * How far from the end (in units of visible length of the list) the bottom edge of the + * list must be from the end of the content to trigger the `onEndReached` callback. + * Thus a value of 0.5 will trigger `onEndReached` when the end of the content is + * within half the visible length of the list. + */ + onEndReachedThreshold?: number | null; + /** * Used to extract a unique key for a given item at the specified index. Key is used for caching * and as the react key to track item re-ordering. The default extractor checks `item.key`, then From 020bc733828004eb1ec1864f2dbc197d4548e5c7 Mon Sep 17 00:00:00 2001 From: AylaJK <26681805+AylaJK@users.noreply.github.com> Date: Mon, 14 May 2018 12:11:35 -0600 Subject: [PATCH 50/53] Add express-socket.io-session types (#25673) * Add express-socket.io-session * Reverting to defalut tslint config --- .../express-socket.io-session-tests.ts | 28 +++++++++++++++++++ types/express-socket.io-session/index.d.ts | 28 +++++++++++++++++++ types/express-socket.io-session/tsconfig.json | 23 +++++++++++++++ types/express-socket.io-session/tslint.json | 1 + 4 files changed, 80 insertions(+) create mode 100644 types/express-socket.io-session/express-socket.io-session-tests.ts create mode 100644 types/express-socket.io-session/index.d.ts create mode 100644 types/express-socket.io-session/tsconfig.json create mode 100644 types/express-socket.io-session/tslint.json diff --git a/types/express-socket.io-session/express-socket.io-session-tests.ts b/types/express-socket.io-session/express-socket.io-session-tests.ts new file mode 100644 index 0000000000..46dd000882 --- /dev/null +++ b/types/express-socket.io-session/express-socket.io-session-tests.ts @@ -0,0 +1,28 @@ +/** + * Create by AylaJK on 05/09/2018 + */ +import express = require('express'); +const app = express(); + +import http = require('http'); +const server = http.createServer(app); + +import expresssession = require('express-session'); +const session = expresssession({ + secret: 'my-secret', + resave: true, + saveUninitialized: true, +}); + +import cookieparser = require('cookie-parser'); +const cookieParser = cookieparser('my-secret'); + +import socketio = require('socket.io'); +const io = socketio(server); + +import sharedsession = require('express-socket.io-session'); + +io.use(sharedsession(session)); +io.use(sharedsession(session, { autoSave: true, saveUninitialized: true })); +io.use(sharedsession(session, cookieParser)); +io.use(sharedsession(session, cookieParser, { autoSave: true, saveUninitialized: true })); diff --git a/types/express-socket.io-session/index.d.ts b/types/express-socket.io-session/index.d.ts new file mode 100644 index 0000000000..39a1fb4ff6 --- /dev/null +++ b/types/express-socket.io-session/index.d.ts @@ -0,0 +1,28 @@ +// Type definitions for express-socket.io-session 1.3 +// Project: https://github.com/oskosk/express-socket.io-session +// Definitions by: AylaJK +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +import socketio = require('socket.io'); +import express = require('express'); + +declare function sharedsession( + expressSessionMiddleware: express.RequestHandler, + cookieParserMiddleware: express.RequestHandler, + options?: sharedsession.SharedSessionOptions): sharedsession.SocketIoSharedSessionMiddleware; + +declare function sharedsession( + expressSessionMiddleware: express.RequestHandler, + options?: sharedsession.SharedSessionOptions): sharedsession.SocketIoSharedSessionMiddleware; + +declare namespace sharedsession { + interface SharedSessionOptions { + autoSave?: boolean; + saveUninitialized?: boolean; + } + + type SocketIoSharedSessionMiddleware = (socket: socketio.Socket, next: (err?: any) => void) => void; +} + +export = sharedsession; diff --git a/types/express-socket.io-session/tsconfig.json b/types/express-socket.io-session/tsconfig.json new file mode 100644 index 0000000000..6d4aca9e90 --- /dev/null +++ b/types/express-socket.io-session/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "express-socket.io-session-tests.ts" + ] +} diff --git a/types/express-socket.io-session/tslint.json b/types/express-socket.io-session/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/express-socket.io-session/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 0c564acdc07ae3750c9bdab62dffd4cd5a7acee5 Mon Sep 17 00:00:00 2001 From: Nate Mara Date: Mon, 14 May 2018 14:12:35 -0400 Subject: [PATCH 51/53] Add express-correlation-id and correlation-id packages (#25710) * feat(correlation-id & express-correlation-id): Add express-correlation-id and correlation-id packages * fix(correlation-id) Update type of bindID function --- types/correlation-id/correlation-id-tests.ts | 21 +++++++++++++++++++ types/correlation-id/index.d.ts | 12 +++++++++++ types/correlation-id/tsconfig.json | 16 ++++++++++++++ types/correlation-id/tslint.json | 3 +++ .../express-correlation-id-tests.ts | 9 ++++++++ types/express-correlation-id/index.d.ts | 14 +++++++++++++ types/express-correlation-id/tsconfig.json | 16 ++++++++++++++ types/express-correlation-id/tslint.json | 1 + 8 files changed, 92 insertions(+) create mode 100644 types/correlation-id/correlation-id-tests.ts create mode 100644 types/correlation-id/index.d.ts create mode 100644 types/correlation-id/tsconfig.json create mode 100644 types/correlation-id/tslint.json create mode 100644 types/express-correlation-id/express-correlation-id-tests.ts create mode 100644 types/express-correlation-id/index.d.ts create mode 100644 types/express-correlation-id/tsconfig.json create mode 100644 types/express-correlation-id/tslint.json diff --git a/types/correlation-id/correlation-id-tests.ts b/types/correlation-id/correlation-id-tests.ts new file mode 100644 index 0000000000..36bf65c27d --- /dev/null +++ b/types/correlation-id/correlation-id-tests.ts @@ -0,0 +1,21 @@ +import { withId, bindId, getId } from "correlation-id"; + +withId("my-id", () => { + const id: string = getId() || ""; +}); + +withId(() => { + const id: string = getId() || ""; +}); + +const x: string = bindId("my-id", (foo: string, bar: number): string => { + const id: string = getId() || ""; + + return foo + bar + id; +})("foo", 12); + +const y: string = bindId((foo: string, bar: number): string => { + const id: string = getId() || ""; + + return foo + bar + id; +})("foo", 12); diff --git a/types/correlation-id/index.d.ts b/types/correlation-id/index.d.ts new file mode 100644 index 0000000000..f765765409 --- /dev/null +++ b/types/correlation-id/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for correlation-id 2.1 +// Project: https://github.com/toboid/correlation-id#readme +// Definitions by: Nate +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function withId(id: string, work: () => void): void; +export function withId(work: () => void): void; + +export function bindId any>(id: string, work: T): T; +export function bindId any>(work: T): T; + +export function getId(): string | undefined; diff --git a/types/correlation-id/tsconfig.json b/types/correlation-id/tsconfig.json new file mode 100644 index 0000000000..eda38b5e28 --- /dev/null +++ b/types/correlation-id/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "correlation-id-tests.ts"] +} diff --git a/types/correlation-id/tslint.json b/types/correlation-id/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/correlation-id/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/express-correlation-id/express-correlation-id-tests.ts b/types/express-correlation-id/express-correlation-id-tests.ts new file mode 100644 index 0000000000..20c9b872de --- /dev/null +++ b/types/express-correlation-id/express-correlation-id-tests.ts @@ -0,0 +1,9 @@ +import * as express from "express"; +import correlator from "express-correlation-id"; + +const app = express(); +app.use(correlator()); +app.use(correlator({})); +app.use(correlator({ header: "x-correlation-id" })); + +const x: string = correlator.getId() || ""; diff --git a/types/express-correlation-id/index.d.ts b/types/express-correlation-id/index.d.ts new file mode 100644 index 0000000000..fa09b65071 --- /dev/null +++ b/types/express-correlation-id/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for express-correlation-id 1.2 +// Project: https://github.com/toboid/express-correlation-id#readme +// Definitions by: Nate +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +import { RequestHandler } from "express-serve-static-core"; + +declare const correlator: { + (options?: { header?: string }): RequestHandler; + getId(): string | undefined; +}; + +export default correlator; diff --git a/types/express-correlation-id/tsconfig.json b/types/express-correlation-id/tsconfig.json new file mode 100644 index 0000000000..bcfa9423b6 --- /dev/null +++ b/types/express-correlation-id/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "express-correlation-id-tests.ts"] +} diff --git a/types/express-correlation-id/tslint.json b/types/express-correlation-id/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/express-correlation-id/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 03a4f2840fa327207575dbae02fcc6291f484ad4 Mon Sep 17 00:00:00 2001 From: Saffa Shujah Date: Mon, 14 May 2018 23:13:07 +0500 Subject: [PATCH 52/53] [@types/rebass] Missing Link Type Added (#25704) Missing Link Type Added --- types/rebass/index.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/types/rebass/index.d.ts b/types/rebass/index.d.ts index 53ec01bf87..f50691e116 100644 --- a/types/rebass/index.d.ts +++ b/types/rebass/index.d.ts @@ -264,6 +264,13 @@ export interface HeadingLinkProps extends BaseProps { type HeadingLinkClass = React.StatelessComponent export declare const HeadingLink: HeadingLinkClass; +export interface LinkProps extends BaseProps { + is?: string | Object | Function; + href?: string; +} +type LinkClass = React.StatelessComponent +export declare const Link: LinkClass; + export interface InlineFormProps extends BaseProps { label?: string; name?: string; From 98395d3d9a6b6d2de27571f16041870878adb670 Mon Sep 17 00:00:00 2001 From: Daryl LaBar Date: Mon, 14 May 2018 19:54:48 -0400 Subject: [PATCH 53/53] Made Optional Parameters Optional. Utilized AttributeType. (#25722) * Made Optional Parameters Optional. Utilized AttributeType * Fixed Lint Error --- types/xrm/index.d.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/types/xrm/index.d.ts b/types/xrm/index.d.ts index fe5d44214e..18d8cae218 100644 --- a/types/xrm/index.d.ts +++ b/types/xrm/index.d.ts @@ -1121,13 +1121,13 @@ declare namespace Xrm { * @deprecated Use {@link Xrm.WebApi.retrieveRecord} instead. * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ - retrieveRecord(entityType: string, id: string, options: string): Async.PromiseLike; + retrieveRecord(entityType: string, id: string, options?: string): Async.PromiseLike; /** * Retrieves a collection of entity records in mobile clients while working in the offline mode. * * @param entityType The logical name of the entity. - * @param options (Optional) The logical name of the enti + * @param options (Optional) The logical name of the entity * @param maxPageSize (Optional) A positive number to indicates the number of entity records to be returned per page. * * If you do not specify this parameter, the default value is passed as 5000. * * If the number of records being retrieved is more than maxPageSize, an @odata.nextLink property @@ -1144,7 +1144,7 @@ declare namespace Xrm { * @deprecated Use {@link Xrm.WebApi.retrieveMultipleRecords} instead. * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ - retrieveMultipleRecords(entityType: string, options: string, maxPageSize: number): Async.PromiseLike>; + retrieveMultipleRecords(entityType: string, options?: string, maxPageSize?: number): Async.PromiseLike>; /** * Updates an entity record in mobile clients while working in the offline mode. @@ -2100,7 +2100,7 @@ declare namespace Xrm { * * optionset * * string */ - getAttributeType(): string; + getAttributeType(): AttributeType; /** * Gets the attribute format. @@ -3541,9 +3541,9 @@ declare namespace Xrm { /** * Saves the record with the given save mode. - * @param saveMode (Optional) the save mode to save, as either "saveandclose" or "saveandnew". + * @param saveMode (Optional) the save mode to save, as either "saveandclose" or "saveandnew". If no parameter is included in the method, the record will simply be saved. */ - save(saveMode: EntitySaveMode): void; + save(saveMode?: EntitySaveMode): void; /** * The collection of attributes for the record. @@ -3692,14 +3692,14 @@ declare namespace Xrm { * Returns all process instances for the entity record that the calling user has access to. * @param callbackFunction (Optional) a function to call when the operation is complete. */ - getProcessInstances(callbackFunction: GetProcessInstancesDelegate): void; + getProcessInstances(callbackFunction?: GetProcessInstancesDelegate): void; /** * Sets a process instance as the active instance * @param processInstanceId The Id of the process instance to make the active instance. * @param callbackFunction (Optional) a function to call when the operation is complete. */ - setActiveProcessInstance(processInstanceId: string, callbackFunction: SetProcessInstanceDelegate): void; + setActiveProcessInstance(processInstanceId: string, callbackFunction?: SetProcessInstanceDelegate): void; /** * Returns a Stage object representing the active stage. @@ -3837,7 +3837,7 @@ declare namespace Xrm { * @param status The new status for the process * @param callbackFunction (Optional) a function to call when the operation is complete. */ - setStatus(status: ProcessStatus, callbackFunction: ProcessSetStatusDelegate): void; + setStatus(status: ProcessStatus, callbackFunction?: ProcessSetStatusDelegate): void; } /** @@ -4786,7 +4786,7 @@ declare namespace Xrm { * @returns On success, returns a promise containing a JSON object with the retrieved attributes and their values. * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/retrieverecord External Link: retrieveRecord (Client API reference)} */ - retrieveRecord(entityLogicalName: string, id: string, options: string): Async.PromiseLike; + retrieveRecord(entityLogicalName: string, id: string, options?: string): Async.PromiseLike; /** * Retrieves a collection of entity records.