#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
🔷 FREE · 34 SNIPPETS

TypeScript Cheat Sheet: Types You'll Use Every Day

From unions to generics and utility types, ready to copy.

  • 🧬 Generics
  • 🧰 Utility types
  • 🎯 Narrowing

How to use the TypeScript Cheat Sheet

  1. 1. Search or browseType a word like the function or task you need, or pick a section.
  2. 2. CopyEach snippet has its own Copy button, so you can paste it straight into your editor.
  3. 3. DownloadSave the whole TypeScript cheat sheet as plain text or Markdown for offline revision.

What's in it

The sheet covers TypeScript 5 features you'll meet in React, Angular and Node projects. The 34 snippets are organised into 10 sections: Basics, Types, Functions, Generics, Utility, Advanced, Narrowing, Classes, Config, Escape hatches.

Example

Search "utility" to see Partial, Required, Readonly, Pick, Omit, Record, ReturnType and Awaited together. Search "satisfies" for const cfg = { port: 3000 } satisfies Config, which checks the object against Config but keeps its precise type, unlike a plain annotation.

Tips for using it

  • Turn on strict in tsconfig; many snippets assume it.
  • Use the escape hatches in the last section rarely; they switch off the checks that catch bugs.

A quick look, one snippet per section

  • Basics: let id: number = 5; let name: string = "Asha"; let ok: boolean = true; (primitive annotations)
  • Types: type ID = string | number; (union type)
  • Functions: function greet(name: string, greeting = "Hi"): string { … } (parameters and return type)
  • Generics: function first<T>(arr: T[]): T | undefined { return arr[0]; } (generic function)
  • Utility: Partial<User> · Required<User> · Readonly<User> (make all optional / required / readonly)
  • Advanced: type Keys = keyof User; (union of property names)
  • Narrowing: if ("email" in u) { … } (in narrowing)
  • Classes: class Account { constructor(private balance: number) {} } (parameter property)
  • Config: "strict": true, "noUncheckedIndexedAccess": true (recommended tsconfig settings)

Search the box above for the rest of the TypeScript snippets, or download the full sheet.

Frequently asked questions

Which TypeScript version?

TypeScript 5.x; satisfies needs 4.9 or later.

Is this for Angular too?

Yes. These are core language features used in every framework.

Is the TypeScript cheat sheet free?

Yes. You can search, read and copy every snippet in the TypeScript cheat sheet without signing up. The first time you download it, we ask once for your name and WhatsApp number; after that downloads and every other Uncodemy tool open straight away.

More free tools

See all free tools