Merge pull request #14476 from DefinitelyTyped/master-revertFix

[Master] Revert incorrect fix to React
This commit is contained in:
Yui
2017-02-06 18:09:22 -08:00
committed by GitHub
5 changed files with 8 additions and 13 deletions

View File

@@ -75,7 +75,7 @@ declare namespace ReactDayPicker {
toMonth?: Date;
localeUtils?: LocaleUtils;
locale?: string;
captionElement?: React.ReactElement<CaptionElementProps> | null;
captionElement?: React.ReactElement<CaptionElementProps>;
onDayClick?: (e: React.SyntheticEvent<{}>, day: Date, modifiers: DayModifiers) => any;
onDayTouchTap?: (e: React.SyntheticEvent<{}>, day: Date, modifiers: DayModifiers) => any;
onDayMouseEnter?: (e: React.SyntheticEvent<{}>, day: Date, modifiers: DayModifiers) => any;

View File

@@ -28,7 +28,7 @@ declare namespace ReactDOM {
container: Element | null,
callback?: (component: T) => any): T;
function render<P>(
element: ReactElement<P> | null,
element: ReactElement<P>,
container: Element | null,
callback?: (component?: Component<P, ComponentState> | Element) => any): Component<P, ComponentState> | Element | void;
@@ -57,7 +57,7 @@ declare namespace ReactDOM {
callback?: () => any): void;
function unstable_renderSubtreeIntoContainer<P>(
parentComponent: Component<any, any>,
element: ReactElement<P> | null,
element: ReactElement<P>,
container: Element,
callback?: (component?: Component<P, ComponentState> | Element) => any): Component<P, ComponentState> | Element | void;
}

View File

@@ -18,7 +18,7 @@ class SwiperTest extends React.Component<IProperties, IState> {
super(props);
}
public render(): React.ReactElement<any> | null {
public render(): React.ReactElement<any> {
return (
<Swiper
style={styles.wrapper}>

10
react/index.d.ts vendored
View File

@@ -171,7 +171,7 @@ declare namespace React {
setState<K extends keyof S>(f: (prevState: S, props: P) => Pick<S, K>, callback?: () => any): void;
setState<K extends keyof S>(state: Pick<S, K>, callback?: () => any): void;
forceUpdate(callBack?: () => any): void;
render(): JSX.Element;
render(): JSX.Element | null;
// React.Props<T> is now deprecated, which means that the `children`
// property is not available on `P` by default, even though you can
@@ -204,7 +204,7 @@ declare namespace React {
type SFC<P> = StatelessComponent<P>;
interface StatelessComponent<P> {
(props: P & { children?: ReactNode }, context?: any): ReactElement<any> | null;
(props: P & { children?: ReactNode }, context?: any): ReactElement<any>;
propTypes?: ValidationMap<P>;
contextTypes?: ValidationMap<any>;
defaultProps?: P;
@@ -2628,11 +2628,9 @@ declare namespace React {
declare global {
namespace JSX {
interface JSXElement extends React.ReactElement<any> { }
type Element = JSXElement | null;
interface Element extends React.ReactElement<any> { }
interface ElementClass extends React.Component<any, any> {
render(): JSX.Element;
render(): JSX.Element | null;
}
interface ElementAttributesProperty { props: {}; }

View File

@@ -32,6 +32,3 @@ StatelessComponent2.defaultProps = {
</text>
</g>
</svg>;
const CustomComponent = (props: { flag: boolean }) => props.flag ? React.createElement('div') : null;
const UseComponent2 = (f: boolean) => <CustomComponent flag={f} />;