0
0
DenoHow-ToBeginner ยท 3 min read

How to Skip Type Checking in Deno: Quick Guide

To skip type checking in Deno, run your script with the --no-check flag. This disables all type checking and speeds up execution by running the code directly without validation.
๐Ÿ“

Syntax

Use the --no-check flag when running your Deno script to skip type checking.

Example syntax:

  • deno run --no-check your_script.ts

This tells Deno to run the script without verifying types.

bash
deno run --no-check your_script.ts
๐Ÿ’ป

Example

This example shows running a TypeScript file with a type error but skipping type checking using --no-check.

typescript
console.log('Start');

// Intentional type error: assigning number to string variable
let name: string = 123;

console.log('Name:', name);
Output
Start Name: 123
โš ๏ธ

Common Pitfalls

Skipping type checking can cause runtime errors if your code has type mistakes. Use --no-check only when you trust the code or want faster startup during development.

Common mistakes include:

  • Ignoring type errors that cause crashes later.
  • Using --no-check in production, which is risky.

Always test thoroughly if you skip type checking.

bash
/* Wrong way: Running without --no-check with type errors */
denon run your_script.ts

/* Right way: Skipping type check intentionally */
denon run --no-check your_script.ts
๐Ÿ“Š

Quick Reference

FlagDescription
--no-checkSkip all type checking and run code directly
--unstableEnable unstable APIs (not related to type checking)
--allow-readAllow file system read access (permission flag)
โœ…

Key Takeaways

Use the --no-check flag to skip type checking in Deno.
Skipping type checks speeds up script execution but risks runtime errors.
Avoid using --no-check in production environments.
Test your code carefully if you disable type checking.
The syntax is: deno run --no-check your_script.ts