Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoblee93 committed Jul 29, 2024
1 parent 0b3bc4b commit 2b4f459
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions docs/core_docs/scripts/validate_notebook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const run = async () => {
skipLibCheck: true,
});
const diagnostics = ts.getPreEmitDiagnostics(program);
const issueStrings: string[] = [];
if (diagnostics.length === 0) {
console.log("No type errors found.");
} else {
Expand All @@ -56,18 +57,25 @@ const run = async () => {
diagnostic.messageText,
"\n"
);
console.log(
issueStrings.push(
`${diagnostic.file.fileName} (${line + 1},${
character + 1
}): ${message}`
);
} else {
console.log(
issueStrings.push(
ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")
);
}
});
}
if (issueStrings.length) {
const issues = issueStrings.join("\n");
console.error(issues);
const err = new Error("Found type errors in new notebook:");
(err as any).details = issues;
throw err;
}
} finally {
try {
fs.rmSync(tempFilepath);
Expand Down

0 comments on commit 2b4f459

Please sign in to comment.