From e2e5298c1f2d2ea96fba2413b5bbe767f11c01f6 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 7 May 2019 20:12:47 -0700 Subject: [PATCH] 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. --- types/react/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index ed0c1d90ce..c018d39290 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -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> extends NamedExoticComponent> { + type MemoExoticComponent> = NamedExoticComponent> & { readonly type: T; - } + }; function memo

( Component: SFC

, @@ -790,9 +790,9 @@ declare namespace React { propsAreEqual?: (prevProps: Readonly>, nextProps: Readonly>) => boolean ): MemoExoticComponent; - interface LazyExoticComponent> extends ExoticComponent> { + type LazyExoticComponent> = ExoticComponent> & { readonly _result: T; - } + }; function lazy>( factory: () => Promise<{ default: T }>