@samitouri / QOS-React-2 / commits / e70dfbb5a4

[babel] Lookup magic prop directly

Sathya Gunasekaran committed Aug 10, 2023 at 13:31 UTC e70dfbb5a43f42d047160c1c05c3b586d23762f8
1 file changed +3 -1
compiler/forget/packages/babel-plugin-react-forget/src/Entrypoint/Program.ts
+3 -1
@@ -330,7 +330,9 @@ function shouldVisitNode(
330 pass: CompilerPass
331 ): boolean {
332 if (pass.opts.enableOnlyOnReactScript) {
333 - if (!fn.get("__componentDeclaration")) {
333 + // Typescript gets angry about lookup the magic prop
334 + let fnAny = fn as any;
335 + if (!fnAny.node.__componentDeclaration) {
336 return false;
337 }
338 }