From 84cb163ba99cd0d694d12f68eeec7960b2c7df08 Mon Sep 17 00:00:00 2001 From: Trygve Wastvedt Date: Sat, 9 Jun 2018 22:02:23 -0500 Subject: [PATCH 01/19] Update UniformsLibs, fix typos. --- types/three/three-core.d.ts | 39 +++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 3ad1568409..3c787698c8 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -5865,13 +5865,18 @@ export let UniformsLib: { diffuse: IUniform; opacity: IUniform; map: IUniform; - offsetRepeat: IUniform; - specularMap: IUniform; + uvTransform: IUniform; alphaMap: IUniform; + }; + specularmap: { + specularMap: IUniform; + }; + envmap: { envMap: IUniform; flipEnvMap: IUniform; reflectivity: IUniform; - refractionRation: IUniform; + refractionRatio: IUniform; + maxMipLevel: IUniform; }; aomap: { aoMap: IUniform; @@ -5881,7 +5886,9 @@ export let UniformsLib: { lightMap: IUniform; lightMapIntensity: IUniform; }; - emissivemap: { emissiveMap: IUniform }; + emissivemap: { + emissiveMap: IUniform + }; bumpmap: { bumpMap: IUniform; bumpScale: IUniform; @@ -5895,8 +5902,15 @@ export let UniformsLib: { displacementScale: IUniform; displacementBias: IUniform; }; - roughnessmap: { roughnessMap: IUniform }; - metalnessmap: { metalnessMap: IUniform }; + roughnessmap: { + roughnessMap: IUniform + }; + metalnessmap: { + metalnessMap: IUniform + }; + gradientmap: { + gradientMap: IUniform + }; fog: { fogDensity: IUniform; fogNear: IUniform; @@ -5951,7 +5965,7 @@ export let UniformsLib: { }; pointShadowMap: IUniform; pointShadowMatrix: IUniform; - hemisphereLigtts: { + hemisphereLights: { value: any[]; properties: { direction: {}; @@ -5959,6 +5973,15 @@ export let UniformsLib: { groundColor: {}; }; }; + rectAreaLights: { + value: any[]; + properties: { + color: {}; + position: {}; + width: {}; + height: {}; + } + } }; points: { diffuse: IUniform; @@ -5966,7 +5989,7 @@ export let UniformsLib: { size: IUniform; scale: IUniform; map: IUniform; - offsetRepeat: IUniform; + uvTransform: IUniform; }; }; From ee72b6f183410d4bc6850350a1f465c1a9a52213 Mon Sep 17 00:00:00 2001 From: Tim Kendrick Date: Wed, 13 Jun 2018 15:31:28 +0100 Subject: [PATCH 02/19] [babel-types] Allow implicit boolean JSXAttribute values --- types/babel-types/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/babel-types/index.d.ts b/types/babel-types/index.d.ts index 47068c3481..c464c4bc3f 100644 --- a/types/babel-types/index.d.ts +++ b/types/babel-types/index.d.ts @@ -772,7 +772,7 @@ export interface VoidTypeAnnotation extends Node { export interface JSXAttribute extends Node { type: "JSXAttribute"; name: JSXIdentifier | JSXNamespacedName; - value: JSXElement | StringLiteral | JSXExpressionContainer; + value: JSXElement | StringLiteral | JSXExpressionContainer | null; } export interface JSXClosingElement extends Node { @@ -1424,7 +1424,7 @@ export function objectTypeProperty(key?: Expression, value?: FlowTypeAnnotation) export function qualifiedTypeIdentifier(id?: Identifier, qualification?: Identifier | QualifiedTypeIdentifier): QualifiedTypeIdentifier; export function unionTypeAnnotation(types?: FlowTypeAnnotation[]): UnionTypeAnnotation; export function voidTypeAnnotation(): VoidTypeAnnotation; -export function jSXAttribute(name?: JSXIdentifier | JSXNamespacedName, value?: JSXElement | StringLiteral | JSXExpressionContainer): JSXAttribute; +export function jSXAttribute(name?: JSXIdentifier | JSXNamespacedName, value?: JSXElement | StringLiteral | JSXExpressionContainer | null): JSXAttribute; export function jSXClosingElement(name?: JSXIdentifier | JSXMemberExpression): JSXClosingElement; export function jSXElement(openingElement?: JSXOpeningElement, closingElement?: JSXClosingElement, children?: Array, selfClosing?: boolean): JSXElement; export function jSXEmptyExpression(): JSXEmptyExpression; From bdf4fc0819986e414891851aa8b707ccd659ce1b Mon Sep 17 00:00:00 2001 From: Dobes Vandermeer Date: Thu, 14 Jun 2018 14:57:05 -0700 Subject: [PATCH 03/19] Fix generate() return type `ObjectID().generate()` returns a `Buffer`, not a `string` @horiuchi @CaselIT See https://github.com/mongodb/js-bson/blob/master/lib/bson/objectid.js#L149 for the source code of bson, excerpted here: ``` /** * Generate a 12 byte id buffer used in ObjectID's * * @method * @param {number} [time] optional parameter allowing to pass in a second based timestamp. * @return {Buffer} return the 12 byte id buffer string. */ ObjectID.prototype.generate = function(time) { if ('number' !== typeof time) { time = ~~(Date.now() / 1000); } // Use pid var pid = (typeof process === 'undefined' || process.pid === 1 ? Math.floor(Math.random() * 100000) : process.pid) % 0xffff; var inc = this.get_inc(); // Buffer used var buffer = new Buffer(12); // Encode time buffer[3] = time & 0xff; buffer[2] = (time >> 8) & 0xff; buffer[1] = (time >> 16) & 0xff; buffer[0] = (time >> 24) & 0xff; // Encode machine buffer[6] = MACHINE_ID & 0xff; buffer[5] = (MACHINE_ID >> 8) & 0xff; buffer[4] = (MACHINE_ID >> 16) & 0xff; // Encode pid buffer[8] = pid & 0xff; buffer[7] = (pid >> 8) & 0xff; // Encode index buffer[11] = inc & 0xff; buffer[10] = (inc >> 8) & 0xff; buffer[9] = (inc >> 16) & 0xff; // Return the buffer return buffer; }; ``` --- types/bson/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/bson/index.d.ts b/types/bson/index.d.ts index 3b0feb0113..4d30097478 100644 --- a/types/bson/index.d.ts +++ b/types/bson/index.d.ts @@ -182,7 +182,7 @@ export class ObjectID { * @param {number} time optional parameter allowing to pass in a second based timestamp. * @return {string} return the 12 byte id binary string. */ - generate(time?: number): string; + generate(time?: number): Buffer; /** * Returns the generation date (accurate up to the second) that this ID was generated. * @return {date} the generation date From 8223535354c4d92ae7b384e9d463b301da55dfc8 Mon Sep 17 00:00:00 2001 From: Hunter Tunnicliff Date: Thu, 14 Jun 2018 14:59:50 -0700 Subject: [PATCH 04/19] Added union type for Subscription to IInvoice.subscription --- types/stripe/index.d.ts | 13 +++++++------ types/stripe/stripe-tests.ts | 4 ++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index 9cf60439c8..41bc3cd48b 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -9,6 +9,7 @@ // Kensuke Hoshikawa // Thomas Bruun // Gal Talmor +// Hunter Tunnicliff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -738,7 +739,7 @@ declare namespace Stripe { * charge if a partial refund was issued), positive integer or zero. */ amount_refunded: number; - + /** * ID of the Connect application that created the charge. [Expandable] */ @@ -1994,7 +1995,7 @@ declare namespace Stripe { /** * The subscription that this invoice was prepared for, if any. */ - subscription: string; + subscription: string | subscriptions.ISubscription; /** * Only set for upcoming invoices that preview prorations. The time used to calculate prorations. @@ -2302,7 +2303,7 @@ declare namespace Stripe { /** * The subscription that this invoice item has been created for, if any. */ - subscription: string; + subscription: string | subscriptions.ISubscription; } interface InvoiceItemCreationOptions extends IDataOptionsWithMetadata { @@ -2389,7 +2390,7 @@ declare namespace Stripe { * currency) representing the total amount for the order. */ amount: number; - + /** * A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a 0-decimal * currency) representing the total amount returned for the order thus far. @@ -5033,7 +5034,7 @@ declare namespace Stripe { * String representing the object’s type. Objects of the same type share the same value. */ object: "review"; - + /** * The charge associated with this review. [Expandable] */ @@ -5073,7 +5074,7 @@ declare namespace Stripe { */ name: string; } - } + } class StripeResource { constructor(stripe: Stripe, urlData: any); diff --git a/types/stripe/stripe-tests.ts b/types/stripe/stripe-tests.ts index 306ab0442a..ad5f1750fb 100644 --- a/types/stripe/stripe-tests.ts +++ b/types/stripe/stripe-tests.ts @@ -1018,6 +1018,10 @@ stripe.invoices.list({ customer: "cus_5rfJKDJkuxzh5Q", limit: 3 }).then(function // asynchronously called }); +stripe.invoices.retrieve("in_15fvyXEe31JkLCeQH7QbgZZb", { expand: ["subscription"] }).then(function (invoice) { + invoice.subscription +}) + //#endregion //#region Invoice Items tests From 8bff26444867ee31d25e3589e56927f0dcc67055 Mon Sep 17 00:00:00 2001 From: Jamie Saunders Date: Fri, 15 Jun 2018 00:55:37 -0700 Subject: [PATCH 05/19] recharts: add optional angle to LabelProps Labels support optional angle types, so let's add them to LabelProps --- types/recharts/index.d.ts | 2 ++ types/recharts/recharts-tests.tsx | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/types/recharts/index.d.ts b/types/recharts/index.d.ts index 738c04bb02..5159fd827b 100644 --- a/types/recharts/index.d.ts +++ b/types/recharts/index.d.ts @@ -7,6 +7,7 @@ // Rich Baird // Dan Torberg // Peter Keuter +// Jamie Saunders // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -832,6 +833,7 @@ export class Treemap extends React.Component { } export class Label extends React.Component { } export interface LabelProps { + angle?: number; viewBox?: ViewBox | PolarViewBox; formatter?: LabelFormatter; value?: number | string; diff --git a/types/recharts/recharts-tests.tsx b/types/recharts/recharts-tests.tsx index 17d49bbd11..79fe85b0ee 100644 --- a/types/recharts/recharts-tests.tsx +++ b/types/recharts/recharts-tests.tsx @@ -192,7 +192,9 @@ class Component extends React.Component<{}, ComponentState> { - + + From 41cf3ae8e205d3b03ce581678699da6dac415e8c Mon Sep 17 00:00:00 2001 From: Ezinwa Okpoechi Date: Fri, 15 Jun 2018 11:42:16 +0200 Subject: [PATCH 06/19] Fix socket origins type --- types/socket.io/index.d.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/types/socket.io/index.d.ts b/types/socket.io/index.d.ts index 6f7c0ef321..51a1bd7d9a 100644 --- a/types/socket.io/index.d.ts +++ b/types/socket.io/index.d.ts @@ -1,6 +1,11 @@ -// Type definitions for socket.io 1.4.4 +// Type definitions for socket.io 1.4.5 // Project: http://socket.io/ -// Definitions by: PROGRE , Damian Connolly , Florent Poujol , KentarouTakeda , Alexey Snigirev +// Definitions by: PROGRE +// Damian Connolly +// Florent Poujol +// KentarouTakeda +// Alexey Snigirev +// Ezinwa Okpoechi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -127,7 +132,7 @@ declare namespace SocketIO { * Gets the allowed origins for requests * @default "*:*" */ - origins(): string; + origins(): string|string[]; /** * Sets the allowed origins for requests @@ -135,7 +140,7 @@ declare namespace SocketIO { * @default "*:*" * return This Server */ - origins( v: string ): Server; + origins( v: string|string[] ): Server; /** * Attaches socket.io to a server @@ -299,7 +304,7 @@ declare namespace SocketIO { * Accepted origins * @default '*:*' */ - origins?: string; + origins?: string|string[]; /** * How many milliseconds without a pong packed to consider the connection closed (engine.io) From 713f7bec516c16f5bd94b1092cd0d92790be8fc6 Mon Sep 17 00:00:00 2001 From: Daniel Compton Date: Fri, 15 Jun 2018 22:39:01 +1200 Subject: [PATCH 07/19] Add onUnreadCountChange command to intercom-web --- types/intercom-web/index.d.ts | 24 +++++++++++++----------- types/intercom-web/intercom-web-tests.ts | 1 + 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/types/intercom-web/index.d.ts b/types/intercom-web/index.d.ts index 563d241c31..eb2157d7c7 100755 --- a/types/intercom-web/index.d.ts +++ b/types/intercom-web/index.d.ts @@ -21,7 +21,7 @@ declare namespace Intercom_ { activator?: string; }; company?: { - id: string|number, + id: string | number, name: string, created_at: number, plan?: string, @@ -33,16 +33,17 @@ declare namespace Intercom_ { } type IntercomCommand = 'boot' - |'shutdown' - |'update' - |'hide' - |'show' - |'showMessages' - |'showNewMessage' - |'onHide' - |'onShow' - |'onActivatorClick' - |'trackEvent'; + | 'shutdown' + | 'update' + | 'hide' + | 'show' + | 'showMessages' + | 'showNewMessage' + | 'onHide' + | 'onShow' + | 'onUnreadCountChange' + | 'onActivatorClick' + | 'trackEvent'; interface IntercomStatic { (command: 'boot', param: IntercomSettings): void; @@ -51,6 +52,7 @@ declare namespace Intercom_ { (command: 'showNewMessage', param?: string): void; (command: 'onHide' | 'onShow' | 'onActivatorClick', param?: () => void): void; (command: 'trackEvent', tag?: string, metadata?: any): void; + (command: 'onUnreadCountChange', cb: (unreadCount: number) => void): void; (command: IntercomCommand, param1?: any, param2?: any): void; } } diff --git a/types/intercom-web/intercom-web-tests.ts b/types/intercom-web/intercom-web-tests.ts index b07013322d..425aa74be4 100755 --- a/types/intercom-web/intercom-web-tests.ts +++ b/types/intercom-web/intercom-web-tests.ts @@ -23,6 +23,7 @@ Intercom('showMessages'); Intercom('showNewMessage'); Intercom('showNewMessage', 'pre-populated content'); Intercom('onHide', () => { /* Do stuff */ }); +Intercom('onUnreadCountChange', (unreadCount: number) => { /* Do stuff */ }); Intercom('onActivatorClick', () => { /* Do stuff */ }); Intercom('trackEvent', 'invited-friend'); From 9a3d7345fb68e69bec0c570df24d7e92a1559dde Mon Sep 17 00:00:00 2001 From: Robin Bellini Olsson Date: Fri, 15 Jun 2018 13:20:16 +0200 Subject: [PATCH 08/19] add withNamespace function --- types/microrouter/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/microrouter/index.d.ts b/types/microrouter/index.d.ts index 934affd630..81643c9c42 100644 --- a/types/microrouter/index.d.ts +++ b/types/microrouter/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for microrouter 2.2 +// Type definitions for microrouter 3.1.3 // Project: https://github.com/pedronauck/micro-router#readme // Definitions by: Mathieu Dutour // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -21,6 +21,7 @@ export type AugmentedRequestHandler = ( export type RouteHandler = (path: string, handler: AugmentedRequestHandler) => RequestHandler; export function router(...routes: RequestHandler[]): RequestHandler; +export function withNamespace(namespace: string): (...routes: RequestHandler[]) => RequestHandler; export const get: RouteHandler; export const post: RouteHandler; From f61d99d5b05b53881726546d1a654169cf045d82 Mon Sep 17 00:00:00 2001 From: Robin Bellini Olsson Date: Fri, 15 Jun 2018 13:35:53 +0200 Subject: [PATCH 09/19] fix version header --- types/microrouter/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/microrouter/index.d.ts b/types/microrouter/index.d.ts index 81643c9c42..c4927ecf9b 100644 --- a/types/microrouter/index.d.ts +++ b/types/microrouter/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for microrouter 3.1.3 +// Type definitions for microrouter 3.1 // Project: https://github.com/pedronauck/micro-router#readme // Definitions by: Mathieu Dutour // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 5de627c19f1d5f40cb98e7d91640cc418b733c2d Mon Sep 17 00:00:00 2001 From: Alex Jerabek Date: Fri, 15 Jun 2018 10:13:35 -0700 Subject: [PATCH 10/19] Adding explicit string values to enums --- types/office-js/index.d.ts | 54 +++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 9a2f8981a5..e395b7d572 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -4836,15 +4836,15 @@ declare namespace Office { /** * The attachment is a file */ - File, + File = "file", /** * The attachment is an Exchange item */ - Item, + Item = "item", /** * The attachment is stored in a cloud location, such as OneDrive. The id property of the attachment contains a URL to the file. */ - Cloud + Cloud = "cloud" } /** * Specifies the day of week or type of day. @@ -4908,31 +4908,31 @@ declare namespace Office { /** * Specifies that the entity is a meeting suggestion. */ - MeetingSuggestion, + MeetingSuggestion = "meetingSuggestion", /** * Specifies that the entity is a task suggestion. */ - TaskSuggestion, + TaskSuggestion = "taskSuggestion", /** * Specifies that the entity is a postal address. */ - Address, + Address = "address", /** * Specifies that the entity is an SMTP email address. */ - EmailAddress, + EmailAddress = "emailAddress", /** * Specifies that the entity is an Internet URL. */ - Url, + Url = "url", /** * Specifies that the entity is a US phone number. */ - PhoneNumber, + PhoneNumber = "phoneNumber", /** * Specifies that the entity is a contact. */ - Contact + Contact = "contact" } /** * Specifies the notification message type for an appointment or message. @@ -4946,15 +4946,15 @@ declare namespace Office { /** * The notificationMessage is a progress indicator. */ - ProgressIndicator, + ProgressIndicator = "progressIndicator", /** * The notificationMessage is an informational message. */ - InformationalMessage, + InformationalMessage = "informationalMessage", /** * The notificationMessage is an error message. */ - ErrorMessage + ErrorMessage = "errorMessage" } /** * Specifies an item's type. @@ -4968,11 +4968,11 @@ declare namespace Office { /** * An email, meeting request, meeting response, or meeting cancellation. */ - Message, + Message = "message", /** * An appointment item. */ - Appointment + Appointment = "appointment" } /** * Specifies the month. @@ -5044,19 +5044,19 @@ declare namespace Office { /** * Specifies that the recipient is a distribution list containing a list of email addresses. */ - DistributionList, + DistributionList = "distributionList", /** * Specifies that the recipient is an SMTP email address that is on the Exchange server. */ - User, + User = "user", /** * Specifies that the recipient is an SMTP email address that is not on the Exchange server. */ - ExternalUser, + ExternalUser = "externalUser", /** * Specifies that the recipient is not one of the other recipient types. */ - Other + Other = "other" } /** * Specifies the time zone applied to the recurrence. @@ -5656,23 +5656,23 @@ declare namespace Office { /** * There has been no response from the attendee. */ - None, + None = "none", /** * The attendee is the meeting organizer. */ - Organizer, + Organizer = "organizer", /** * The meeting request was tentatively accepted by the attendee. */ - Tentative, + Tentative = "tentative", /** * The meeting request was accepted by the attendee. */ - Accepted, + Accepted = "accepted", /** * The meeting request was declined by the attendee. */ - Declined + Declined = "declined" } /** * Specifies the version of the REST API that corresponds to a REST-formatted item ID. @@ -5686,15 +5686,15 @@ declare namespace Office { /** * Version 1.0. */ - v1_0, + v1_0 = "v1.0", /** * Version 2.0. */ - v2_0, + v2_0 = "v2.0", /** * Beta. */ - Beta + Beta = "beta" } /** * Specifies the week of the month. From c2b40c18c15a14e7b190dd5caf96705f06a703d2 Mon Sep 17 00:00:00 2001 From: Ben Saufley Date: Fri, 15 Jun 2018 13:36:18 -0400 Subject: [PATCH 11/19] [next] Update router types --- types/next/router.d.ts | 40 +++++++++------ types/next/test/next-router-tests.tsx | 72 ++++++++++++++++++--------- 2 files changed, 74 insertions(+), 38 deletions(-) diff --git a/types/next/router.d.ts b/types/next/router.d.ts index 544c29bc7e..4eb24dc3ff 100644 --- a/types/next/router.d.ts +++ b/types/next/router.d.ts @@ -8,12 +8,11 @@ export interface EventChangeOptions { [key: string]: any; } +export type PopStateCallback = (state: any) => boolean | undefined; + export type RouterCallback = () => void; export interface RouterProps { - // router properties - readonly components: { - [key: string]: { Component: React.ComponentType; err: any }; - }; + // url property fields readonly pathname: string; readonly route: string; readonly asPath?: string; @@ -27,39 +26,50 @@ export interface RouterProps { | string[]; }; - // router methods - reload(route: string): Promise; + // property fields + readonly components: { + [key: string]: { Component: React.ComponentType; err: any }; + }; + + // core method fields back(): void; + beforePopState(cb: PopStateCallback): boolean; + prefetch(url: string): Promise>; push( url: string | UrlLike, as?: string | UrlLike, options?: EventChangeOptions, ): Promise; + reload(route: string): Promise; replace( url: string | UrlLike, as?: string | UrlLike, options?: EventChangeOptions, ): Promise; - prefetch(url: string): Promise>; - // router events + // events onAppUpdated?(nextRoute: string): void; - onRouteChangeStart?(url: string): void; onBeforeHistoryChange?(as: string): void; + onHashChangeStart?(url: string): void; + onHashChangeComplete?(url: string): void; onRouteChangeComplete?(url: string): void; onRouteChangeError?(error: any, url: string): void; + onRouteChangeStart?(url: string): void; } -export interface SingletonRouter { - router: RouterProps; +export interface SingletonRouter extends RouterProps { + router: RouterProps | null; readyCallbacks: RouterCallback[]; ready(cb: RouterCallback): void; } +export interface WithRouterProps { + router: SingletonRouter; +} + export function withRouter( - Component: React.ComponentType, + Component: React.ComponentType, ): React.ComponentType; -export const Singleton: SingletonRouter; -export type ImperativeRouter = RouterProps; -export default Singleton; +declare const Router: SingletonRouter; +export default Router; diff --git a/types/next/test/next-router-tests.tsx b/types/next/test/next-router-tests.tsx index 822b9b8e6f..70c41081bd 100644 --- a/types/next/test/next-router-tests.tsx +++ b/types/next/test/next-router-tests.tsx @@ -1,4 +1,4 @@ -import Router, * as r from "next/router"; +import Router, { withRouter, WithRouterProps } from "next/router"; import * as React from "react"; import * as qs from "querystring"; @@ -13,8 +13,8 @@ Router.ready(() => { // Access readonly properties of the router. -Object.keys(Router.router.components).forEach(key => { - const c = Router.router.components[key]; +Object.keys(Router.components).forEach(key => { + const c = Router.components[key]; c.err.isAnAny; return ; @@ -26,52 +26,78 @@ function split(routeLike: string) { }); } -if (Router.router.asPath) { - split(Router.router.asPath); - split(Router.router.asPath); +if (Router.asPath) { + split(Router.asPath); + split(Router.asPath); } -split(Router.router.pathname); +split(Router.pathname); -const query = `?${qs.stringify(Router.router.query)}`; +const query = `?${qs.stringify(Router.query)}`; // Assign some callback methods. -Router.router.onAppUpdated = (nextRoute: string) => console.log(nextRoute); -Router.router.onRouteChangeStart = (url: string) => +Router.onAppUpdated = (nextRoute: string) => console.log(nextRoute); +Router.onRouteChangeStart = (url: string) => console.log("Route is starting to change.", url); -Router.router.onBeforeHistoryChange = (as: string) => +Router.onBeforeHistoryChange = (as: string) => console.log("History hasn't changed yet.", as); -Router.router.onRouteChangeComplete = (url: string) => +Router.onRouteChangeComplete = (url: string) => console.log("Route chaneg is complete.", url); -Router.router.onRouteChangeError = (err: any, url: string) => +Router.onRouteChangeError = (err: any, url: string) => console.log("Route is starting to change.", url, err); // Call methods on the router itself. -Router.router.reload("/route").then(() => console.log("route was reloaded")); -Router.router.back(); +Router.reload("/route").then(() => console.log("route was reloaded")); +Router.back(); +Router.beforePopState(({ url }) => !!url); -Router.router.push("/route").then((success: boolean) => +Router.push("/route").then((success: boolean) => console.log("route push success: ", success), ); -Router.router.push("/route", "/asRoute").then((success: boolean) => +Router.push("/route", "/asRoute").then((success: boolean) => console.log("route push success: ", success), ); -Router.router.push("/route", "/asRoute", { shallow: false }).then((success: boolean) => +Router.push("/route", "/asRoute", { shallow: false }).then((success: boolean) => console.log("route push success: ", success), ); -Router.router.replace("/route").then((success: boolean) => +Router.replace("/route").then((success: boolean) => console.log("route replace success: ", success), ); -Router.router.replace("/route", "/asRoute").then((success: boolean) => +Router.replace("/route", "/asRoute").then((success: boolean) => console.log("route replace success: ", success), ); -Router.router.replace("/route", "/asRoute", { +Router.replace("/route", "/asRoute", { shallow: false, }).then((success: boolean) => console.log("route replace success: ", success)); -Router.router.prefetch("/route").then(Component => { +Router.prefetch("/route").then(Component => { const element = ; }); -r.withRouter(props =>
); +interface TestComponentProps { + testValue: string; +} + +class TestComponent extends React.Component { + state = { ready: false }; + + constructor(props: TestComponentProps & WithRouterProps) { + super(props); + props.router.ready(() => { + this.setState({ ready: true }); + }); + } + + render() { + return ( +
+

{this.state.ready ? 'Ready' : 'Not Ready'}

+

Route: {this.props.router.route}

+

Another prop: {this.props.testValue}

+
+ ); + } +} + +withRouter(TestComponent); From 15fd47e35fd1b7659ffb00e0767d7ceb6fbcf11d Mon Sep 17 00:00:00 2001 From: Andrew Makarov Date: Sat, 9 Jun 2018 12:34:41 +0300 Subject: [PATCH 12/19] [react-bootstrap] Add bsSize property for ToggleButton and ToggleButtonGroup --- types/react-bootstrap/index.d.ts | 1 + types/react-bootstrap/lib/ToggleButton.d.ts | 4 +- .../lib/ToggleButtonGroup.d.ts | 2 + .../test/react-bootstrap-tests.tsx | 105 ++++++++++++++---- 4 files changed, 91 insertions(+), 21 deletions(-) diff --git a/types/react-bootstrap/index.d.ts b/types/react-bootstrap/index.d.ts index 6a78dcbb1a..d015ce6402 100644 --- a/types/react-bootstrap/index.d.ts +++ b/types/react-bootstrap/index.d.ts @@ -12,6 +12,7 @@ // Karol Janyst // Aaron Beall // Johann Rakotoharisoa +// Andrew Makarov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 diff --git a/types/react-bootstrap/lib/ToggleButton.d.ts b/types/react-bootstrap/lib/ToggleButton.d.ts index ef231bf288..3566ad2a4a 100644 --- a/types/react-bootstrap/lib/ToggleButton.d.ts +++ b/types/react-bootstrap/lib/ToggleButton.d.ts @@ -1,10 +1,12 @@ import * as React from 'react'; +import { Sizes } from 'react-bootstrap'; declare namespace ToggleButton { export interface ToggleButtonProps extends React.HTMLProps { checked?: boolean; name?: string; - value: number|string; + value: number | string; + bsSize?: Sizes; } } declare class ToggleButton extends React.Component { } diff --git a/types/react-bootstrap/lib/ToggleButtonGroup.d.ts b/types/react-bootstrap/lib/ToggleButtonGroup.d.ts index 27be6b95a9..a3ea325192 100644 --- a/types/react-bootstrap/lib/ToggleButtonGroup.d.ts +++ b/types/react-bootstrap/lib/ToggleButtonGroup.d.ts @@ -1,4 +1,5 @@ import * as React from 'react'; +import { Sizes } from 'react-bootstrap'; import { Omit } from "../index"; declare namespace ToggleButtonGroup { @@ -13,6 +14,7 @@ declare namespace ToggleButtonGroup { * but you can technically use any|any[]. */ value?: any; + bsSize?: Sizes; } interface RadioProps { diff --git a/types/react-bootstrap/test/react-bootstrap-tests.tsx b/types/react-bootstrap/test/react-bootstrap-tests.tsx index ccebe35add..bfe8f9f6ea 100644 --- a/types/react-bootstrap/test/react-bootstrap-tests.tsx +++ b/types/react-bootstrap/test/react-bootstrap-tests.tsx @@ -1,18 +1,56 @@ import * as React from 'react'; import { Component, CSSProperties } from 'react'; import { - Button, ButtonToolbar, Modal, Well, ButtonGroup, - DropdownButton, MenuItem, Panel, PanelGroup, ListGroup, - ListGroupItem, Accordion, Tooltip, - OverlayTrigger, Popover, ProgressBar, - Nav, NavItem, Navbar, NavDropdown, - Tabs, Tab, Pager, PageItem, - Pagination, Alert, Carousel, SafeAnchor, - Grid, Row, Col, Thumbnail, Image, ResponsiveEmbed, - Label, Badge, Jumbotron, PageHeader, - Glyphicon, Table, Form, FormGroup, - ControlLabel, FormControl, HelpBlock, - Radio, Checkbox, Media, InputGroup, ToggleButtonGroup, + Button, + ButtonToolbar, + Modal, + Well, + ButtonGroup, + DropdownButton, + MenuItem, + Panel, + PanelGroup, + ListGroup, + ListGroupItem, + Accordion, + Tooltip, + OverlayTrigger, + Popover, + ProgressBar, + Nav, + NavItem, + Navbar, + NavDropdown, + Tabs, + Tab, + Pager, + PageItem, + Pagination, + Alert, + Carousel, + SafeAnchor, + Grid, + Row, + Col, + Thumbnail, + Image, + ResponsiveEmbed, + Label, + Badge, + Jumbotron, + PageHeader, + Glyphicon, + Table, + Form, + FormGroup, + ControlLabel, + FormControl, + HelpBlock, + Radio, + Checkbox, + Media, + InputGroup, + ToggleButtonGroup, ToggleButton } from 'react-bootstrap'; @@ -1418,20 +1456,47 @@ export class ReactBootstrapTest extends Component {
- - Checkbox 1 (pre-checked) - Checkbox 2 - Checkbox 3 (pre-checked) + + + Checkbox 1 (pre-checked) + + + Checkbox 2 + + + Checkbox 3 (pre-checked) + - - + + Radio 1 (pre-checked) - Radio 2 - Radio 3 + + Radio 2 + + + Radio 3 +
From b11356877c7111c790af16f6efd00e17918dac1a Mon Sep 17 00:00:00 2001 From: Andrew Makarov Date: Fri, 15 Jun 2018 22:43:27 +0300 Subject: [PATCH 13/19] [react-bootstrap] refactoring --- types/react-bootstrap/lib/ToggleButton.d.ts | 5 ++--- types/react-bootstrap/lib/ToggleButtonGroup.d.ts | 5 ++--- .../react-bootstrap-individual-components-tests.tsx | 4 ++-- types/react-bootstrap/test/react-bootstrap-tests.tsx | 10 +++++----- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/types/react-bootstrap/lib/ToggleButton.d.ts b/types/react-bootstrap/lib/ToggleButton.d.ts index 3566ad2a4a..b199ea8119 100644 --- a/types/react-bootstrap/lib/ToggleButton.d.ts +++ b/types/react-bootstrap/lib/ToggleButton.d.ts @@ -1,13 +1,12 @@ import * as React from 'react'; -import { Sizes } from 'react-bootstrap'; +import { Button } from 'react-bootstrap'; declare namespace ToggleButton { export interface ToggleButtonProps extends React.HTMLProps { checked?: boolean; name?: string; value: number | string; - bsSize?: Sizes; } } -declare class ToggleButton extends React.Component { } +declare class ToggleButton extends React.Component { } export = ToggleButton; diff --git a/types/react-bootstrap/lib/ToggleButtonGroup.d.ts b/types/react-bootstrap/lib/ToggleButtonGroup.d.ts index a3ea325192..1c3f6f4020 100644 --- a/types/react-bootstrap/lib/ToggleButtonGroup.d.ts +++ b/types/react-bootstrap/lib/ToggleButtonGroup.d.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -import { Sizes } from 'react-bootstrap'; +import { ButtonGroup } from 'react-bootstrap'; import { Omit } from "../index"; declare namespace ToggleButtonGroup { @@ -14,7 +14,6 @@ declare namespace ToggleButtonGroup { * but you can technically use any|any[]. */ value?: any; - bsSize?: Sizes; } interface RadioProps { @@ -36,5 +35,5 @@ declare namespace ToggleButtonGroup { & Omit, "defaultValue" | "type" | "value" | "onChange">; } -declare class ToggleButtonGroup extends React.Component { } +declare class ToggleButtonGroup extends React.Component { } export = ToggleButtonGroup; diff --git a/types/react-bootstrap/test/react-bootstrap-individual-components-tests.tsx b/types/react-bootstrap/test/react-bootstrap-individual-components-tests.tsx index 07d6a8a442..8c4237d22b 100644 --- a/types/react-bootstrap/test/react-bootstrap-individual-components-tests.tsx +++ b/types/react-bootstrap/test/react-bootstrap-individual-components-tests.tsx @@ -209,8 +209,8 @@ export class ReactBootstrapIndividualComponentsTest extends React.Component { - - + + diff --git a/types/react-bootstrap/test/react-bootstrap-tests.tsx b/types/react-bootstrap/test/react-bootstrap-tests.tsx index bfe8f9f6ea..34692ce248 100644 --- a/types/react-bootstrap/test/react-bootstrap-tests.tsx +++ b/types/react-bootstrap/test/react-bootstrap-tests.tsx @@ -1459,9 +1459,9 @@ export class ReactBootstrapTest extends Component { - + Checkbox 1 (pre-checked) @@ -1481,19 +1481,19 @@ export class ReactBootstrapTest extends Component { > Radio 1 (pre-checked) Radio 2 Radio 3 From 2bed7374015c31852b48593c909a7d0f0460f433 Mon Sep 17 00:00:00 2001 From: Kelvin Jin Date: Fri, 15 Jun 2018 16:49:40 -0700 Subject: [PATCH 14/19] [mongodb] use T as type rather than value --- types/mongodb/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index 273a0716b2..3048da4dd4 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -1252,7 +1252,7 @@ export class Cursor extends Readable { /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#limit */ limit(value: number): Cursor; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#map */ - map(transform: (T) => U): Cursor; + map(transform: (document: T) => U): Cursor; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#max */ max(max: number): Cursor; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#maxAwaitTimeMS */ From dba82e8e0ebe8d65d5feaffbc18d597578c728c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Miko=C5=82ajczyk?= Date: Sat, 16 Jun 2018 14:49:15 +0200 Subject: [PATCH 15/19] Definitions for jest's each function --- types/jest/index.d.ts | 11 +++++ types/jest/jest-tests.ts | 100 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 2afe0eb750..ce0ff1439a 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -15,6 +15,7 @@ // Bradley Ayers // Jeff Lau // Andrew Makarov +// Paweł Mikołajczyk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -209,6 +210,14 @@ declare namespace jest { readonly name: string; } + interface Each { + (cases: any[]): (name: string, fn: (...args: any[]) => any) => void; + (strings: TemplateStringsArray, ...placeholders: any[]): ( + name: string, + fn: (arg: any) => any + ) => void; + } + /** * Creates a test closure */ @@ -227,6 +236,7 @@ declare namespace jest { only: It; skip: It; concurrent: It; + each: Each; } interface Describe { @@ -234,6 +244,7 @@ declare namespace jest { (name: number | string | Function | FunctionLike, fn: EmptyFunction): void; only: Describe; skip: Describe; + each: Each; } interface MatcherUtils { diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index e154561c86..393890025b 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -760,3 +760,103 @@ describe('toHaveBeenNthCalledWith', () => { expect(fn).toHaveBeenNthCalledWith(3, "foo"); }); + +// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/26368 + +describe.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])( + ".add(%i, %i)", + (a: number, b: number, expected: number) => { + test(`returns ${expected}`, () => { + expect(a + b).toBe(expected); + }); + } +); + +interface Case { + a: number; + b: number; + expected: number; +} + +describe.each` + a | b | expected + ${1} | ${1} | ${2} + ${1} | ${2} | ${3} + ${2} | ${1} | ${3} +`("$a + $b", ({ a, b, expected }: Case) => { + test(`returns ${expected}`, () => { + expect(a + b).toBe(expected); + }); +}); + +describe.only.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])( + ".add(%i, %i)", + (a, b, expected) => { + test(`returns ${expected}`, () => { + expect(a + b).toBe(expected); + }); + } +); + +describe.only.each` + a | b | expected + ${1} | ${1} | ${2} + ${1} | ${2} | ${3} + ${2} | ${1} | ${3} +`("$a + $b", ({ a, b, expected }: Case) => { + test(`returns ${expected}`, () => { + expect(a + b).toBe(expected); + }); +}); + +describe.skip.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])( + ".add(%i, %i)", + (a, b, expected) => { + test(`returns ${expected}`, () => { + expect(a + b).toBe(expected); + }); + } +); + +describe.skip.each` + a | b | expected + ${1} | ${1} | ${2} + ${1} | ${2} | ${3} + ${2} | ${1} | ${3} +`("$a + $b", ({ a, b, expected }: Case) => { + test(`returns ${expected}`, () => { + expect(a + b).toBe(expected); + }); +}); + +test.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])( + ".add(%i, %i)", + (a, b, expected) => { + expect(a + b).toBe(expected); + } +); + +test.each` + a | b | expected + ${1} | ${1} | ${2} + ${1} | ${2} | ${3} + ${2} | ${1} | ${3} +`("returns $expected when $a is added $b", ({ a, b, expected }: Case) => { + expect(a + b).toBe(expected); +}); + +test.only.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])( + ".add(%i, %i)", + (a, b, expected) => { + expect(a + b).toBe(expected); + } +); + +test.only.each` + a | b | expected + ${1} | ${1} | ${2} + ${1} | ${2} | ${3} + ${2} | ${1} | ${3} +`("returns $expected when $a is added $b", ({ a, b, expected }: Case) => { + expect(a + b).toBe(expected); +}); From 898ed0479ceda021e9200a275379da0e28e19b69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Miko=C5=82ajczyk?= Date: Sat, 16 Jun 2018 15:38:14 +0200 Subject: [PATCH 16/19] Removed unnecessary line from merge --- types/jest/jest-tests.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index a03c49330b..7d10075262 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -1056,4 +1056,3 @@ test.only.each` `("returns $expected when $a is added $b", ({ a, b, expected }: Case) => { expect(a + b).toBe(expected); }); - From 00d12824b243269ca07f099f6154b879a2b95b7b Mon Sep 17 00:00:00 2001 From: Ricardo Devis Agullo Date: Sat, 16 Jun 2018 19:27:43 +0200 Subject: [PATCH 17/19] use tls.ConnectOptions for tls parameter --- types/ioredis/index.d.ts | 5 ++--- types/ioredis/ioredis-tests.ts | 5 ++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/types/ioredis/index.d.ts b/types/ioredis/index.d.ts index 84ca51982a..3ad2f6aeb2 100644 --- a/types/ioredis/index.d.ts +++ b/types/ioredis/index.d.ts @@ -16,6 +16,7 @@ /// import Promise = require('bluebird'); +import tls = require('tls'); interface RedisStatic { new(port?: number, host?: string, options?: IORedis.RedisOptions): IORedis.Redis; @@ -827,9 +828,7 @@ declare namespace IORedis { */ autoResendUnfulfilledCommands?: boolean; lazyConnect?: boolean; - tls?: { - ca: Buffer; - }; + tls?: tls.ConnectionOptions; sentinels?: Array<{ host: string; port: number; }>; name?: string; /** diff --git a/types/ioredis/ioredis-tests.ts b/types/ioredis/ioredis-tests.ts index e8e32062dc..7dd98879a5 100644 --- a/types/ioredis/ioredis-tests.ts +++ b/types/ioredis/ioredis-tests.ts @@ -29,7 +29,10 @@ new Redis({ password: 'auth', db: 0, retryStrategy() { return false; }, - showFriendlyErrorStack: true + showFriendlyErrorStack: true, + tls: { + servername: 'tlsservername' + } }); const pub = new Redis(); From 8900f2e6aafa5c66ba365721bf39e955a76ad535 Mon Sep 17 00:00:00 2001 From: Josh Holmer Date: Sat, 16 Jun 2018 23:28:26 -0400 Subject: [PATCH 18/19] [query-string] Update definitions for 6.1 --- types/query-string/index.d.ts | 4 +++- types/query-string/query-string-tests.ts | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/types/query-string/index.d.ts b/types/query-string/index.d.ts index db823e67d2..8a2f4a30ea 100644 --- a/types/query-string/index.d.ts +++ b/types/query-string/index.d.ts @@ -1,14 +1,16 @@ -// Type definitions for query-string 5.1 +// Type definitions for query-string 6.1 // Project: https://github.com/sindresorhus/query-string // Definitions by: Sam Verschueren // Tanguy Krotoff // HuHuanming // Madara Uchiha +// Josh Holmer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 export interface ParseOptions { arrayFormat?: 'bracket' | 'index' | 'none'; + decode?: boolean; } /** diff --git a/types/query-string/query-string-tests.ts b/types/query-string/query-string-tests.ts index 6e948cf6e5..69c70655ed 100644 --- a/types/query-string/query-string-tests.ts +++ b/types/query-string/query-string-tests.ts @@ -24,6 +24,7 @@ import * as queryString from 'query-string'; let fooBar: { foo: 'bar' }; fooBar = queryString.parse('?foo=bar'); fooBar = queryString.parse('#foo=bar'); + fooBar = queryString.parse('?foo=bar%20baz', { decode: true }); let fooBarBaz: { foo: ['bar', 'baz'] }; fooBarBaz = queryString.parse('&foo=bar&foo=baz'); From d003a793631d4b6af0b88daea21302b327552918 Mon Sep 17 00:00:00 2001 From: Carlos Precioso Date: Sun, 17 Jun 2018 15:02:59 +0200 Subject: [PATCH 19/19] [lodash/fp] Fix typo --- types/lodash/fp.d.ts | 2 +- types/lodash/scripts/generate-fp.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/lodash/fp.d.ts b/types/lodash/fp.d.ts index da68ea250e..c799bd734b 100644 --- a/types/lodash/fp.d.ts +++ b/types/lodash/fp.d.ts @@ -4760,6 +4760,6 @@ declare namespace _ { zipObjectDeep: LodashZipObjectDeep; zipWith: LodashZipWith; __: lodash.__; - placehodler: lodash.__; + placeholder: lodash.__; } } diff --git a/types/lodash/scripts/generate-fp.ts b/types/lodash/scripts/generate-fp.ts index 9a03fef544..817b485cf2 100644 --- a/types/lodash/scripts/generate-fp.ts +++ b/types/lodash/scripts/generate-fp.ts @@ -118,7 +118,7 @@ async function main() { " interface LoDashFp {", ...interfaceGroups.map(g => ` ${g.functionName}: ${g.interfaces[0].name};`), " __: lodash.__;", - " placehodler: lodash.__;", + " placeholder: lodash.__;", " }", "}", "",