From e70dfbb5a43f42d047160c1c05c3b586d23762f8 Mon Sep 17 00:00:00 2001 From: Sathya Gunasekaran Date: Thu, 10 Aug 2023 13:31:46 -0400 Subject: [PATCH] [babel] Lookup magic prop directly --- .../babel-plugin-react-forget/src/Entrypoint/Program.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/forget/packages/babel-plugin-react-forget/src/Entrypoint/Program.ts b/compiler/forget/packages/babel-plugin-react-forget/src/Entrypoint/Program.ts index b62f707340..1b707f80f5 100644 --- a/compiler/forget/packages/babel-plugin-react-forget/src/Entrypoint/Program.ts +++ b/compiler/forget/packages/babel-plugin-react-forget/src/Entrypoint/Program.ts @@ -330,7 +330,9 @@ function shouldVisitNode( pass: CompilerPass ): boolean { if (pass.opts.enableOnlyOnReactScript) { - if (!fn.get("__componentDeclaration")) { + // Typescript gets angry about lookup the magic prop + let fnAny = fn as any; + if (!fnAny.node.__componentDeclaration) { return false; } }