import { check } from "https://deno.land/x/dectyl@0.10.5/lib/deploy_worker.ts";
Type check a script as if it were a Deploy script, resolving with an array of diagnostic information. If the array is empty, there were no issues with type checking.
const diagnostics = await check("./my_deploy_script.ts");
if (diagnostics.length) {
console.log("there were errors");
}
Deno.formatDiagnostics()
can be used to format any diagnostics returned
which provides a more human readable version:
const diagnostics = await check("./my_deploy_script.ts");
if (diagnostics.length) {
console.log(Deno.formatDiagnostics(diagnostics));
}
By default, the type checking will type check the script as both a Deno Deploy and Deno CLI script. This means code written for Deno CLI and Deploy should type check ok, but may lead to runtime errors if the code using the CLI only APIs does not properly detect the environment it is running it. The options argument can be used to modify this behavior.
Parameters
specifier: string | URL