Skip to content

TypeScript

TypeScript is a superset of JavaScript that adds static types to the language. This allows for better tooling, such as code completion, refactoring, and type checking. Learn TypeScript at Codecademy.

TypeScript example

typescript
interface User {
  id: number;
  firstName: string;
  lastName: string;
  role: string;
}

function updateUser(id: number, update: Partial<User>) {
  const user = getUser(id);
  const newUser = { ...user, ...update };
  saveUser(id, newUser);
}