Skip to content
Guest
← All References
TypeScript TypeScript 5.x

TypeScript 5 Quick Reference

Essential TypeScript syntax: annotations, interfaces, discriminated unions, generics, and utility types.

type PublicUser = Omit<User, 'passwordHash'>;

Core Types & Narrowing

SyntaxPurposeExample
readonly / ?Immutable / optional fieldsinterface User { readonly id: string; bio?: string; }
A | BUnion & literal typestype Status = "idle" | "loading" | "done";
unknownSafe top type (narrow first)if (typeof x === "string") x.toUpperCase();
<T, K extends keyof T>Constrained genericsfunction get<T, K extends keyof T>(o: T, k: K)

Utility Types

UtilityEffectExample
Partial<T>All properties optionalPartial<User>
Pick<T, K>Keep selected keysPick<User, "id" | "name">
Omit<T, K>Remove selected keysOmit<User, "password">
Record<K, V>Typed key-value objectRecord<string, number>

Search courses, lessons, and references

Type to search across all courses, lessons, and quick references.

Press Esc to close Powered by Pagefind