From f03129f8fa9c5f58a047f1585ce16dc325a95942 Mon Sep 17 00:00:00 2001 From: Dave Keen Date: Fri, 18 Sep 2015 12:04:39 +0200 Subject: [PATCH 1/2] Fixed the React.addons.update typing to work with TS1.6's new stricter types. --- react/react-global.d.ts | 13 +++++++++---- react/react.d.ts | 15 ++++++++++----- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/react/react-global.d.ts b/react/react-global.d.ts index 99fba1e3de..3141d2f87b 100644 --- a/react/react-global.d.ts +++ b/react/react-global.d.ts @@ -85,14 +85,19 @@ declare namespace __React { // Reat.addons.update // ---------------------------------------------------------------------- - interface UpdateSpec { + interface UpdateSpecCommand { $set?: any; $merge?: {}; $apply?(value: any): any; - // [key: string]: UpdateSpec; } - - interface UpdateArraySpec extends UpdateSpec { + + interface UpdateSpecPath { + [key: string]: UpdateSpec; + } + + type UpdateSpec = UpdateSpecCommand | UpdateSpecPath; + + interface UpdateArraySpec extends UpdateSpecCommand { $push?: any[]; $unshift?: any[]; $splice?: any[][]; diff --git a/react/react.d.ts b/react/react.d.ts index 54d13d5eb2..81967b2866 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -1668,15 +1668,20 @@ declare module "react/addons" { // // Reat.addons.update // ---------------------------------------------------------------------- - - interface UpdateSpec { + + interface UpdateSpecCommand { $set?: any; $merge?: {}; $apply?(value: any): any; - // [key: string]: UpdateSpec; } - - interface UpdateArraySpec extends UpdateSpec { + + interface UpdateSpecPath { + [key: string]: UpdateSpec; + } + + type UpdateSpec = UpdateSpecCommand | UpdateSpecPath; + + interface UpdateArraySpec extends UpdateSpecCommand { $push?: any[]; $unshift?: any[]; $splice?: any[][]; From e1171adafff26b4bc13b833d4eec1c6422178cb6 Mon Sep 17 00:00:00 2001 From: vvakame Date: Wed, 7 Oct 2015 02:00:27 +0900 Subject: [PATCH 2/2] remove trailing white space --- react/react-global.d.ts | 6 +++--- react/react.d.ts | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/react/react-global.d.ts b/react/react-global.d.ts index 3141d2f87b..1728ba2fc8 100644 --- a/react/react-global.d.ts +++ b/react/react-global.d.ts @@ -90,13 +90,13 @@ declare namespace __React { $merge?: {}; $apply?(value: any): any; } - + interface UpdateSpecPath { [key: string]: UpdateSpec; } - + type UpdateSpec = UpdateSpecCommand | UpdateSpecPath; - + interface UpdateArraySpec extends UpdateSpecCommand { $push?: any[]; $unshift?: any[]; diff --git a/react/react.d.ts b/react/react.d.ts index 3ccd648a4d..4fd7d5e771 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -136,7 +136,7 @@ declare namespace __React { static contextTypes: ValidationMap; static childContextTypes: ValidationMap; static defaultProps: Props; - + constructor(props?: P, context?: any); setState(f: (prevState: S, props: P) => S, callback?: () => any): void; setState(state: S, callback?: () => any): void; @@ -376,7 +376,7 @@ declare namespace __React { onTouchStart?: TouchEventHandler; onScroll?: UIEventHandler; onWheel?: WheelEventHandler; - + className?: string; id?: string; @@ -944,7 +944,7 @@ declare module "react/addons" { static contextTypes: ValidationMap; static childContextTypes: ValidationMap; static defaultProps: Props; - + constructor(props?: P, context?: any); setState(f: (prevState: S, props: P) => S, callback?: () => any): void; setState(state: S, callback?: () => any): void; @@ -1613,7 +1613,7 @@ declare module "react/addons" { item(index: number): Touch; identifiedTouch(identifier: number): Touch; } - + // // React.addons // ---------------------------------------------------------------------- @@ -1690,19 +1690,19 @@ declare module "react/addons" { // // Reat.addons.update // ---------------------------------------------------------------------- - + interface UpdateSpecCommand { $set?: any; $merge?: {}; $apply?(value: any): any; } - + interface UpdateSpecPath { [key: string]: UpdateSpec; } - + type UpdateSpec = UpdateSpecCommand | UpdateSpecPath; - + interface UpdateArraySpec extends UpdateSpecCommand { $push?: any[]; $unshift?: any[];