Skip to content

Commit

Permalink
Report the TypeScript error for failing npx convex typecheck (#30191)
Browse files Browse the repository at this point in the history
npx convex typecheck now attempts to report the TypeScript error

GitOrigin-RevId: 483b79db301010592eedeafe0a91465d7debace1
  • Loading branch information
thomasballinger authored and Convex, Inc. committed Oct 7, 2024
1 parent 7059865 commit 6577d59
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/cli/typecheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,17 @@ export const typecheck = new Command("typecheck")
await typeCheckFunctions(
ctx,
functionsDir(configPath, localConfig.projectConfig),
async (typecheckResult, logSpecificError) => {
async (typecheckResult, logSpecificError, runOnError) => {
logSpecificError?.();
if (typecheckResult === "typecheckFailed") {
logMessage(ctx, chalk.gray("Typecheck failed"));
try {
await runOnError?.();
// If runOnError doesn't throw then it worked the second time.
// No errors to report, but it's still a failure.
} catch {
// As expected, `runOnError` threw
}
return await ctx.crash({
exitCode: 1,
errorType: "invalid filesystem data",
Expand Down

0 comments on commit 6577d59

Please sign in to comment.