---
title: "A Gentle Intro to TypeScript"
description: "TypeScript catches the bugs that JavaScript's dynamic typing and implicit type coercion allow, such as add(1, \"2\") returning \"12\", by reporting them at compile time instead of at runtime."
url: "https://swe.quest/articles/a-gentle-intro-to-typescript-acf96e72b2375e24"
canonical: "https://deno.com/blog/deno-bites-ts-intro"
source: "Deno"
published: "2024-06-27"
difficulty: "medium"
kind: "How-to"
reading_minutes: 5
tags: ["typescript","type-systems","javascript"]
---

# A Gentle Intro to TypeScript

A post on [Deno](https://swe.quest/sources/deno.md), published 2024-06-27, 5 min read, How-to. Original: [https://deno.com/blog/deno-bites-ts-intro](https://deno.com/blog/deno-bites-ts-intro)

## Summary

TypeScript catches the bugs that JavaScript's dynamic typing and implicit type coercion allow, such as add(1, "2") returning "12", by reporting them at compile time instead of at runtime. Annotating function parameters with \`: number\` is enough for the compiler to reject invalid calls and to infer return and variable types. The usual practice is to add just enough annotations and let inference handle the rest. Node projects need the \`typescript\` package and \`tsc\`, while Deno and Vite compile TypeScript transparently.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [TypeScript](https://swe.quest/tags/typescript.md) (Languages)
- [Type systems](https://swe.quest/tags/type-systems.md) (Compilers & runtimes)
- [JavaScript](https://swe.quest/tags/javascript.md) (Languages)

## Prerequisites

- JavaScript basics ([easy posts on JavaScript](https://swe.quest/tags/javascript.md?difficulty=easy))

## Keywords

TypeScript, Deno, tsc, Vite, type coercion

## Related posts

- [Node just added TypeScript support. What does that mean for Deno?](https://swe.quest/articles/node-just-added-typescript-support-what-does-that-mean-for-deno-14b91bca00f94e31.md): Deno · 2025-03-06 · Easy · 4 min read · TypeScript, Runtimes & VMs, Developer tools, JavaScript
  Node 22.6 added TypeScript execution via type stripping (stable in 23.6), which replaces annotations with whitespace but does no type checking, does not handle JSX/TSX, and still relies on tsc and a manually managed tsconfig.json.
- [Deno 1.23 Release Notes](https://swe.quest/articles/deno-1-23-release-notes-635b0ecf9d73ce3f.md): Deno · 2022-06-16 · Medium · 10 min read · TypeScript, JavaScript, Runtimes & VMs, Developer tools
  Deno 1.23 stops type-checking by default on \`deno run\`, \`deno eval\` and \`deno cache\`, using fast linear-time type-stripping instead, because TypeScript compiler checks are slow and editors already type-check via LSP; \`--check\` restores the old behavior and \`--check=all\` covers remote modules.
- [Deno 1.21 Release Notes](https://swe.quest/articles/deno-1-21-release-notes-15cae60c27335cbc.md): Deno · 2022-04-21 · Medium · 18 min read · JavaScript, TypeScript, Runtimes & VMs, Developer tools, Testing
  Deno 1.21 adds a \`deno check\` subcommand and begins a phased plan to disable type checking by default in \`deno run\`, citing type-check cost as the main startup bottleneck and alignment with the proposed native JS type annotations.
- [Deno 1.32: Enhanced Node.js Compatibility](https://swe.quest/articles/deno-1-32-enhanced-node-js-compatibility-b203aa007c83fdbd.md): Deno · 2023-03-23 · Medium · 5 min read · JavaScript, Runtimes & VMs, TypeScript
  Deno 1.32 improves Node.js compatibility by installing npm packages only when a bare specifier matches package.json, surfacing package.json errors lazily, adding DENO\_NO\_PACKAGE\_JSON, and supporting createCipheriv/createDecipheriv in node:crypto. \`deno compile\` now handles dynamic imports and Web Workers, bundling statically analyzable specifiers automatically and others via a new --include flag.
- [Deno 1.27: Major IDE Improvements](https://swe.quest/articles/deno-1-27-major-ide-improvements-1eb17f9996f7a8fa.md): Deno · 2022-10-27 · Medium · 10 min read · Runtimes & VMs, TypeScript, JavaScript, Developer tools
  Deno 1.27 exposes TypeScript inlay hints through its language server, with configurable hints for parameter names, inferred variable and return types, and enum values, and improves deno.land/x registry completions in editors. npm compatibility gains automatic type pickup from packages, @deno-types and @types/node directives, Node-API native module support behind --allow-ffi, lockfile v2 entries for npm packages, and dist-tag specifiers.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
