Avoid extends check for React.memo and React.lazy (#35272)

This is extremely expensive. Doesn't address the underlying issue that
ComponentProps and PropsWithRef are extremely expensive.
This commit is contained in:
Nathan Shively-Sanders
2019-05-07 20:12:47 -07:00
committed by GitHub
parent f2cb8276df
commit e2e5298c1f
+4 -4
View File
@@ -777,9 +777,9 @@ declare namespace React {
// will show `Memo(${Component.displayName || Component.name})` in devtools by default,
// but can be given its own specific name
interface MemoExoticComponent<T extends ComponentType<any>> extends NamedExoticComponent<ComponentPropsWithRef<T>> {
type MemoExoticComponent<T extends ComponentType<any>> = NamedExoticComponent<ComponentPropsWithRef<T>> & {
readonly type: T;
}
};
function memo<P extends object>(
Component: SFC<P>,
@@ -790,9 +790,9 @@ declare namespace React {
propsAreEqual?: (prevProps: Readonly<ComponentProps<T>>, nextProps: Readonly<ComponentProps<T>>) => boolean
): MemoExoticComponent<T>;
interface LazyExoticComponent<T extends ComponentType<any>> extends ExoticComponent<ComponentPropsWithRef<T>> {
type LazyExoticComponent<T extends ComponentType<any>> = ExoticComponent<ComponentPropsWithRef<T>> & {
readonly _result: T;
}
};
function lazy<T extends ComponentType<any>>(
factory: () => Promise<{ default: T }>