All Languages
TS
TypeScript
JavaScript with types
TypeScript adds static typing to JavaScript, catching errors at compile time and enabling powerful tooling for large codebases.
Large-scale apps
React/Next.js
Node.js APIs
Libraries & SDKs
Time to learn: 1-2 months (after JS)
1Type Annotations
beginner
Add explicit types to variables, parameters and return values.
function greet(name: string): string {
return `Hello, ${name}`;
}
const age: number = 25;
const tags: string[] = ["dev", "ts"];2Interfaces vs Types
beginner
Both describe object shapes; interfaces can be extended/merged, types can form unions.
interface User {
id: number;
name: string;
}
type Status = "active" | "inactive";
const u: User = { id: 1, name: "Ada" };
const s: Status = "active";3Generics
intermediate
Write functions and types that work over multiple types without losing type safety.
function first<T>(items: T[]): T | undefined {
return items[0];
}
const n = first<number>([1, 2, 3]); // number | undefined
const s = first(["a", "b"]); // string | undefined4Utility Types
intermediate
Built-in helpers transform existing types — invaluable in real apps.
interface Todo { id: number; title: string; done: boolean; }
type TodoPreview = Pick<Todo, "id" | "title">;
type PartialTodo = Partial<Todo>;
type ReadonlyTodo = Readonly<Todo>;Built something with TypeScript?
Generate a professional README for your project in seconds.