diff --git a/npm-packages/convex/src/cli/deploy.ts b/npm-packages/convex/src/cli/deploy.ts index a3a0415b..6f325283 100644 --- a/npm-packages/convex/src/cli/deploy.ts +++ b/npm-packages/convex/src/cli/deploy.ts @@ -56,6 +56,11 @@ export const deploy = new Command("deploy") .choices(["enable", "try", "disable"] as const) .default("try" as const), ) + .option( + "--typecheck-components", + "Check TypeScript files within component implementations with `tsc --noEmit`.", + false, + ) .addOption( new Option( "--codegen ", @@ -167,6 +172,7 @@ async function deployToNewPreviewDeployment( cmd?: string | undefined; verbose?: boolean | undefined; typecheck: "enable" | "try" | "disable"; + typecheckComponents: boolean; codegen: "enable" | "disable"; debug?: boolean | undefined; @@ -228,6 +234,7 @@ async function deployToNewPreviewDeployment( verbose: !!options.verbose, dryRun: false, typecheck: options.typecheck, + typecheckComponents: options.typecheckComponents, debug: !!options.debug, debugBundlePath: options.debugBundlePath, codegen: options.codegen === "enable", @@ -265,6 +272,7 @@ async function deployToExistingDeployment( dryRun?: boolean | undefined; yes?: boolean | undefined; typecheck: "enable" | "try" | "disable"; + typecheckComponents: boolean; codegen: "enable" | "disable"; cmd?: string | undefined; cmdUrlEnvVarName?: string | undefined; @@ -323,6 +331,7 @@ async function deployToExistingDeployment( verbose: !!options.verbose, dryRun: !!options.dryRun, typecheck: options.typecheck, + typecheckComponents: options.typecheckComponents, debug: !!options.debug, debugBundlePath: options.debugBundlePath, codegen: options.codegen === "enable", diff --git a/npm-packages/convex/src/cli/dev.ts b/npm-packages/convex/src/cli/dev.ts index 0c1a2a91..0474458c 100644 --- a/npm-packages/convex/src/cli/dev.ts +++ b/npm-packages/convex/src/cli/dev.ts @@ -47,6 +47,11 @@ export const dev = new Command("dev") .choices(["enable", "try", "disable"] as const) .default("try" as const), ) + .option( + "--typecheck-components", + "Check TypeScript files within component implementations with `tsc --noEmit`.", + false, + ) .addOption( new Option("--codegen ", "Regenerate code in `convex/_generated/`") .choices(["enable", "disable"] as const) @@ -196,6 +201,7 @@ export const dev = new Command("dev") verbose: !!cmdOptions.verbose, dryRun: false, typecheck: cmdOptions.typecheck, + typecheckComponents: !!cmdOptions.typecheckComponents, debug: false, debugBundlePath: cmdOptions.debugBundlePath, codegen: cmdOptions.codegen === "enable", diff --git a/npm-packages/convex/src/cli/lib/components.ts b/npm-packages/convex/src/cli/lib/components.ts index 96087005..6b72a64c 100644 --- a/npm-packages/convex/src/cli/lib/components.ts +++ b/npm-packages/convex/src/cli/lib/components.ts @@ -100,6 +100,7 @@ export async function runCodegen(ctx: Context, options: CodegenOptions) { verbose: options.dryRun, codegen: true, liveComponentSources: options.liveComponentSources, + typecheckComponents: false, }, ); } else { @@ -140,6 +141,7 @@ async function startComponentsPushAndCodegen( configPath: string, options: { typecheck: TypeCheckMode; + typecheckComponents: boolean; adminKey: string; url: string; verbose: boolean; @@ -331,8 +333,10 @@ async function startComponentsPushAndCodegen( changeSpinner(ctx, "Running TypeScript..."); await parentSpan.enterAsync("typeCheckFunctionsInMode", async () => { await typeCheckFunctionsInMode(ctx, options.typecheck, rootComponent.path); - for (const directory of components.values()) { - await typeCheckFunctionsInMode(ctx, options.typecheck, directory.path); + if (options.typecheckComponents) { + for (const directory of components.values()) { + await typeCheckFunctionsInMode(ctx, options.typecheck, directory.path); + } } }); diff --git a/npm-packages/convex/src/cli/lib/push.ts b/npm-packages/convex/src/cli/lib/push.ts index af0a6290..a59d5064 100644 --- a/npm-packages/convex/src/cli/lib/push.ts +++ b/npm-packages/convex/src/cli/lib/push.ts @@ -18,6 +18,7 @@ export type PushOptions = { verbose: boolean; dryRun: boolean; typecheck: "enable" | "try" | "disable"; + typecheckComponents: boolean; debug: boolean; debugBundlePath?: string; codegen: boolean; diff --git a/npm-packages/convex/src/cli/run.ts b/npm-packages/convex/src/cli/run.ts index ebefc4d3..e0a297f7 100644 --- a/npm-packages/convex/src/cli/run.ts +++ b/npm-packages/convex/src/cli/run.ts @@ -36,6 +36,11 @@ export const run = new Command("run") .choices(["enable", "try", "disable"] as const) .default("try" as const), ) + .option( + "--typecheck-components", + "Check TypeScript files within component implementations with `tsc --noEmit`.", + false, + ) .addOption( new Option("--codegen ", "Regenerate code in `convex/_generated/`") .choices(["enable", "disable"] as const) @@ -84,6 +89,7 @@ export const run = new Command("run") verbose: false, dryRun: false, typecheck: options.typecheck, + typecheckComponents: options.typecheckComponents, debug: false, codegen: options.codegen === "enable", url: deploymentUrl,