diff --git a/react/react-tests.ts b/react/react-tests.ts index fb0d6eebc3..0ca0e9f7bc 100644 --- a/react/react-tests.ts +++ b/react/react-tests.ts @@ -63,7 +63,7 @@ var reactElement: React.ReactElement = var reactFactory: React.Factory = React.createFactory(reactClass); -var reactInstance: React.Instance = +var reactInstance: React.ElementInstance = React.render(reactElement, container); var unmounted: boolean = React.unmountComponentAtNode(container); @@ -108,7 +108,7 @@ componentInstance.setState({ inputValue: "!!!" }); componentInstance.replaceState({ inputValue: "???", seconds: 60 }); componentInstance.forceUpdate(); -var inputRef: React.Instance = +var inputRef: React.ElementInstance = componentInstance.refs[INPUT_REF]; var value: string = inputRef.getDOMNode().value; diff --git a/react/react.d.ts b/react/react.d.ts index 3842c54e7e..3eaa868fed 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -94,7 +94,7 @@ declare module React { createClass

(spec: ComponentSpec): ComponentClass

; createElement

(type: any/*ReactType*/, props: P, ...children: any/*ReactNode*/[]): ReactElement

; createFactory

(type: any/*ReactType*/): Factory

; - render

(element: ReactElement

, container: Element, callback?: () => void): Instance

; + render

(element: ReactElement

, container: Element, callback?: () => void): ElementInstance

; unmountComponentAtNode(container: Element): boolean; renderToString(element: ReactElement): string; renderToStaticMarkup(element: ReactElement): string; @@ -106,7 +106,7 @@ declare module React { // Component API // ---------------------------------------------------------------------- - interface Instance

{ + interface ElementInstance

{ // Use this overload to cast the returned element to a more specific type. // Eg: var name = this.refs['name'].getDOMNode().value; getDOMNode(): TElement; @@ -118,13 +118,13 @@ declare module React { replaceProps(nextProps: P, callback?: () => void): void; } - interface ComponentInstance extends Instance

{ + interface ComponentInstance extends ElementInstance

{ state: S; setState(nextState: S, callback?: () => void): void; replaceState(nextState: S, callback?: () => void): void; forceUpdate(callback?: () => void): void; refs: { - [key: string]: Instance

+ [key: string]: ElementInstance

}; } @@ -740,25 +740,25 @@ declare module React { interface ReactTestUtils { Simulate: Simulate; - renderIntoDocument

(element: ReactElement

): Instance

; + renderIntoDocument

(element: ReactElement

): ElementInstance

; mockComponent(mocked: MockedComponent, mockTagName?: string): ReactTestUtils; isElementOfType(element: ReactElement, type: any/*ReactType*/): boolean; - isDOMComponent(instance: Instance): boolean; - isCompositeComponent(instance: Instance): boolean; - isCompositeComponentWithType(instance: Instance, type: ComponentClass): boolean; - isTextComponent(instance: Instance): boolean; + isDOMComponent(instance: ElementInstance): boolean; + isCompositeComponent(instance: ElementInstance): boolean; + isCompositeComponentWithType(instance: ElementInstance, type: ComponentClass): boolean; + isTextComponent(instance: ElementInstance): boolean; - findAllInRenderedTree(tree: Instance, fn: (i: Instance) => boolean): Instance; + findAllInRenderedTree(tree: ElementInstance, fn: (i: ElementInstance) => boolean): ElementInstance; - scryRenderedDOMComponentsWithClass(tree: Instance, className: string): Instance[]; - findRenderedDOMComponentWithClass(tree: Instance, className: string): Instance; + scryRenderedDOMComponentsWithClass(tree: ElementInstance, className: string): ElementInstance[]; + findRenderedDOMComponentWithClass(tree: ElementInstance, className: string): ElementInstance; - scryRenderedDOMComponentsWithTag(tree: Instance, tagName: string): Instance[]; - findRenderedDOMComponentWithTag(tree: Instance, tagName: string): Instance; + scryRenderedDOMComponentsWithTag(tree: ElementInstance, tagName: string): ElementInstance[]; + findRenderedDOMComponentWithTag(tree: ElementInstance, tagName: string): ElementInstance; - scryRenderedComponentsWithType

(tree: Instance, type: ComponentClass

): Instance

[]; - findRenderedComponentWithType

(tree: Instance, type: ComponentClass

): Instance

; + scryRenderedComponentsWithType

(tree: ElementInstance, type: ComponentClass

): ElementInstance

[]; + findRenderedComponentWithType

(tree: ElementInstance, type: ComponentClass

): ElementInstance

; } interface SyntheticEventData { @@ -797,7 +797,7 @@ declare module React { interface EventSimulator { (element: Element, eventData?: SyntheticEventData): void; - (descriptor: Instance, eventData?: SyntheticEventData): void; + (descriptor: ElementInstance, eventData?: SyntheticEventData): void; } interface Simulate {