Sequence NODE_161
Easy

Define a Basic User Type

TypeScript
Technical Specification

Create a User type with id, name, email, and isAdmin fields and use it to type a user object.

Input/Output Samples
Input:User with id, name, email, isAdmin
Output:Well-typed user object
Optimal Logic Path
type User = {
  id: number;
  name: string;
  email: string;
  isAdmin: boolean;
};

const user: User = {
  id: 1,
  name: "Happy",
  email: "happy@example.com",
  isAdmin: false,
};
Architectural Deep-Dive
We define a reusable User type to ensure any user object always has the same required structure.