Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk3 min

TypeScript Interface vs. Type Alias: Which Should You Use for Object Shapes?

Interfaces and type aliases can both describe object shapes. Choose based on whether you need extension, merging, unions, tuples, or intersections.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For an ordinary named object shape, either an interface or a type alias can work. Prefer an interface when the shape is meant to be extended or intentionally augmented; use a type alias when you need to describe a union, tuple, or other type expression that an interface cannot represent. For equivalent, closed object shapes, follow the style already used in your project.

Both can describe an object shape

Neither declaration creates a JavaScript object or changes runtime behavior. Both give TypeScript a name for a compile-time shape; the practical differences are what each form can express and how other declarations can build on it.

A type alias names a type rather than creating a distinct nominal type. It can name an object shape, but also a primitive, union, tuple, or another type expression. An interface is designed to describe an object shape and can be extended. The TypeScript Handbook recommends using an interface over a type alias when possible, noting that interfaces are open to extension.

Use interface for an extendable object contract

Use interface when you want to name an object shape that other interfaces or types can extend, especially when it represents a public contract. An extends clause expresses that one shape builds on another:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
interface Entity {
  id: string;
}

interface User extends Entity {
  email: string;
}

User includes the members of Entity as well as its own. Interfaces can extend one or more types, allowing shared members to be declared once and making the relationship between the shapes explicit. The Handbook explains this pattern in its section on extending types.

Use a type alias for unions, tuples, and other type expressions

An interface cannot directly name a union or tuple. A type alias can, so it is the natural choice when a value may have one of several shapes or when the type is a tuple:

Rank #2
TypeScript Programming Language - Software Engineer & Coder T-Shirt
  • TypeScript implements a superset of syntax for strictly typed development, facilitating deep static analysis and enhanced development environment integration. The compiler translates source into standard script formats, ensuring parity across any runtime.
  • TypeScript is ideal for front-end developers, full-stack engineers, and software architects who build large-scale web applications. It serves those looking to improve code excellence, reduce bugs through static checking, and maintain complex projects more.
  • Lightweight, Classic fit, Double-needle sleeve and bottom hem
type Result =
  | { state: "success"; value: string }
  | { state: "error"; message: string };

type Point = [number, number];

In the Result union, a value is one alternative, not a value that must satisfy both. TypeScript can narrow the alternatives using their shared literal property:

function describe(result: Result) {
  if (result.state === "success") {
    return result.value;
  }
  return result.message;
}

Before narrowing, code can safely use only members common to every union alternative. Checking state lets TypeScript identify which alternative is active. See the Handbook’s explanation of union types.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Interface extends and intersections behave differently on conflicts

A type alias can combine types with an intersection (&): the result must satisfy both component types. This is useful for composing reusable pieces, but it is not interchangeable with interface inheritance when the same property is declared incompatibly.

interface HasId {
  id: string;
}

interface HasNumericId {
  id: number;
}

interface Invalid extends HasId, HasNumericId {} // Error

type Both = HasId & HasNumericId;
// Both.id must satisfy string and number, so its type is never.

The incompatible inherited property makes the interface declaration an error. With the intersection, the property must satisfy both declarations; because a value cannot be both a string and a number, the resulting property type is never. Check for property collisions when composing aliases with &. The Handbook describes intersection types alongside interface extension.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Interfaces can merge; type aliases cannot be reopened

Two interface declarations with the same name can merge into one interface, provided their members are compatible:

interface Settings {
  theme: string;
}

interface Settings {
  compact: boolean;
}

// The merged Settings has both theme and compact.

Non-function members must have unique names, unless repeated declarations use the same type; incompatible repeated members produce an error. A same-named type alias does not offer this reopening mechanism. Declaration merging can be useful for intentional augmentation, including in ambient declarations, but it also means another declaration in scope can alter the final interface shape. See the Handbook’s rules for merging interfaces.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quick choice guide

Need Choose Why
A named object shape intended for extension interface Supports extends and declaration merging.
A union of alternatives, such as a result or state type A type alias can name a union; an interface cannot directly represent one.
A tuple or another type expression beyond an object interface type Aliases can name tuples, primitives, unions, and other type expressions.
Add members while expressing an inheritance relationship interface extends Incompatible inherited properties are reported as errors.
Combine reusable types as an intersection type A = B & C Combines requirements, but conflicting properties can become never.
Provide an intentional augmentation point interface Same-name declarations can merge when compatible.
Describe an equivalent, closed object shape in a project with an established style Follow the project For this case, the choice is a convention rather than a universal capability requirement.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.