Skip to main content
Module

x/dectyl/mod.ts>check

Prototype library for testing Deno Deploy scripts using the Deno CLI
Go to Latest
function check
import { check } from "https://deno.land/x/dectyl@0.10.5/mod.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
optional
options: CheckOptions = [UNSUPPORTED]

Returns

Promise<Deno.Diagnostic[]>