From f03129f8fa9c5f58a047f1585ce16dc325a95942 Mon Sep 17 00:00:00 2001 From: Dave Keen Date: Fri, 18 Sep 2015 12:04:39 +0200 Subject: [PATCH] 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[][];