Convert CompilationModeScham to zod type
Sathya Gunasekaran committed
Nov 14, 2023 at 11:46 UTC
2efd85f145c021ac61098844b69353fc49b3878d
1 file changed
+7
-4
compiler/packages/babel-plugin-react-forget/src/Entrypoint/Options.ts
+7
-4
@@ -114,7 +114,7 @@ export type PluginOptions = {
114
enableUseMemoCachePolyfill: boolean;
115
};
116
117
-export type CompilationMode =
117
+const CompilationModeSchema = z.enum([
118
/*
119
* Compiles functions annotated with "use forget" or component/hook-like functions.
120
* This latter includes:
@@ -125,11 +125,14 @@ export type CompilationMode =
125
* false positives, since compilation has a greater impact than linting.
126
* This is the default mode
127
*/
128
- | "infer"
128
+ "infer",
129
// Compile only functions which are explicitly annotated with "use forget"
130
- | "annotation"
130
+ "annotation",
131
// Compile all top-level functions
132
- | "all";
132
+ "all",
133
+]);
134
+
135
+export type CompilationMode = z.infer<typeof CompilationModeSchema>;
136
137
/**
138
* Represents 'events' that may occur during compilation. Events are only