From 02e8cf97909029e0510c1a4e651d9679d2e2cc1b Mon Sep 17 00:00:00 2001 From: Mofei Zhang Date: Mon, 14 Aug 2023 19:26:01 -0400 Subject: [PATCH] [snap][easy] typecheck forget babel plugin options --- compiler/forget/packages/snap/src/compiler-worker.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/compiler/forget/packages/snap/src/compiler-worker.ts b/compiler/forget/packages/snap/src/compiler-worker.ts index 2449549ae3..f06177ffc6 100644 --- a/compiler/forget/packages/snap/src/compiler-worker.ts +++ b/compiler/forget/packages/snap/src/compiler-worker.ts @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +import type { runReactForgetBabelPlugin as RunReactForgetBabelPlugin } from 'babel-plugin-react-forget/src/Babel/RunReactForgetBabelPlugin'; +import type { Effect, ValueKind } from 'babel-plugin-react-forget/src/HIR'; import fs from "fs/promises"; import { exists } from "./utils"; @@ -77,7 +79,7 @@ export async function compile( try { // NOTE: we intentionally require lazily here so that we can clear the require cache // and load fresh versions of the compiler when `compilerVersion` changes. - const { runReactForgetBabelPlugin } = require(compilerPath); + const { runReactForgetBabelPlugin } = require(compilerPath) as { runReactForgetBabelPlugin: typeof RunReactForgetBabelPlugin }; const { toggleLogging } = require(loggerPath); // only try logging if we filtered out all but one fixture, @@ -158,8 +160,8 @@ export async function compile( [ "useFreeze", { - valueKind: "frozen", - effectKind: "freeze", + valueKind: "frozen" as ValueKind, + effectKind: "freeze" as Effect, }, ], ]), @@ -184,6 +186,7 @@ export async function compile( instrumentForget, panicOnBailout, isDev: true, + noEmit: false, }).code; } catch (e) { error = e;