← Back to Tutorial
TypeScript Compiler
TypeScript Code
Clear
Compile ▶
// TypeScript utility types example interface UserProfile { id: number; name: string; email: string; password: string; isAdmin: boolean; createdAt: Date; } type UpdateUser = Partial<UserProfile>; type ReadonlyUser = Readonly<UserProfile>; type UserIdentity = Pick<UserProfile, "id" | "name">; type UserSettings = Omit<UserProfile, "password" | "isAdmin">; const partialUpdate: UpdateUser = { name: "Alice" }; const readonlyUser: ReadonlyUser = { id: 1, name: "Bob", email: "bob@example.com", password: "secret", isAdmin: false, createdAt: new Date() }; const identity: UserIdentity = { id: 1, name: "Charlie" }; const settings: UserSettings = { name: "David", email: "david@example.com", createdAt: new Date() }
Output
Download JS
TypeScript code will be compiled here