diff --git a/react/react.d.ts b/react/react.d.ts index 5753731b18..64dce7b600 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -10,30 +10,32 @@ declare namespace __React { // ---------------------------------------------------------------------- type ReactType = string | ComponentClass | StatelessComponent; + type Key = string | number; + type Ref = string | ((instance: T) => any); interface ReactElement

> { type: string | ComponentClass

| StatelessComponent

; props: P; - key: string | number; - ref: string | ((component: Component | Element) => any); + key: Key; + ref: Ref | Element>; } interface ClassicElement

extends ReactElement

{ type: ClassicComponentClass

; - ref: string | ((component: ClassicComponent) => any); + ref: Ref>; } interface DOMElement

> extends ReactElement

{ type: string; - ref: string | ((element: Element) => any); + ref: Ref; } interface ReactHTMLElement extends DOMElement> { - ref: string | ((element: HTMLElement) => any); + ref: Ref; } interface ReactSVGElement extends DOMElement { - ref: string | ((element: SVGElement) => any); + ref: Ref; } // @@ -321,8 +323,8 @@ declare namespace __React { interface Props { children?: ReactNode; - key?: string | number; - ref?: string | ((component: T) => any); + key?: Key; + ref?: Ref; } interface HTMLProps extends HTMLAttributes, Props { @@ -2133,11 +2135,11 @@ declare namespace JSX { interface ElementAttributesProperty { props: {}; } interface IntrinsicAttributes { - key?: string | number; + key?: React.Key; } interface IntrinsicClassAttributes { - ref?: string | ((classInstance: T) => void); + ref?: React.Ref; } interface IntrinsicElements {