[React.14] Add ReactInstance type (Component<any, any> | Element)

This commit is contained in:
Vincent Siao
2015-11-05 11:25:16 -08:00
parent 15eff541e0
commit a43c2843cd
3 changed files with 24 additions and 32 deletions
+3 -8
View File
@@ -112,6 +112,8 @@ declare namespace __React {
// Component API
// ----------------------------------------------------------------------
type ReactInstance = Component<any, any> | Element;
// Base component for plain JS classes
class Component<P, S> implements ComponentLifecycle<P, S> {
static propTypes: ValidationMap<any>;
@@ -128,7 +130,7 @@ declare namespace __React {
state: S;
context: {};
refs: {
[key: string]: Component<any, any> | Element
[key: string]: ReactInstance
};
}
@@ -138,13 +140,6 @@ declare namespace __React {
getInitialState?(): S;
}
interface DOMComponent<P> extends ClassicComponent<P, any> {
tagName: string;
}
type HTMLComponent = DOMComponent<HTMLProps>;
type SVGComponent = DOMComponent<SVGProps>;
interface ChildContextProvider<CC> {
getChildContext(): CC;
}