> ## 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 Named Export

A named export is an ECMAScript module syntax mechanism, fully supported and extended by TypeScript, that allows multiple specific declarations—such as variables, functions, classes, types, or interfaces—to be exposed from a module using their exact identifier names. Unlike default exports, a single module can contain an arbitrary number of named exports. Importing modules must reference these exact identifiers or explicitly alias them during the import phase.

## Inline Named Exports

The most common approach is prefixing the declaration directly with the `export` keyword. TypeScript allows this for both runtime values and compile-time types.

```typescript theme={"dark"}
export const MAX_RETRIES = 3;

export function initializeClient(): void { 
  // implementation
}

export interface ClientConfig {
  timeout: number;
}
```

## Export Clause and Aliasing

Identifiers can be declared first and exported later at the bottom of the module using an export clause. The `as` keyword allows you to rename the identifier as it is exposed to consumers.

```typescript theme={"dark"}
const internalState = { initialized: false };
function resetState(): void { 
  // implementation
}

export { internalState, resetState as clearState };
```

## TypeScript-Specific: Type-Only Exports

TypeScript introduces the `type` modifier for named exports. This explicitly instructs the TypeScript compiler that the exported identifier is a type or interface, ensuring it is completely erased during the JavaScript emit phase. This is critical when using compiler options like `isolatedModules` or `verbatimModuleSyntax`.

```typescript theme={"dark"}
interface User { 
  id: string; 
}
type UserRole = 'admin' | 'guest';

// Exporting strictly as types
export type { User, UserRole };
```

The `type` modifier can also be applied inline within a mixed export clause:

```typescript theme={"dark"}
export { internalState, type User, type UserRole };
```

## Re-exporting (Aggregation)

Named exports can be forwarded from one module to another without importing them into the current module's scope.

```typescript theme={"dark"}
// Re-export all named exports directly (excluding default exports)
export * from './client';

// Re-export specific named exports
export { MAX_RETRIES, type ClientConfig } from './client';

// Re-export a named export with an alias
export { initializeClient as init } from './client';

// Re-export all named exports from a module as a single named namespace
export * as ClientModule from './client';
```

## Importing Named Exports

To consume a named export, the importing module uses static import syntax. While it utilizes curly braces, this is not object destructuring; instead, it creates read-only live bindings to the exported variables rather than evaluating runtime value copies. The exact exported identifier must be referenced, optionally applying local aliases using the `as` keyword.

```typescript theme={"dark"}
import { 
  MAX_RETRIES, 
  clearState as reset, 
  type ClientConfig 
} from './module';
```

<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>
