[snap][easy] typecheck forget babel plugin options
Mofei Zhang committed
Aug 14, 2023 at 19:26 UTC
02e8cf97909029e0510c1a4e651d9679d2e2cc1b
1 file changed
+6
-3
compiler/forget/packages/snap/src/compiler-worker.ts
+6
-3
@@ -5,6 +5,8 @@
5
* LICENSE file in the root directory of this source tree.
6
*/
7
8
+import type { runReactForgetBabelPlugin as RunReactForgetBabelPlugin } from 'babel-plugin-react-forget/src/Babel/RunReactForgetBabelPlugin';
9
+import type { Effect, ValueKind } from 'babel-plugin-react-forget/src/HIR';
10
import fs from "fs/promises";
11
import { exists } from "./utils";
12
@@ -77,7 +79,7 @@ export async function compile(
79
try {
80
// NOTE: we intentionally require lazily here so that we can clear the require cache
81
// and load fresh versions of the compiler when `compilerVersion` changes.
80
- const { runReactForgetBabelPlugin } = require(compilerPath);
82
+ const { runReactForgetBabelPlugin } = require(compilerPath) as { runReactForgetBabelPlugin: typeof RunReactForgetBabelPlugin };
83
const { toggleLogging } = require(loggerPath);
84
85
// only try logging if we filtered out all but one fixture,
@@ -158,8 +160,8 @@ export async function compile(
160
[
161
"useFreeze",
162
{
161
- valueKind: "frozen",
162
- effectKind: "freeze",
163
+ valueKind: "frozen" as ValueKind,
164
+ effectKind: "freeze" as Effect,
165
},
166
],
167
]),
@@ -184,6 +186,7 @@ export async function compile(
186
instrumentForget,
187
panicOnBailout,
188
isDev: true,
189
+ noEmit: false,
190
}).code;
191
} catch (e) {
192
error = e;