mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 07:17:04 +00:00
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:
Vendored
+4
-4
@@ -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 }>
|
||||
|
||||
Reference in New Issue
Block a user