> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript Type Export

TypeScript type export is the module system mechanism used to expose static type declarations—such as interfaces, type aliases, and type signatures—from a file, allowing them to be imported and consumed by other modules. Because TypeScript utilizes type erasure, these exported constructs exist exclusively at compile-time and are entirely stripped from the emitted JavaScript code.

## Inline Type Exports

Types and interfaces can be exported directly at the point of declaration using the `export` keyword.

```typescript theme={"dark"}
export type UUID = string;

export interface Entity {
  id: UUID;
  createdAt: Date;
}
```

## Default Exports

TypeScript supports default exports for types, but enforces a strict syntactic distinction between interfaces and type aliases. While interfaces can be exported as defaults inline, type aliases cannot and will result in a syntax error. They must be split into a declaration and a subsequent export statement.

```typescript theme={"dark"}
// Valid: Inline default export for an interface
export default interface Config {
  retries: number;
}

// Syntax Error: Cannot use inline default export for a type alias
// export default type Status = 'pending' | 'resolved';

// Valid: Split declaration and default export for a type alias
type Status = 'pending' | 'resolved';
export default Status;
```

## Export Blocks

Types can be declared locally within a module and exported collectively at the end of the file.

```typescript theme={"dark"}
type Status = 'pending' | 'resolved';
interface Task {
  status: Status;
}

export { Status, Task };
```

## Type-Only Exports (`export type`)

TypeScript provides the `export type` modifier to explicitly denote that the exported members are strictly compile-time types. This guarantees to the compiler and external transpilers (like Babel, SWC, or esbuild) that the export contains no runtime values.

```typescript theme={"dark"}
interface Entity {
  id: string;
}

interface Task {
  title: string;
}

// Exports all members as types
export type { Entity, Task };
```

As of TypeScript 4.5, you can mix value and type exports within a single export block using inline `type` modifiers.

```typescript theme={"dark"}
interface Task {
  title: string;
  status: string;
}

const defaultTask: Task = { title: 'New Task', status: 'pending' };

// 'defaultTask' is a runtime value, 'Task' is a compile-time type
export { defaultTask, type Task };
```

## Re-exporting Types

Modules can re-export types originating from other modules. TypeScript provides specific syntax to differentiate between re-exporting values, types, or both.

```typescript theme={"dark"}
// Re-exporting specific types
export type { UUID, Entity } from './entity';

// Re-exports BOTH values and types from a module
export * from './task';

// Re-exports ONLY types from a module (TypeScript 5.0+)
export type * from './task';

// Re-exporting with inline type modifiers
export { defaultTask, type Task } from './task';
```

## Compiler Mechanics and Flags

The behavior of type exports is heavily influenced by TypeScript compiler options, specifically regarding single-file transpilation:

* **Type Erasure:** During the emit phase, `tsc` removes all type declarations and type-only exports. If a module only exports types, the entire `export` statement is omitted from the resulting `.js` file.
* **`isolatedModules`:** When enabled, transpilers operate on a single file at a time without cross-file type-checker context. Local type exports (e.g., `type T = string; export { T };`) are valid because the transpiler can infer the type from the local declaration. However, **re-exports** (e.g., `export { T } from './module';`) are ambiguous because the transpiler cannot inspect the external file to determine if `T` is a value or a type. Explicit `export type` modifiers are required for these re-exports to ensure the transpiler safely erases them.
* **`verbatimModuleSyntax`:** When enabled in `tsconfig.json`, TypeScript enforces strict adherence to explicit type modifiers. Any export that is only used as a type must be exported using `export type`, ensuring predictable and safe module emit across all build tools.

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor TypeScript Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
