diff --git a/react/react-global.d.ts b/react/react-global.d.ts index 99fba1e3de..1728ba2fc8 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 f2f4bc0e6b..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 // ---------------------------------------------------------------------- @@ -1691,14 +1691,19 @@ 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[][];