Merge branch 'master' into revert-3492-react-reactcomponent-type-insteadof-instance

Conflicts:
	react/react.d.ts
This commit is contained in:
Vincent Siao
2015-01-23 16:05:04 -08:00
2 changed files with 54 additions and 57 deletions
+1 -3
View File
@@ -193,9 +193,7 @@ var childMap: { [key: string]: number } =
React.Children.map<number>(children, (child) => { return 42; });
React.Children.forEach(children, (child) => {});
var nChildren: number = React.Children.count(children);
var onlyChild = React.Children.only([null, [[["Hallo"], true]], false, {
test: null
}]);
var onlyChild = React.Children.only([null, [[["Hallo"], true]], false]);
//
// Example from http://facebook.github.io/react/
+53 -54
View File
@@ -8,12 +8,12 @@ declare module React {
// React Elements
// ----------------------------------------------------------------------
// type ReactType = ComponentClass<any> | string;
type ReactType = ComponentClass<any> | string;
interface ReactElement<P> {
type: any; // ReactType
type: ComponentClass<P> | string;
props: P;
key: any; // number | string
key: number | string;
ref: string;
}
@@ -22,14 +22,15 @@ declare module React {
//
// React Nodes
// http://facebook.github.io/react/docs/glossary.html
// ----------------------------------------------------------------------
// type ReactText = string | number;
// type Fragment = ReactNode[];
// type ReactNode = ReactElement<any> | Fragment | ReactText | KeyMap;
// interface KeyMap {
// [key: string]: ReactNode;
// }
type ReactText = string | number;
type ReactChild = ReactElement<any> | ReactText;
// Should be Array<ReactNode> but type aliases cannot be recursive
type ReactFragment = Array<ReactChild | any[] | boolean>;
type ReactNode = ReactChild | ReactFragment | boolean;
//
// React Components
@@ -52,7 +53,7 @@ declare module React {
// ----------------------------------------------------------------------
interface ComponentFactory<P> {
(props?: P, ...children: any/*ReactNode*/[]): ReactElement<P>;
(props?: P, ...children: ReactNode[]): ReactElement<P>;
}
interface HTMLFactory extends ComponentFactory<HTMLAttributes> {}
@@ -64,7 +65,7 @@ declare module React {
interface TopLevelAPI {
createClass<P>(spec: ComponentSpec<P, any>): ComponentClass<P>;
createElement<P>(type: any/*ReactType*/, props: P, ...children: any/*ReactNode*/[]): ReactElement<P>;
createElement<P>(type: ComponentClass<P> | string, props: P, ...children: ReactNode[]): ReactElement<P>;
createFactory<P>(componentClass: ComponentClass<P>): ComponentFactory<P>;
render<P>(element: ReactElement<P>, container: Element, callback?: () => any): Component<P>;
unmountComponentAtNode(container: Element): boolean;
@@ -241,8 +242,8 @@ declare module React {
// ----------------------------------------------------------------------
export interface ReactAttributes {
children?: any; // ReactNode
key?: any; // number | string
children?: ReactNode;
key?: number | string;
ref?: string;
// Event Attributes
@@ -282,13 +283,13 @@ declare module React {
onWheel?: WheelEventHandler;
dangerouslySetInnerHTML?: {
__html: string
__html: string;
};
}
interface CSSProperties {
columnCount?: number;
flex?: any; // number | string
flex?: number | string;
flexGrow?: number;
flexShrink?: number;
fontWeight?: number;
@@ -318,8 +319,8 @@ declare module React {
autoComplete?: boolean;
autoFocus?: boolean;
autoPlay?: boolean;
cellPadding?: any; // number | string
cellSpacing?: any; // number | string
cellPadding?: number | string;
cellSpacing?: number | string;
charSet?: string;
checked?: boolean;
classID?: string;
@@ -342,8 +343,8 @@ declare module React {
encType?: string;
form?: string;
formNoValidate?: boolean;
frameBorder?: any; // number | string
height?: any; // number | string
frameBorder?: number | string;
height?: number | string;
hidden?: boolean;
href?: string;
hrefLang?: string;
@@ -356,12 +357,12 @@ declare module React {
list?: string;
loop?: boolean;
manifest?: string;
max?: any; // number | string
max?: number | string;
maxLength?: number;
media?: string;
mediaGroup?: string;
method?: string;
min?: any; // number | string
min?: number | string;
multiple?: boolean;
muted?: boolean;
name?: string;
@@ -394,7 +395,7 @@ declare module React {
srcDoc?: string;
srcSet?: string;
start?: number;
step?: any; // number | string
step?: number | string;
style?: CSSProperties;
tabIndex?: number;
target?: string;
@@ -402,7 +403,7 @@ declare module React {
type?: string;
useMap?: string;
value?: string;
width?: any; // number | string
width?: number | string;
wmode?: string;
// Non-standard Attributes
@@ -415,49 +416,49 @@ declare module React {
}
interface SVGAttributes extends ReactAttributes {
cx?: any; // SVGLength | SVGAnimatedLength
cx?: SVGLength | SVGAnimatedLength;
cy?: any;
d?: string;
dx?: any; // SVGLength | SVGAnimatedLength
dy?: any; // SVGLength | SVGAnimatedLength
dx?: SVGLength | SVGAnimatedLength;
dy?: SVGLength | SVGAnimatedLength;
fill?: any; // SVGPaint | string
fillOpacity?: any; // number | string
fillOpacity?: number | string;
fontFamily?: string;
fontSize?: any; // number | string
fx?: any; // SVGLength | SVGAnimatedLength
fy?: any; // SVGLength | SVGAnimatedLength
gradientTransform?: any; // SVGTransformList | SVGAnimatedTransformList
fontSize?: number | string;
fx?: SVGLength | SVGAnimatedLength;
fy?: SVGLength | SVGAnimatedLength;
gradientTransform?: SVGTransformList | SVGAnimatedTransformList;
gradientUnits?: string;
markerEnd?: string;
markerMid?: string;
markerStart?: string;
offset?: any; // number | string
opacity?: any; // number | string
offset?: number | string;
opacity?: number | string;
patternContentUnits?: string;
patternUnits?: string;
points?: string;
preserveAspectRatio?: string;
r?: any; // SVGLength | SVGAnimatedLength
rx?: any; // SVGLength | SVGAnimatedLength
ry?: any; // SVGLength | SVGAnimatedLength
r?: SVGLength | SVGAnimatedLength;
rx?: SVGLength | SVGAnimatedLength;
ry?: SVGLength | SVGAnimatedLength;
spreadMethod?: string;
stopColor?: any; // SVGColor | string
stopOpacity?: any; // number | string
stopOpacity?: number | string;
stroke?: any; // SVGPaint
strokeDasharray?: string;
strokeLinecap?: string;
strokeOpacity?: any; // number | string
strokeWidth?: any; // SVGLength | SVGAnimatedLength
strokeOpacity?: number | string;
strokeWidth?: SVGLength | SVGAnimatedLength;
textAnchor?: string;
transform?: any; // SVGTransformList | SVGAnimatedTransformList
transform?: SVGTransformList | SVGAnimatedTransformList;
version?: string;
viewBox?: string;
x1?: any; // SVGLength | SVGAnimatedLength
x2?: any; // SVGLength | SVGAnimatedLength
x?: any; // SVGLength | SVGAnimatedLength
y1?: any; // SVGLength | SVGAnimatedLength
y2?: any; // SVGLength | SVGAnimatedLength
y?: any; // SVGLength | SVGAnimatedLength
x1?: SVGLength | SVGAnimatedLength;
x2?: SVGLength | SVGAnimatedLength;
x?: SVGLength | SVGAnimatedLength;
y1?: SVGLength | SVGAnimatedLength;
y2?: SVGLength | SVGAnimatedLength
y?: SVGLength | SVGAnimatedLength;
}
//
@@ -637,13 +638,11 @@ declare module React {
// React.Children
// ----------------------------------------------------------------------
// type Child = ReactElement<any> | ReactText;
interface ReactChildren {
map<T>(children: any/*ReactNode*/, fn: (child: any/*Child*/) => T): { [key:string]: T };
forEach(children: any/*ReactNode*/, fn: (child: any/*Child*/) => any): void;
count(children: any/*ReactNode*/): number;
only(children: any/*ReactNode*/): any/*Child*/;
map<T>(children: ReactNode, fn: (child: ReactChild) => T): { [key:string]: T };
forEach(children: ReactNode, fn: (child: ReactChild) => any): void;
count(children: ReactNode): number;
only(children: ReactNode): ReactChild;
}
//
@@ -659,7 +658,7 @@ declare module React {
// ----------------------------------------------------------------------
interface TransitionGroupProps {
component?: any; // ReactType
component?: ReactType;
childFactory?: (child: ReactElement<any>) => ReactElement<any>;
}
@@ -757,7 +756,7 @@ declare module React {
mockComponent(mocked: MockedComponentClass, mockTagName?: string): ReactTestUtils;
isElementOfType(element: ReactElement<any>, type: any/*ReactType*/): boolean;
isElementOfType(element: ReactElement<any>, type: ReactType): boolean;
isDOMComponent(instance: Component<any>): boolean;
isCompositeComponent(instance: Component<any>): boolean;
isCompositeComponentWithType(instance: Component<any>, type: ComponentClass<any>): boolean;