From b3d5f7e64a34a6637198502c58b4b63bb8d114fb Mon Sep 17 00:00:00 2001 From: Arthur Langereis Date: Tue, 6 Oct 2015 14:50:10 +0200 Subject: [PATCH 01/96] add missing optional attributes parameter for getContext() and missing context attribute defs, thanks to @ander-nz --- webgl-ext/webgl-ext.d.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/webgl-ext/webgl-ext.d.ts b/webgl-ext/webgl-ext.d.ts index c6a8cb34a1..42a4ee21b8 100644 --- a/webgl-ext/webgl-ext.d.ts +++ b/webgl-ext/webgl-ext.d.ts @@ -6,9 +6,19 @@ // These definitions go beyond those already defined in TS 1.6.2 stdlib // All non-draft WebGL 1.0 extensions and prefixed extension names are // covered. +// Some missing parameters for getContext and fields for +// WebGLContextAttributes are added as well, copied over from +// Shane Anderson's webgl interfaces. + + +interface WebGLContextAttributes { + preferLowPowerToHighPerformance?: boolean; + failIfMajorPerformanceCaveat?: boolean; +} interface HTMLCanvasElement { - getContext(contextId: "webgl"): WebGLRenderingContext; + getContext(contextId: "experimental-webgl", attributes?: WebGLContextAttributes): WebGLRenderingContext; + getContext(contextId: "webgl", attributes?: WebGLContextAttributes): WebGLRenderingContext; } interface WebGLRenderingContext { From 09218a9c29af6d9b887c8b9bf593001e737addf2 Mon Sep 17 00:00:00 2001 From: Arthur Langereis Date: Wed, 7 Oct 2015 10:55:34 +0200 Subject: [PATCH 02/96] name update --- webgl-ext/webgl-ext.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webgl-ext/webgl-ext.d.ts b/webgl-ext/webgl-ext.d.ts index 42a4ee21b8..5be2ee07c3 100644 --- a/webgl-ext/webgl-ext.d.ts +++ b/webgl-ext/webgl-ext.d.ts @@ -8,7 +8,7 @@ // covered. // Some missing parameters for getContext and fields for // WebGLContextAttributes are added as well, copied over from -// Shane Anderson's webgl interfaces. +// Shane S. Anderson's definitions file. interface WebGLContextAttributes { From 09ca290d319700137d9a5fc66ce9f39f5813fee5 Mon Sep 17 00:00:00 2001 From: Arthur Langereis Date: Wed, 7 Oct 2015 11:15:03 +0200 Subject: [PATCH 03/96] add pre-defined attrs and link to spec for WebGLContextAttributes --- webgl-ext/webgl-ext.d.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/webgl-ext/webgl-ext.d.ts b/webgl-ext/webgl-ext.d.ts index 5be2ee07c3..f29d2c98d2 100644 --- a/webgl-ext/webgl-ext.d.ts +++ b/webgl-ext/webgl-ext.d.ts @@ -6,14 +6,28 @@ // These definitions go beyond those already defined in TS 1.6.2 stdlib // All non-draft WebGL 1.0 extensions and prefixed extension names are // covered. -// Some missing parameters for getContext and fields for +// Some missing parameters for getContext and attributes for // WebGLContextAttributes are added as well, copied over from // Shane S. Anderson's definitions file. interface WebGLContextAttributes { + // The following attributes are missing from TypeScript 1.6.2's lib.d.ts preferLowPowerToHighPerformance?: boolean; failIfMajorPerformanceCaveat?: boolean; + + // All others duplicated here for reference + /* + alpha?: boolean; + depth?: boolean; + stencil?: boolean; + antialias?: boolean; + premultipliedAlpha?: boolean; + preserveDrawingBuffer?: boolean; + */ + + // For the meanings and default values of these attributes, see the full spec at: + // https://www.khronos.org/registry/webgl/specs/latest/1.0/index.html#5.2 } interface HTMLCanvasElement { From 2ebc83a3182ddbd6ed8bae7bda37ac471940788f Mon Sep 17 00:00:00 2001 From: Robert Baruck Date: Tue, 16 Oct 2018 21:56:31 +0200 Subject: [PATCH 04/96] [react] add typings for react-close-on-escape (#29789) * [react] add typings for react-close-on-escape * TASK: make component default export --- types/react-close-on-escape/index.d.ts | 16 ++++++++++++ .../react-close-on-escape-tests.tsx | 12 +++++++++ types/react-close-on-escape/tsconfig.json | 25 +++++++++++++++++++ types/react-close-on-escape/tslint.json | 1 + 4 files changed, 54 insertions(+) create mode 100644 types/react-close-on-escape/index.d.ts create mode 100644 types/react-close-on-escape/react-close-on-escape-tests.tsx create mode 100644 types/react-close-on-escape/tsconfig.json create mode 100644 types/react-close-on-escape/tslint.json diff --git a/types/react-close-on-escape/index.d.ts b/types/react-close-on-escape/index.d.ts new file mode 100644 index 0000000000..2718cbcd82 --- /dev/null +++ b/types/react-close-on-escape/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for react-close-on-escape 3.0 +// Project: https://github.com/conorhastings/react-close-on-escape#readme +// Definitions by: Robert Baruck +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import * as React from "react"; + +export interface CloseOnEscapeProps { + /** + * Callback triggered by pressing ESC + */ + onEscape(): void; +} + +export default class CloseOnEscape extends React.Component {} diff --git a/types/react-close-on-escape/react-close-on-escape-tests.tsx b/types/react-close-on-escape/react-close-on-escape-tests.tsx new file mode 100644 index 0000000000..d86909034e --- /dev/null +++ b/types/react-close-on-escape/react-close-on-escape-tests.tsx @@ -0,0 +1,12 @@ +import * as React from 'react'; +import CloseOnEscape from 'react-close-on-escape'; + +const onEscapeCallback = () => {}; + +// $ExpectError +const missingRequired = ; + +// $ExpectError +const invalidExample = ; + +const validExample = ; diff --git a/types/react-close-on-escape/tsconfig.json b/types/react-close-on-escape/tsconfig.json new file mode 100644 index 0000000000..5a978970ff --- /dev/null +++ b/types/react-close-on-escape/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "lib": [ + "es6" + ], + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-close-on-escape-tests.tsx" + ] +} diff --git a/types/react-close-on-escape/tslint.json b/types/react-close-on-escape/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-close-on-escape/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 5037781c9a1dbc55386d06fc45d62767905d488e Mon Sep 17 00:00:00 2001 From: Lak Moore Date: Tue, 16 Oct 2018 22:41:21 +0100 Subject: [PATCH 05/96] ElasticSearch - add "slices" option to UpdateDocumentByQueryParams and update Response too (#29717) * Add slices option to UpdateDocumentByQueryParams and update Response for slices * 'npm run lint elasticsearch' would not pass without adding this extra export * Proposed changes for adding slices to request and response for Update and Delete ByQuery and ReIndex * ReIndexOrByQueryResponseBase => ReindexResponseBase * Simple type test for client.reindex() --- types/elasticsearch/elasticsearch-tests.ts | 15 ++++++ types/elasticsearch/index.d.ts | 53 ++++++++-------------- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/types/elasticsearch/elasticsearch-tests.ts b/types/elasticsearch/elasticsearch-tests.ts index 68625bd5bb..ee57f847fa 100644 --- a/types/elasticsearch/elasticsearch-tests.ts +++ b/types/elasticsearch/elasticsearch-tests.ts @@ -338,6 +338,21 @@ client.indices.updateAliases({ // ... }); +client.reindex({ + body: { + source: { + index: "twitter" + }, + dest: { + index: "new_twitter" + } + } +}) +.then(response => { + const { took, timed_out } = response; + // ... +}); + // Errors function testErrors() { throw new elasticsearch.errors.AuthenticationException(); diff --git a/types/elasticsearch/index.d.ts b/types/elasticsearch/index.d.ts index 69c881e700..0d16cc6a4b 100644 --- a/types/elasticsearch/index.d.ts +++ b/types/elasticsearch/index.d.ts @@ -281,26 +281,13 @@ export interface DeleteDocumentByQueryParams extends GenericParams { scrollSize?: number; waitForCompletion?: boolean; requestsPerSecond?: number; + slices?: number; index?: string; type?: string; } -export interface DeleteDocumentByQueryResponse { - took: number; - timed_out: boolean; - deleted: number; - batches: number; - version_conflicts: number; - noops: number; - retries: { - bulk: number; - search: number; - }; - throttled_millis: number; - requests_per_second: number; - throttled_until_millis: number; - total: number; - failures: any[]; +export interface DeleteDocumentByQueryResponse extends ReindexResponse { + // DeleteDocumentByQueryResponse, UpdateDocumentByQueryResponse and ReindexResponse are identical } export interface DeleteScriptParams extends GenericParams { @@ -531,6 +518,7 @@ export interface ReindexParams extends GenericParams { waitForActiveShards?: string; waitForCompletion?: boolean; requestsPerSecond?: number; + slices?: number; body: { conflicts?: string; source: { @@ -559,20 +547,6 @@ export interface ReindexParams extends GenericParams { }; } -export interface ReindexResponse { - took: number; - updated: number; - created: number; - batches: number; - version_conflicts: number; - retries: { - bulk: number; - search: number; - }; - throttled_millis: number; - failures: any[]; -} - export interface ReindexRethrottleParams extends GenericParams { requestsPerSecond: number; taskId: string; @@ -784,13 +758,28 @@ export interface UpdateDocumentByQueryParams extends GenericParams { scrollSize?: number; waitForCompletion?: boolean; requestsPerSecond?: number; + slices?: number; index: NameList; type: NameList; } -export interface UpdateDocumentByQueryResponse { +export interface UpdateDocumentByQueryResponse extends ReindexResponse { + // DeleteDocumentByQueryResponse, UpdateDocumentByQueryResponse and ReindexResponse are identical +} + +export interface ReindexResponse extends ReindexResponseBase { took: number; timed_out: boolean; + failures: any[]; + slices?: ReindexOrByQueryResponseSlice[]; +} + +export interface ReindexOrByQueryResponseSlice extends ReindexResponseBase { + slice_id: number; +} + +export interface ReindexResponseBase { + total: number; updated: number; deleted: number; batches: number; @@ -803,8 +792,6 @@ export interface UpdateDocumentByQueryResponse { throttled_millis: number; requests_per_second: number; throttled_until_millis: number; - total: number; - failures: any[]; } export interface Cat { From bbf1adeeacd4ac881e7d8546abc7101cd3de597d Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Tue, 16 Oct 2018 17:42:42 -0400 Subject: [PATCH 06/96] [jquery] Add `preDispatch` and `postDispatch` methods. Fix weak type issues. (#29750) * [jquery] Add `preDispatch` and `postDispatch` methods. See https://github.com/jquery/api.jquery.com/issues/752. * [jquery] Fix weak type issue for `SpecialEventHook`. * [jquery] Fix weak type issue for `FixHook`. * [jquery] Add interface for `jQuery.valHooks`. * [jquery] Fix weak type issue for `ValHook`. * [jquery] Add interface for `jQuery.cssHooks`. * [jquery] Properties on `CSSHook` are optional. * [jquery] Use polymorphic `this` for `settings` parameter. * [jquery] Wrap `StatusCodeCallbacks` in a region. * [jquery] Split `@since` tag for consistency. --- types/jquery/index.d.ts | 136 +++++++++++++-------- types/jquery/jquery-tests.ts | 176 +++++++++++++++++++++++++++- types/jquery/test/longdesc-tests.ts | 2 +- 3 files changed, 265 insertions(+), 49 deletions(-) diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index 344194e5af..3c10e8294d 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -60,8 +60,7 @@ interface JQueryStatic { * @see \`{@link https://api.jquery.com/jQuery.cssHooks/ }\` * @since 1.4.3 */ - // Set to HTMLElement to minimize breaks but should probably be Element. - cssHooks: JQuery.PlainObject>; + cssHooks: JQuery.CSSHooks; /** * An object containing all CSS properties that may be used without a unit. The .css() method uses this * object to see if it may append px to unitless values. @@ -118,8 +117,7 @@ $.when( support: JQuery.PlainObject; timers: Array>; Tween: JQuery.TweenStatic; - // Set to HTMLElement to minimize breaks but should probably be Element. - valHooks: JQuery.PlainObject>; + valHooks: JQuery.ValHooks; // HACK: This is the factory function returned when importing jQuery without a DOM. Declaring it separately breaks using the type parameter on JQueryStatic. // HACK: The discriminator parameter handles the edge case of passing a Window object to JQueryStatic. It doesn't actually exist on the factory function. (window: Window, discriminator: boolean): JQueryStatic; @@ -2021,7 +2019,8 @@ $.getScript( "myplugin.js", function() { * * @param html The HTML string on which to operate. * @see \`{@link https://api.jquery.com/jQuery.htmlPrefilter/ }\` - * @since 1.12/2.2 + * @since 1.12 + * @since 2.2 */ htmlPrefilter(html: JQuery.htmlString): JQuery.htmlString; /** @@ -26376,14 +26375,6 @@ declare namespace JQuery { * A string containing the URL to which the request is sent. */ url?: string; - /** - * A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, - * XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and - * settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend - * function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless - * of the type of request. - */ - beforeSend?(this: TContext, jqXHR: jqXHR, settings: AjaxSettings): false | void; } interface UrlAjaxSettings extends Ajax.AjaxSettingsBase { @@ -26391,14 +26382,6 @@ declare namespace JQuery { * A string containing the URL to which the request is sent. */ url: string; - /** - * A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, - * XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and - * settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend - * function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless - * of the type of request. - */ - beforeSend?(this: TContext, jqXHR: jqXHR, settings: UrlAjaxSettings): false | void; } namespace Ajax { @@ -26443,7 +26426,7 @@ declare namespace JQuery { * function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless * of the type of request. */ - beforeSend?(this: TContext, jqXHR: jqXHR, settings: AjaxSettingsBase): false | void; + beforeSend?(this: TContext, jqXHR: jqXHR, settings: this): false | void; /** * If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache * to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}" @@ -26673,6 +26656,9 @@ declare namespace JQuery { xhrFields?: XHRFields; } + // region StatusCodeCallbacks + // #region StatusCodeCallbacks + type StatusCodeCallbacks = { // region Success Status Codes // #region Success Status Codes @@ -27092,6 +27078,8 @@ declare namespace JQuery { [index: number]: SuccessCallback | ErrorCallback; }; + // #endregion + // Writable properties on XMLHttpRequest interface XHRFields extends Partial> { msCaching?: string; @@ -27575,12 +27563,24 @@ callbacks.fire( "world" ); // #endregion - // region CSS - // #region CSS + // region CSS hooks + // #region CSS hooks - interface CSSHook { - get(this: this, elem: TElement, computed: any, extra: any): any; - set(this: this, elem: TElement, value: any): void; + // Workaround for TypeScript 2.3 which does not have support for weak types handling. + type CSSHook = + Partial<_CSSHook> & ( + Pick<_CSSHook, 'get'> | + Pick<_CSSHook, 'set'> + ); + + interface _CSSHook { + get(elem: TElement, computed: any, extra: any): any; + set(elem: TElement, value: any): void; + } + + interface CSSHooks { + // Set to HTMLElement to minimize breaks but should probably be Element. + [propertyName: string]: CSSHook; } // #endregion @@ -31342,13 +31342,18 @@ $( "ul" ).click( handler ).find( "ul" ).hide(); special: SpecialEventHooks; } - interface FixHook { + // region Fix hooks + // #region Fix hooks + + // Workaround for TypeScript 2.3 which does not have support for weak types handling. + type FixHook = { /** * Strings representing properties that should be copied from the browser's event object to the jQuery * event object. If omitted, no additional properties are copied beyond the standard ones that jQuery * copies and normalizes (e.g. `event.target` and `event.relatedTarget`). */ - props?: string[]; + props: string[]; + } | { /** * jQuery calls this function after it constructs the `jQuery.Event` object, copies standard properties * from `jQuery.event.props`, and copies the `fixHooks`-specific props (if any) specified above. The @@ -31399,8 +31404,10 @@ if ( !existingHook ) { } ``` */ - filter?(event: Event, originalEvent: _Event): void; - } + filter(event: Event, originalEvent: _Event): void; + } | { + [key: string]: never; + }; /** * The `fixHooks` interface provides a per-event-type way to extend or normalize the event object that @@ -31412,6 +31419,8 @@ if ( !existingHook ) { [event: string]: FixHook; } + // #endregion + // region Special event hooks // #region Special event hooks @@ -31428,7 +31437,8 @@ if ( !existingHook ) { * * @see \`{@link https://learn.jquery.com/events/event-extensions/#special-event-hooks }\` */ - interface SpecialEventHook { + // Workaround for TypeScript 2.3 which does not have support for weak types handling. + type SpecialEventHook = { /** * Indicates whether this event type should be bubbled when the `.trigger()` method is called; by * default it is `false`, meaning that a triggered event will bubble to the element's parents up to the @@ -31437,7 +31447,8 @@ if ( !existingHook ) { * * @see \`{@link https://learn.jquery.com/events/event-extensions/#nobubble-boolean }\` */ - noBubble?: boolean; + noBubble: boolean; + } | { /** * When defined, these string properties specify that a special event should be handled like another * event type until the event is delivered. The `bindType` is used if the event is attached directly, @@ -31446,7 +31457,8 @@ if ( !existingHook ) { * * @see \`{@link https://learn.jquery.com/events/event-extensions/#bindtype-string-delegatetype-string }\` */ - bindType?: string; + bindType: string; + } | { /** * When defined, these string properties specify that a special event should be handled like another * event type until the event is delivered. The `bindType` is used if the event is attached directly, @@ -31455,7 +31467,8 @@ if ( !existingHook ) { * * @see \`{@link https://learn.jquery.com/events/event-extensions/#bindtype-string-delegatetype-string }\` */ - delegateType?: string; + delegateType: string; + } | { /** * The setup hook is called the first time an event of a particular type is attached to an element; * this provides the hook an opportunity to do processing that will apply to all events of this type on @@ -31474,7 +31487,8 @@ if ( !existingHook ) { * * @see \`{@link https://learn.jquery.com/events/event-extensions/#setup-function-data-object-namespaces-eventhandle-function }\` */ - setup?(this: TTarget, data: TData, namespaces: string, eventHandle: EventHandler): void | false; + setup(this: TTarget, data: TData, namespaces: string, eventHandle: EventHandler): void | false; + } | { /** * The teardown hook is called when the final event of a particular type is removed from an element. * The `this` keyword will be a reference to the element where the event is being cleaned up. This hook @@ -31489,7 +31503,8 @@ if ( !existingHook ) { * * @see \`{@link https://learn.jquery.com/events/event-extensions/#teardown-function }\` */ - teardown?(this: TTarget): void | false; + teardown(this: TTarget): void | false; + } | { /** * Each time an event handler is added to an element through an API such as `.on()`, jQuery calls this * hook. The `this` keyword will be the element to which the event handler is being added, and the @@ -31497,7 +31512,8 @@ if ( !existingHook ) { * * @see \`{@link https://learn.jquery.com/events/event-extensions/#add-function-handleobj }\` */ - add?(this: TTarget, handleObj: HandleObject): void; + add(this: TTarget, handleObj: HandleObject): void; + } | { /** * When an event handler is removed from an element using an API such as `.off()`, this hook is called. * The `this` keyword will be the element where the handler is being removed, and the `handleObj` @@ -31505,7 +31521,8 @@ if ( !existingHook ) { * * @see \`{@link https://learn.jquery.com/events/event-extensions/#remove-function-handleobj }\` */ - remove?(this: TTarget, handleObj: HandleObject): void; + remove(this: TTarget, handleObj: HandleObject): void; + } | { /** * Called when the `.trigger()` or `.triggerHandler()` methods are used to trigger an event for the * special type from code, as opposed to events that originate from within the browser. The `this` @@ -31524,7 +31541,8 @@ if ( !existingHook ) { * * @see \`{@link https://learn.jquery.com/events/event-extensions/#trigger-function-event-jquery-event-data-object }\` */ - trigger?(this: TTarget, event: Event, data: TData): void | false; + trigger(this: TTarget, event: Event, data: TData): void | false; + } | { /** * When the `.trigger()` method finishes running all the event handlers for an event, it also looks for * and runs any method on the target object by the same name unless of the handlers called `event.preventDefault()`. @@ -31535,7 +31553,8 @@ if ( !existingHook ) { * * @see \`{@link https://learn.jquery.com/events/event-extensions/#_default-function-event-jquery-event-data-object }\` */ - _default?(event: Event, data: TData): void | false; + _default(event: Event, data: TData): void | false; + } | { /** * jQuery calls a handle hook when the event has occurred and jQuery would normally call the user's event * handler specified by `.on()` or another event binding method. If the hook exists, jQuery calls it @@ -31555,8 +31574,14 @@ if ( !existingHook ) { * * @see \`{@link https://learn.jquery.com/events/event-extensions/#handle-function-event-jquery-event-data-object }\` */ - handle?(this: TTarget, event: Event & { handleObj: HandleObject; }, ...data: TData[]): void; - } + handle(this: TTarget, event: Event & { handleObj: HandleObject; }, ...data: TData[]): void; + } | { + preDispatch(this: TTarget, event: Event): false | void; + } | { + postDispatch(this: TTarget, event: Event): void; + } | { + [key: string]: never; + }; interface SpecialEventHooks { [event: string]: SpecialEventHook; @@ -31615,6 +31640,9 @@ if ( !existingHook ) { value: string; } + // region Coordinates + // #region Coordinates + interface Coordinates { left: number; top: number; @@ -31626,11 +31654,27 @@ if ( !existingHook ) { Pick | { [key: string]: never; }; - interface ValHook { - get?(elem: TElement): any; - set?(elem: TElement, value: any): any; + // #endregion + + // region Val hooks + // #region Val hooks + + // Workaround for TypeScript 2.3 which does not have support for weak types handling. + type ValHook = { + get(elem: TElement): any; + } | { + set(elem: TElement, value: any): any; + } | { + [key: string]: never; + }; + + interface ValHooks { + // Set to HTMLElement to minimize breaks but should probably be Element. + [nodeName: string]: ValHook; } + // #endregion + type _Falsy = false | null | undefined | 0 | '' | typeof document.all; } diff --git a/types/jquery/jquery-tests.ts b/types/jquery/jquery-tests.ts index 31518d8d84..1fb00ad9ab 100644 --- a/types/jquery/jquery-tests.ts +++ b/types/jquery/jquery-tests.ts @@ -19,7 +19,7 @@ function JQueryStatic() { } function cssHooks() { - // $ExpectType PlainObject> + // $ExpectType CSSHooks $.cssHooks; } @@ -84,7 +84,7 @@ function JQueryStatic() { } function valHooks() { - // $ExpectType PlainObject> + // $ExpectType ValHooks $.valHooks; } @@ -7119,6 +7119,51 @@ function JQuery_Callbacks() { } } +function JQuery_CSSHooks() { + $.cssHooks.borderRadius = { + get(elem, computed, extra) { + // $ExpectedType HTMLElement + elem; + // $ExpectedType any + computed; + // $ExpectedType any + extra; + }, + set(elem, value) { + // $ExpectedType HTMLElement + elem; + // $ExpectedType any + value; + } + }; + + $.cssHooks.borderRadius = { + get(elem, computed, extra) { + // $ExpectedType HTMLElement + elem; + // $ExpectedType any + computed; + // $ExpectedType any + extra; + } + }; + + $.cssHooks.borderRadius = { + set(elem, value) { + // $ExpectedType HTMLElement + elem; + // $ExpectedType any + value; + } + }; + + // Weak type test. This may be removed if the TypeScript requirement is increased to 2.4+. + // $ExpectError + $.cssHooks.borderRadius = function get(elem: HTMLElement, computed: any, extra: any) { + return 1; + }; +} + function JQuery_Promise3() { interface I1 { kind: 'I1'; } interface I2 { kind: 'I2'; } @@ -8143,3 +8188,130 @@ function JQuery_Event() { $(window).trigger(event); } } + +function JQuery_EventExtensions() { + function fixHooks() { + jQuery.event.fixHooks.drop = { + props: ['dataTransfer'], + filter(event, originalEvent) { + // $ExpectType Event + event; + // $ExpectType Event + originalEvent; + }, + }; + + // Weak type test. This may be removed if the TypeScript requirement is increased to 2.4+. + // $ExpectError + jQuery.event.fixHooks.drop = ['dataTransfer']; + } + + function special() { + jQuery.event.special.multiclick = { + noBubble: true, + bindType: 'click', + delegateType: 'click', + setup(data, namespaces, eventHandle) { + // $ExpectType EventTarget + this; + // $ExpectType any + data; + // $ExpectType string + namespaces; + // $ExpectType EventHandler + eventHandle; + + return false; + }, + teardown() { + // $ExpectType EventTarget + this; + + return false; + }, + add(handleObj) { + // $ExpectType EventTarget + this; + // $ExpectType HandleObject + handleObj; + }, + remove(handleObj) { + // $ExpectType EventTarget + this; + // $ExpectType HandleObject + handleObj; + }, + trigger(event, data) { + // $ExpectType EventTarget + this; + // $ExpectType Event + event; + // $ExpectType any + data; + + return false; + }, + _default(event, data) { + // $ExpectType Event + event; + // $ExpectType any + data; + + return false; + }, + handle(event, data) { + // $ExpectType Event & { handleObj: HandleObject; } + event; + // $ExpectType any + data; + }, + preDispatch(event) { + // $ExpectType EventTarget + this; + // $ExpectType Event + event; + + return false; + }, + postDispatch(event) { + // $ExpectType EventTarget + this; + // $ExpectType Event + event; + } + }; + + // Weak type test. This may be removed if the TypeScript requirement is increased to 2.4+. + // $ExpectError + jQuery.event.special.multiclick = 1; + } +} + +declare namespace JQuery { + interface ValHooks { + textarea: ValHook; + } +} + +function JQuery_ValHooks() { + jQuery.valHooks.textarea = { + get(elem) { + // $ExpectType HTMLTextAreaElement + elem; + + return elem.value.replace(/\r?\n/g, "\r\n"); + }, + set(elem) { + // $ExpectType HTMLTextAreaElement + elem; + + return elem.value; + } + }; + + // Weak type test. This may be removed if the TypeScript requirement is increased to 2.4+. + // $ExpectError + jQuery.valHooks.textarea = function get(elem: HTMLTextAreaElement) { + return elem.value.replace(/\r?\n/g, "\r\n"); + }; +} diff --git a/types/jquery/test/longdesc-tests.ts b/types/jquery/test/longdesc-tests.ts index 4390ae014a..35d7f61646 100644 --- a/types/jquery/test/longdesc-tests.ts +++ b/types/jquery/test/longdesc-tests.ts @@ -1341,7 +1341,7 @@ function longdesc() { function jquery_css_hooks_6() { $.fx.step.someCSSProp = function(fx) { - $.cssHooks.someCSSProp.set(fx.elem as HTMLElement, fx.now + fx.unit); + $.cssHooks.someCSSProp.set!(fx.elem as HTMLElement, fx.now + fx.unit); }; } From 2a4a6d66af7020298689e7be6e2fa0398ef27b53 Mon Sep 17 00:00:00 2001 From: Eunchong Yu Date: Thu, 18 Oct 2018 00:41:51 +0900 Subject: [PATCH 07/96] [koa-websocket] Fix to match with its implementation (#29611) * Fix koa-websocket to match with its implementation The major change is about `Middleware`. Koa-websocket doesn't inject `this` argument to its middlewares. Instead, additional properties are appended on the Koa context. https://github.com/kudos/koa-websocket/blob/master/index.js * Extract Context.websocket It's necessary to use well with other middlewares, like koa-router or else. * Add Context.app to be able to access ctx.app.ws * Add a test about Context.app * Remove the target requirement --- types/koa-websocket/index.d.ts | 27 ++++++++++++++-------- types/koa-websocket/koa-websocket-tests.ts | 14 ++++++++--- types/koa-websocket/tsconfig.json | 2 +- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/types/koa-websocket/index.d.ts b/types/koa-websocket/index.d.ts index 91b50b5ace..c23c9036b8 100644 --- a/types/koa-websocket/index.d.ts +++ b/types/koa-websocket/index.d.ts @@ -3,32 +3,41 @@ // Definitions by: Maël Lavault // Jaco Greeff // Martin Ždila +// Eunchong Yu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 import Koa = require('koa'); +import compose = require('koa-compose'); import * as ws from 'ws'; import * as http from 'http'; import * as https from 'https'; -declare namespace KoaWebsocket { - type ConnectionHandler = (socket: ws) => void; - - type Middleware = (this: MiddlewareContext, context: Koa.Context, next: () => Promise) => any; - - interface MiddlewareContext extends Koa.Context { +declare module "koa" { + interface Context { websocket: ws; path: string; } +} + +declare namespace KoaWebsocket { + type Middleware = compose.Middleware; + + interface MiddlewareContext extends Koa.Context { + // Limitation: Declaration merging cannot overwrap existing properties. + // That's why this property is here, not in the merged declaration above. + app: App; + } class Server { - app: Koa; - middleware: Koa.Middleware[]; + app: App; + middleware: Middleware[]; + server?: ws.Server; constructor(app: Koa); listen(options: ws.ServerOptions): ws.Server; - onConnection(handler: ConnectionHandler): void; + onConnection(socket: ws, request: http.IncomingMessage): void; use(middleware: Middleware): this; } diff --git a/types/koa-websocket/koa-websocket-tests.ts b/types/koa-websocket/koa-websocket-tests.ts index bd99c3d17e..502b366652 100644 --- a/types/koa-websocket/koa-websocket-tests.ts +++ b/types/koa-websocket/koa-websocket-tests.ts @@ -3,11 +3,19 @@ import websocket = require('koa-websocket'); const app = websocket(new Koa()); -app.ws.use(async function(context, next) { - this.websocket.on('message', (message) => { +app.ws.use(async (ctx, next) => { + ctx.websocket.on('message', (message) => { console.log(message); + const server = ctx.app.ws.server; + if (server) { + server.clients.forEach(client => { + if (client !== ctx.websocket) { + client.send(message); + } + }); + } }); - this.websocket.send('Hello world'); + ctx.websocket.send('Hello world'); await next(); }); diff --git a/types/koa-websocket/tsconfig.json b/types/koa-websocket/tsconfig.json index 87c9225d08..ffe283f2ad 100644 --- a/types/koa-websocket/tsconfig.json +++ b/types/koa-websocket/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "koa-websocket-tests.ts" ] -} \ No newline at end of file +} From fb1a9771d48ef02d8cf7c1fe38930c5acefcc0ed Mon Sep 17 00:00:00 2001 From: Dimitry Date: Wed, 17 Oct 2018 18:44:11 +0300 Subject: [PATCH 08/96] react-native-video: add tolerance to seek method (#29640) * react-native-video: add tolerance to seek method * react-native-video: add allowsExternalPlayback prop --- types/react-native-video/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/react-native-video/index.d.ts b/types/react-native-video/index.d.ts index ad1be7a0b4..190d731394 100644 --- a/types/react-native-video/index.d.ts +++ b/types/react-native-video/index.d.ts @@ -68,6 +68,7 @@ export interface VideoProperties extends ViewProps { currentTime?: number; progressUpdateInterval?: number; useTextureView?: boolean; + allowsExternalPlayback?: boolean; onLoadStart?(): void; onLoad?(data: OnLoadData): void; onBuffer?(): void; @@ -99,7 +100,7 @@ export interface VideoProperties extends ViewProps { } export default class Video extends React.Component { - seek(time: number): void; + seek(time: number, tolerance?: number): void; presentFullscreenPlayer(): void; dismissFullscreenPlayer(): void; } From 33f3666a20a6d8d9d04b7fb19debada7dd585bc7 Mon Sep 17 00:00:00 2001 From: Oscar Busk Date: Wed, 17 Oct 2018 17:45:47 +0200 Subject: [PATCH 09/96] Fix issue with properties clashing with jqueryui --- types/angular-ui-sortable/index.d.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/types/angular-ui-sortable/index.d.ts b/types/angular-ui-sortable/index.d.ts index aa81038346..9ecf06e112 100644 --- a/types/angular-ui-sortable/index.d.ts +++ b/types/angular-ui-sortable/index.d.ts @@ -2,12 +2,16 @@ // Project: https://github.com/angular-ui/ui-sortable // Definitions by: Thodoris Greasidis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.4 /// +/// import * as ng from 'angular'; +// Diff / Omit taken from https://github.com/Microsoft/TypeScript/issues/12215#issuecomment-311923766 +type Omit = Pick; + declare module 'angular' { export namespace ui { @@ -79,11 +83,11 @@ declare module 'angular' { isCustomHelperUsed(): Boolean; } - interface UISortableUIItem extends ng.IAugmentedJQuery { + interface UISortableUIItem extends Omit { sortable: UISortableProperties; } - interface UISortableUIParams extends SortableUIParams { + interface UISortableUIParams extends Omit { item: UISortableUIItem; } From 5ae6d3dd4f2763485f48683bf07dfabfbb5c2d9e Mon Sep 17 00:00:00 2001 From: Dan Manastireanu <498419+danmana@users.noreply.github.com> Date: Wed, 17 Oct 2018 18:46:32 +0300 Subject: [PATCH 10/96] Update amplitude-js to 4.4.0 (#29649) --- types/amplitude-js/amplitude-js-tests.ts | 143 +++++++++++++---------- types/amplitude-js/index.d.ts | 109 +++++++++++++++-- 2 files changed, 181 insertions(+), 71 deletions(-) diff --git a/types/amplitude-js/amplitude-js-tests.ts b/types/amplitude-js/amplitude-js-tests.ts index 4f3c2ea307..c5ffbe9898 100644 --- a/types/amplitude-js/amplitude-js-tests.ts +++ b/types/amplitude-js/amplitude-js-tests.ts @@ -1,85 +1,110 @@ // Tests for Amplitude SDK TypeScript definitions module Amplitude.Tests { + function all() { - amplitude.init('YOUR_API_KEY_HERE', null, { - // optional configuration options + var client: amplitude.AmplitudeClient = new amplitude.AmplitudeClient(); + var identify: amplitude.Identify = new amplitude.Identify(); + var revenue: amplitude.Revenue = new amplitude.Revenue(); + + client = amplitude.getInstance(); + client = amplitude.getInstance('some name'); + + amplitude.__VERSION__ === '1.2.3'; + amplitude.options.logLevel = 'WARN'; + + amplitude.init('API_KEY', 'USER_ID', { saveEvents: true, includeUtm: true, includeReferrer: true, batchEvents: true, eventUploadThreshold: 50 - }); - amplitude.init('YOUR_API_KEY_HERE', 'USER_ID_HERE', null, () => {}); + }, function () { }); + amplitude.init('API_KEY', 'USER_ID', { includeReferrer: true, includeUtm: true }); + amplitude.init('API_KEY', 'USER_ID'); + amplitude.init('API_KEY'); - amplitude.logEvent('EVENT_IDENTIFIER_HERE'); - amplitude.setUserId('USER_ID_HERE'); - amplitude.init('YOUR_API_KEY_HERE', 'USER_ID_HERE'); - amplitude.setUserId(null); // not string 'null' - amplitude.setVersionName('VERSION_NAME_HERE'); - - amplitude.regenerateDeviceId(); - amplitude.setDeviceId('CUSTOM_DEVICE_ID'); - - amplitude.logEvent('EVENT_IDENTIFIER_HERE', { - 'color': 'blue', - 'age': 20, - 'key': 'value' - }); + amplitude.logEvent('Clicked Homepage Button', { 'finished_flow': false, 'clicks': 15 }); + amplitude.logEvent('EVENT_IDENTIFIER_HERE', { 'color': 'blue', 'age': 20, 'key': 'value' }); amplitude.logEvent("EVENT_IDENTIFIER_HERE", null, (httpCode, response) => { }); + amplitude.logEventWithGroups('initialize_game', { 'key': 'value' }, { 'sport': 'soccer' }); + + amplitude.setDeviceId('45f0954f-eb79-4463-ac8a-233a6f45a8f0'); + amplitude.setDomain('.amplitude.com'); + amplitude.setGroup('orgId', '15'); + amplitude.setGroup('orgId', ['15', '16']); + amplitude.setUserId('joe@gmail.com'); + amplitude.setUserProperties({ 'gender': 'female', 'sign_up_complete': true }) + amplitude.setVersionName('1.12.3'); + amplitude.isNewSession(); + amplitude.getSessionId() === 123; - let identify = new amplitude.Identify().set('gender', 'female').set('age', 20); amplitude.identify(identify); + amplitude.logRevenue(3.99, 1, 'product_1234'); + amplitude.logRevenueV2(revenue); - identify = new amplitude.Identify().setOnce('sign_up_date', '08/24/2015'); - amplitude.identify(identify); - identify = new amplitude.Identify().setOnce('sign_up_date', '09/14/2015'); - amplitude.identify(identify); + client.init('API_KEY', 'USER_ID', { + saveEvents: true, + includeUtm: true, + includeReferrer: true, + batchEvents: true, + eventUploadThreshold: 50 + }, function () { }); + client.init('API_KEY', 'USER_ID', { includeReferrer: true, includeUtm: true }); + client.init('API_KEY', 'USER_ID'); + client.init('API_KEY'); - identify = new amplitude.Identify().unset('gender').unset('age'); - amplitude.identify(identify); + client.logEvent('Clicked Homepage Button', { 'finished_flow': false, 'clicks': 15 }); + client.logEvent('EVENT_IDENTIFIER_HERE', { 'color': 'blue', 'age': 20, 'key': 'value' }); + client.logEvent("EVENT_IDENTIFIER_HERE", null, (httpCode, response) => { }); + client.logEventWithGroups('initialize_game', { 'key': 'value' }, { 'sport': 'soccer' }); + client.logEventWithTimestamp('EVENT_IDENTIFIER_HERE', { 'key': 'value' }, 1505430378000, (httpCode, response) => { }); + + client.setDeviceId('45f0954f-eb79-4463-ac8a-233a6f45a8f0'); + client.setDomain('.amplitude.com'); + client.setUserId('joe@gmail.com'); + client.setOptOut(true); + client.setGroup('type', 'name'); + client.setGroup('type', ['name', 'name2']); + client.setUserProperties({ 'gender': 'female', 'sign_up_complete': true }); + client.setGlobalUserProperties({ 'gender': 'female', 'sign_up_complete': true }); + client.setVersionName('1.12.3'); + client.setSessionId(1505430378000); + + client.options.logLevel = 'WARN'; + client.getSessionId() === 123; + client.isNewSession() === true; + client.regenerateDeviceId(); + client.clearUserProperties(); + + client.identify(identify); + client.logRevenue(3.99, 1, 'product_1234'); + client.logRevenueV2(revenue); + + + identify = new amplitude.Identify().set('colors', ['rose', 'gold']).add('karma', 1).setOnce('sign_up_date', '2016-03-31'); identify = new amplitude.Identify().add('karma', 1).add('friends', 1); - amplitude.identify(identify); - - identify = new amplitude.Identify().append('ab-tests', 'new-user-test').append('some_list', [1, 2, 3, 4, 'values']); - amplitude.identify(identify); - - identify = new amplitude.Identify().prepend('ab-tests', 'new-user-test').prepend('some_list', [1, 2, 3, 4, 'values']); - amplitude.identify(identify); - - identify = new amplitude.Identify() - .set('karma', 10) - .add('karma', 1) - .unset('karma'); - amplitude.identify(identify); - + identify = new amplitude.Identify().set('karma', 10).add('karma', 1).unset('karma'); + identify = new amplitude.Identify().append('ab-tests', 'new-user-tests'); + identify.append('some_list', [1, 2, 3, 4, 'values']); + identify = new amplitude.Identify().prepend('ab-tests', 'new-user-tests'); + identify.prepend('some_list', [1, 2, 3, 4, 'values']); + identify = new amplitude.Identify().set('user_type', 'beta'); + identify.set('name', { 'first': 'John', 'last': 'Doe' }); + identify = new amplitude.Identify().setOnce('sign_up_date', '2016-04-01'); + identify = new amplitude.Identify().unset('user_type').unset('age'); identify = new amplitude.Identify() .set('colors', ['rose', 'gold']) .append('ab-tests', 'campaign_a') .append('existing_list', [4, 5]); - amplitude.identify(identify); - amplitude.setUserProperties({ - gender: 'female', - age: 20 - }); - amplitude.clearUserProperties(); - - amplitude.setOptOut(true); - amplitude.setOptOut(false); - - amplitude.setGroup('orgId', '15'); - amplitude.setGroup('sport', ['soccer', 'tennis']); - - // TODO: Implement those. - /* - var revenue = new amplitude.Revenue().setProductId('com.company.productId').setPrice(3.99).setQuantity(3); - amplitude.logRevenueV2(revenue); - - amplitude.logEventWithGroups('initialize_game', { 'key': 'value' }, { 'sport': 'soccer' }); - */ + revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99); + revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99).setEventProperties({ 'city': 'San Francisco' }); + revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99).setQuantity(5); + revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99).setRevenueType('purchase'); } + } diff --git a/types/amplitude-js/index.d.ts b/types/amplitude-js/index.d.ts index 613f5ad5d8..1cdb843589 100644 --- a/types/amplitude-js/index.d.ts +++ b/types/amplitude-js/index.d.ts @@ -1,61 +1,146 @@ -// Type definitions for Amplitude SDK 2.12.1 +// Type definitions for Amplitude SDK 4.4.0 // Project: https://github.com/amplitude/Amplitude-Javascript // Definitions by: Arvydas Sidorenko -// Definitions: https://github.com/Asido/DefinitelyTyped +// Dan Manastireanu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module amplitude { + + type Callback = (responseCode: number, responseBody: string, details?: { reason: string; }) => void; + type LogReturn = number | void; + interface Config { + apiEndpoint?: string; batchEvents?: boolean; cookieExpiration?: number; cookieName?: string; + userId?: string; deviceId?: string; + deviceIdFromUrlParam?: boolean; domain?: string; eventUploadPeriodMillis?: number; eventUploadThreshold?: number; + forceHttps?: boolean; + includeGclid?: boolean; includeReferrer?: boolean; includeUtm?: boolean; language?: string; + logLevel?: 'DISABLE' | 'ERROR' | 'WARN' | 'INFO'; optOut?: boolean; platform?: string; saveEvents?: boolean; savedMaxCount?: number; + saveParamsReferrerOncePerSession?: boolean; sessionTimeout?: number; + trackingOptions?: { + city?: boolean; + country?: boolean; + device_model?: boolean; + dma?: boolean; + ip_address?: boolean; + language?: boolean; + os_name?: boolean; + os_version?: boolean; + platform?: boolean; + region?: boolean; + version_name?: boolean; + }, + unsentKey?: string; + unsentIdentifyKey?: string; uploadBatchSize?: number; } export class Identify { set(key: string, value: any): Identify; setOnce(key: string, value: any): Identify; - add(key: string, value: number): Identify; + add(key: string, value: number | string): Identify; append(key: string, value: any): Identify; prepend(key: string, value: any): Identify; unset(key: string): Identify; } - export function init(apiKey: string): void; - export function init(apiKey: string, userId: string): void; - export function init(apiKey: string, userId: string, options: Config): void; - export function init(apiKey: string, userId: string, options: Config, callback: () => void): void; + export class Revenue { + + setProductId(productId: string): Revenue; + setQuantity(quantity: number): Revenue; + setPrice(price: number): Revenue; + setRevenueType(revenueType: string): Revenue; + setEventProperties(eventProperties: any): Revenue; + } + + export class AmplitudeClient { + + constructor(instanceName?: string); + + options: Config; + + init(apiKey: string, userId?: string, config?: Config, callback?: (client: AmplitudeClient) => void): void; + + setVersionName(versionName: string): void; + + isNewSession(): boolean; + setSessionId(sessionId: number): void; + getSessionId(): number; + + setDomain(domain: string): void; + setUserId(userId: string): void; + + setDeviceId(id: string): void; + regenerateDeviceId(): void; + + identify(identify_obj: Identify, opt_callback?: Callback): void; + + setUserProperties(properties: any): void; + setGlobalUserProperties(properties: any): void; + clearUserProperties(): void; + + setOptOut(enable: boolean): void; + + setGroup(groupType: string, groupName: string | string[]): void; + + logEvent(event: string, data?: any, callback?: Callback): LogReturn; + logEventWithGroups(event: string, data?: any, groups?: any, callback?: Callback): LogReturn; + logRevenueV2(revenue_obj: Revenue): LogReturn; + logRevenue(pric: number, quantity: number, product: string): LogReturn; + logEventWithTimestamp(event: string, data?: any, timestamp?: number, callback?: Callback): LogReturn; + } + + // Proxy methods that get executed on the default AmplitudeClient instance (not all client methods are proxied) + + export function init(apiKey: string, userId?: string, options?: Config, callback?: (client: AmplitudeClient) => void): void; export function setVersionName(version: string): void; + + export function isNewSession(): boolean; + export function getSessionId(): number; + + export function setDomain(domain: string): void; + export function setUserId(userId: string): void; export function setDeviceId(id: string): void; export function regenerateDeviceId(): void; - export function identify(identify: Identify): void; + export function identify(identify: Identify, callback?: Callback): void; - export function setUserProperties(properties: Object): void; + export function setUserProperties(properties: any): void; + export function setGlobalUserProperties(properties: any): void; export function clearUserProperties(): void; export function setOptOut(optOut: boolean): void; export function setGroup(groupType: string, groupName: string | string[]): void; - export function logEvent(event: string): void; - export function logEvent(event: string, data: Object): void; - export function logEvent(event: string, data: Object, callback: (httpCode: number, response: any) => void): void; + export function logEvent(event: string, data?: any, callback?: Callback): LogReturn; + export function logEventWithGroups(event: string, data?: any, groups?: any, callback?: Callback): LogReturn; + export function logRevenueV2(revenue_obj: Revenue): LogReturn; + export function logRevenue(pric: number, quantity: number, product: string): LogReturn; + export function logEventWithTimestamp(event: string, data?: any, timestamp?: number, callback?: Callback): LogReturn; + + + export function getInstance(instanceName?: string): AmplitudeClient; + export const __VERSION__: string; export var options: Config; } From 8a342681894fb74a6d25b4aae06a270c2dee85e6 Mon Sep 17 00:00:00 2001 From: Lenny Date: Wed, 17 Oct 2018 08:50:32 -0700 Subject: [PATCH 11/96] [@types/stripe] deleteExternalAccount should return IDeleteConfirmation (#29673) --- types/stripe/index.d.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index 9b0fe09059..732a58fc7d 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -5493,8 +5493,8 @@ declare namespace Stripe { * currency is not the Stripe account's default currency. Otherwise, you must set another external account to be the default for the currency * before deleting it. */ - deleteExternalAccount(accId: string, id: string, options: HeaderOptions, response?: IResponseFn): Promise; - deleteExternalAccount(accId: string, id: string, response?: IResponseFn): Promise; + deleteExternalAccount(accId: string, id: string, options: HeaderOptions, response?: IResponseFn): Promise; + deleteExternalAccount(accId: string, id: string, response?: IResponseFn): Promise; /** * You can see a list of the bank accounts belonging to a managed account. Note that the 10 most recent external accounts are always @@ -7365,7 +7365,11 @@ declare namespace Stripe { (err: IStripeError, value: R): void; } - interface IDeleteConfirmation { id: string; deleted: boolean; } + interface IDeleteConfirmation { + id: string; + object: string; + deleted: boolean; + } /** * A filter on the list based on this object field. The value can From 83b0f8edf05f6fd251dd0b307cd638811b735efe Mon Sep 17 00:00:00 2001 From: Ste Prescott Date: Wed, 17 Oct 2018 16:53:06 +0100 Subject: [PATCH 12/96] Expose properties of HttpProxyAgent (#29745) * Expose properties of HttpProxyAgent * Use 4 spaces over tabs * Remove options & timeout properties --- types/http-proxy-agent/http-proxy-agent-tests.ts | 3 +++ types/http-proxy-agent/index.d.ts | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/types/http-proxy-agent/http-proxy-agent-tests.ts b/types/http-proxy-agent/http-proxy-agent-tests.ts index f730cd1bde..2158a9129f 100644 --- a/types/http-proxy-agent/http-proxy-agent-tests.ts +++ b/types/http-proxy-agent/http-proxy-agent-tests.ts @@ -5,6 +5,9 @@ new Agent('url'); new Agent({}); new Agent({ host: 'url' }); +new Agent({}).proxy; +new Agent({}).secureProxy; + // $ExpectError new Agent(); diff --git a/types/http-proxy-agent/index.d.ts b/types/http-proxy-agent/index.d.ts index 015508b5d1..b518fddf0c 100644 --- a/types/http-proxy-agent/index.d.ts +++ b/types/http-proxy-agent/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for http-proxy-agent 2.0 // Project: https://github.com/TooTallNate/node-http-proxy-agent // Definitions by: mrmlnc +// steprescott // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -10,6 +11,9 @@ import { Url } from 'url'; declare class HttpProxyAgent extends Agent { constructor(options: string | Url); + + proxy: Url; + secureProxy: boolean; } export = HttpProxyAgent; From 6a357014b9882e22d00602a06378c9d9e66c615c Mon Sep 17 00:00:00 2001 From: Tom Raviv Date: Wed, 17 Oct 2018 18:58:26 +0300 Subject: [PATCH 13/96] [murmurhash] fix optional seed argument (#29788) * fix murmurhash optional argument * improved readability of jsdocs --- types/murmurhash/index.d.ts | 22 ++++++++++++++-------- types/murmurhash/murmurhash-tests.ts | 5 +++++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/types/murmurhash/index.d.ts b/types/murmurhash/index.d.ts index 31c663fd33..eac6b500b7 100644 --- a/types/murmurhash/index.d.ts +++ b/types/murmurhash/index.d.ts @@ -9,21 +9,27 @@ export = murmurhash; * JS Implementation of MurmurHash3 (r136) (as of May 20, 2011) * * @param key - ASCII only - * @param seed - Positive integer only - * @return - 32-bit positive integer hash + * @param seed - (optional) positive integer + * @returns 32-bit positive integer hash */ -declare function murmurhash(key: string, seed: number): number; +declare function murmurhash(key: string, seed?: number): number; declare namespace murmurhash { - // Circular reference from murmurhash - function v3(key: string, seed: number): number; + /** + * JS Implementation of MurmurHash3 (r136) (as of May 20, 2011) + * + * @param key - ASCII only + * @param seed - (optional) positive integer + * @returns 32-bit positive integer hash + */ + function v3(key: string, seed?: number): number; /** * JS Implementation of MurmurHash2 * * @param str - ASCII only - * @param seed - Positive integer only - * @return - 32-bit positive integer hash + * @param seed - (optional) positive integer + * @returns 32-bit positive integer hash */ - function v2(str: string, seed: number): number; + function v2(str: string, seed?: number): number; } diff --git a/types/murmurhash/murmurhash-tests.ts b/types/murmurhash/murmurhash-tests.ts index ebbbf09cab..fe7fc9c501 100644 --- a/types/murmurhash/murmurhash-tests.ts +++ b/types/murmurhash/murmurhash-tests.ts @@ -3,6 +3,11 @@ import murmurhash = require('murmurhash'); const stringValue = "test"; let numberValue = 123; +numberValue = murmurhash(stringValue); numberValue = murmurhash(stringValue, numberValue); + +numberValue = murmurhash.v2(stringValue); numberValue = murmurhash.v2(stringValue, numberValue); + +numberValue = murmurhash.v3(stringValue); numberValue = murmurhash.v3(stringValue, numberValue); From 68765b81a894be967d05858bbaca69051c560c24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Gonz=C3=A1lez=20Giraldo?= Date: Wed, 17 Oct 2018 11:01:19 -0500 Subject: [PATCH 14/96] Add critters webpack plugin (#29796) * Added critters-webpack-plugin definition * Modified to allow export default * Minor fixes * Added TypeScript version * Added missing strictFunctionTypes * Added version * Removed patch from version and removed unnecesary asterisks in jsdocs * Added new line at end of @deault statements on jsDocs * Empty the first line of every jsDoc --- .../critters-webpack-plugin-tests.ts | 10 +++ types/critters-webpack-plugin/index.d.ts | 65 +++++++++++++++++++ types/critters-webpack-plugin/tsconfig.json | 16 +++++ types/critters-webpack-plugin/tslint.json | 1 + 4 files changed, 92 insertions(+) create mode 100644 types/critters-webpack-plugin/critters-webpack-plugin-tests.ts create mode 100644 types/critters-webpack-plugin/index.d.ts create mode 100644 types/critters-webpack-plugin/tsconfig.json create mode 100644 types/critters-webpack-plugin/tslint.json diff --git a/types/critters-webpack-plugin/critters-webpack-plugin-tests.ts b/types/critters-webpack-plugin/critters-webpack-plugin-tests.ts new file mode 100644 index 0000000000..cb975b1cc0 --- /dev/null +++ b/types/critters-webpack-plugin/critters-webpack-plugin-tests.ts @@ -0,0 +1,10 @@ +import Critters from 'critters-webpack-plugin'; + +new Critters({ + compress: true, + external: true, + inlineFonts: false, + preloadFonts: true, + keyframes: 'critical', + noscriptFallback: true, +}); diff --git a/types/critters-webpack-plugin/index.d.ts b/types/critters-webpack-plugin/index.d.ts new file mode 100644 index 0000000000..df758a42e7 --- /dev/null +++ b/types/critters-webpack-plugin/index.d.ts @@ -0,0 +1,65 @@ +// Type definitions for critters-webpack-plugin 1.3 +// Project: https://github.com/GoogleChromeLabs/critters +// Definitions by: Juan José González Giraldo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { Plugin } from 'webpack'; + +export default Critters; +declare class Critters extends Plugin { + constructor(options?: Critters.CrittersOptions); +} + +declare namespace Critters { + interface CrittersOptions { + /** + * Inline styles from external stylesheets. + * @default true + */ + external?: boolean; + /** + * The mechanism to use for lazy-loading stylesheets. [JS] indicates that a strategy requires JavaScript (falls back to