TypeScript `Type-Only` Namespaces and `export type *` in 2026: What the New Re-Export Syntax Unlocks
Learn how export type *, type-only namespaces, and verbatimModuleSyntax work together to produce clean, tree-shakeable TypeScript module boundaries in 2026.
export type * lets a barrel file re-export every type from a module without emitting a single JavaScript statement. The bundler sees no import, the runtime sees no module load, and consumers get full type information. TypeScript 5.0 introduced both export type * and export type * as Namespace (TypeScript 5.0 release notes), and together with verbatimModuleSyntax they close the last ambiguous gap around type-only re-exports.
The problem that bites teams is subtler: a barrel index.ts that uses plain export { SomeType } from "./models" looks innocent. TypeScript erases the type at emit, but only when it has full project knowledge. Single-file transpilers like esbuild, SWC, and the Node.js type-stripping mode introduced in Node 23.6 do not have that cross-file view. They see a named export and assume it might be a value, so the import survives into the JavaScript output, pulling in the entire source module at runtime.

Marking re-exports explicitly with export type * removes the ambiguity entirely. The type modifier is a compile-time contract that tells every tool in the chain: nothing here survives to JavaScript.

Key Takeaways
export type *andexport type * as Namespacewere added in TypeScript 5.0 and produce zero JavaScript output.- Single-file transpilers cannot infer whether a plain re-export is a type or a value;
export type *removes that guesswork. verbatimModuleSyntax(TypeScript 5.0+) enforces that every import and re-export carries an explicittypemodifier when it only refers to types, making the problem a compiler error rather than a silent runtime surprise.- Type-only namespaces created with
export type * as Namespaceare non-instantiated: they have no JavaScript representation and cannot be used as values. - Monorepos and published libraries benefit the most, because barrel indexes can expose a typed public API surface without dragging value modules into consumer bundles.
The Three Forms: import type, export type, and export type *
TypeScript's type-only syntax comes in three escalating forms, each solving a narrower scope of the erasure problem.
import type was the first form, introduced in TypeScript 3.8. It marks an entire import statement as type-only, so the compiler and every downstream transpiler can erase it unconditionally. The inline type modifier on a named specifier (import { type Foo }) followed shortly and handles the case where you need both a value and a type from the same module in one statement. The export type statement at the re-export level completes the picture by letting a file declare that a name it re-exports carries only type meaning.

The critical property shared by all three forms is stated plainly in the TypeScript 3.8 release notes: import type "always gets fully erased, so there's no remnant of it at runtime. Similarly, export type only provides an export that can be used for type contexts, and is also erased from TypeScript's output." export type * extends this guarantee to the wildcard form, letting a barrel file re-export every public type from a module in one line without emitting anything.
What export type * Actually Emits (and What Gets Erased)
The emit output is the clearest way to understand the guarantee. Consider a models file and a barrel that re-exports from it.
// models/user.ts
export interface User {
id: string;
name: string;
role: "admin" | "viewer";
}
export type UserId = User["id"];
export function createUser(name: string): User {
return { id: crypto.randomUUID(), name, role: "viewer" };
}// models/index.ts
export type * from "./user"; // re-exports User and UserId, NOT createUser
export { createUser } from "./user"; // createUser is a value; plain export is correctAfter tsc emits JavaScript, models/index.js contains only:
export { createUser } from "./user";The export type * line is completely absent. The types User and UserId are available to TypeScript consumers, but they have no JavaScript representation. The function createUser survives because it is a value. A single-file transpiler following the same rule sees export type * and erases it immediately, with no need to look at ./user to decide.
One subtlety worth knowing: export type * does not re-export the default export of a module, the same way export * does not. If you need the default, you need an explicit export type { default as Foo } or a named alias.
Type-Only Namespaces: Instantiated vs Non-Instantiated
A namespace in TypeScript is either instantiated or non-instantiated, and that distinction controls whether JavaScript is emitted for it.
An instantiated namespace contains at least one value: a variable, function, class, or enum. TypeScript emits an IIFE (or a module-level object in modern targets) to represent it at runtime. A non-instantiated namespace contains only types and interfaces, so TypeScript emits nothing for it. The TypeScript erasableSyntaxOnly tsconfig flag (tsconfig reference) makes instantiated namespaces with runtime code a compiler error, which matters for environments like Node.js 23.6+ that strip types directly.

export type * as Namespace creates something that behaves like a non-instantiated namespace: it groups types under a named reference, but that reference can only appear in type positions. As the TypeScript 5.0 release notes demonstrate, using vehicles from an export type * as vehicles as a value raises a compiler error: 'vehicles' cannot be used as a value because it was exported using 'export type'. This is fundamentally different from export * as ns, which creates a real JavaScript object at runtime containing all the module's exported values.
Building a Barrel Index With export type * and export type * as Namespace

The most practical use of export type * is a clean barrel file that separates the public type surface from the public value surface. The pattern below shows a design system package organizing its API this way.
// packages/design-system/src/types/theme.ts
export interface Theme {
colors: Record<string, string>;
spacing: Record<string, number>;
fontSizes: Record<string, string>;
}
export type ThemeMode = "light" | "dark";
export type ThemeScale = keyof Theme["spacing"];// packages/design-system/src/types/component.ts
export interface ComponentProps {
className?: string;
testId?: string;
}
export type Size = "sm" | "md" | "lg";
export type Variant = "primary" | "secondary" | "ghost";// packages/design-system/src/index.ts
// All types grouped under a "Types" namespace for consumers
export type * as Types from "./types/theme";
export type * as ComponentTypes from "./types/component";
// Convenience flat re-exports for the most common types
export type { Theme, ThemeMode } from "./types/theme";
export type { Size, Variant } from "./types/component";
// Values export normally
export { createTheme } from "./theme/createTheme";
export { Button } from "./components/Button";A consumer that only needs types pays nothing at runtime:
// app/checkout.ts
import type { Types } from "@acme/design-system";
function applyTheme(theme: Types.Theme): void {
// theme is fully typed; zero runtime import of the design-system types
}A consumer that needs values imports them separately and tree-shaking eliminates the rest:
// app/ui.tsx
import { Button } from "@acme/design-system";
import type { Size, Variant } from "@acme/design-system";
export function PrimaryButton({ size }: { size: Size }) {
return <Button size={size} variant="primary" />;
}The barrel index acts as a contract: types live under export type *, values live under plain export. Any reviewer can audit the index file and immediately understand which exports have runtime weight.
For utilities that relate to building type-safe APIs like this, TypeScript utility types offer complementary patterns worth combining with this barrel structure.
verbatimModuleSyntax and isolatedModules: How They Force Honest Re-Exports
verbatimModuleSyntax and isolatedModules both push teams toward explicit type markers, but they do it at different enforcement levels and with different tradeoffs.
| Feature | verbatimModuleSyntax | isolatedModules |
|---|---|---|
| Introduced | TypeScript 5.0 | TypeScript 1.5 (approx.) |
| Enforcement | Compiler error on ambiguous imports/exports | Compiler error only on patterns that break single-file transpilation |
| Import elision | Disabled: what you write is what you get | Allowed; TypeScript still elides |
| Deprecates | importsNotUsedAsValues, preserveValueImports | Nothing |
export type * required? | Yes, for type-only wildcard re-exports | Effectively yes, for the same reason |
| Recommended for | New projects, Node type-stripping, esbuild/SWC pipelines | Legacy projects moving toward explicit markers |

verbatimModuleSyntax is the flag to reach for in new projects. Its rule is exactly one sentence from the TypeScript 5.0 docs: "any imports or exports without a type modifier are left around. Anything that uses the type modifier is dropped entirely." There is no inference, no cross-file analysis, no edge cases. The old flags --importsNotUsedAsValues and --preserveValueImports are deprecated in its favor.
A tsconfig for a modern library or monorepo package looks like this:
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"verbatimModuleSyntax": true,
"strict": true,
"declaration": true,
"declarationMap": true,
"outDir": "./dist"
}
}With verbatimModuleSyntax active, writing export { User } from "./models" when User is an interface raises an error at compile time: TypeScript cannot silently decide whether to erase it. The fix is export type { User } or, for the whole module, export type * from "./models".
Real Patterns: Library Public API Surfaces and Monorepo Type Boundaries

The pattern that benefits most from export type * is a monorepo where one package owns a schema and several other packages consume it without taking a runtime dependency.
Consider a monorepo with three packages: @acme/schema (types only), @acme/api (server), and @acme/client (browser bundle). The schema package contains no runtime code at all.

// packages/schema/src/order.ts
export interface Order {
id: string;
items: OrderItem[];
total: number;
status: "pending" | "fulfilled" | "cancelled";
}
export interface OrderItem {
productId: string;
quantity: number;
unitPrice: number;
}
export type OrderStatus = Order["status"];// packages/schema/src/index.ts
export type * from "./order";
export type * from "./user";
export type * from "./product";// packages/api/src/orderController.ts
import type { Order, OrderStatus } from "@acme/schema";
import { db } from "./db";
export async function getOrder(id: string): Promise<Order> {
return db.orders.findById(id);
}
export async function updateStatus(id: string, status: OrderStatus): Promise<void> {
await db.orders.updateStatus(id, status);
}// packages/client/src/OrderList.tsx
import type { Order } from "@acme/schema";
import { useQuery } from "@tanstack/react-query";
interface Props {
orders: Order[];
}
export function OrderList({ orders }: Props) {
return (
<ul>
{orders.map((o) => (
<li key={o.id}>{o.status}</li>
))}
</ul>
);
}The @acme/schema package's dist folder, after tsc, contains only .d.ts declaration files. No .js files are emitted for the type-only barrel. The api and client packages reference the types through import type, which any bundler or runtime will erase. The schema package never appears in a production bundle.
This pattern also integrates cleanly with AI-assisted refactoring workflows. When types are isolated in a schema package with clean export type * boundaries, automated tools can safely rename or restructure types without touching value code. AI-powered TypeScript refactoring workflows covers exactly that scenario. For teams working in environments with very large context windows, the implications for real web apps are worth reviewing alongside the type boundary work.
Frequently Asked Questions
Does export type * re-export the default export of a module?
No. export type * follows the same rule as export *: the default export is excluded. To re-export a default as a named type, use export type { default as MyType } from "./module" explicitly.
Can export type * as Namespace be used as a value at runtime?
No. A namespace created with export type * as Namespace is non-instantiated. TypeScript will error if you try to use it as a value: 'Namespace' cannot be used as a value because it was exported using 'export type'. It is strictly a type-level grouping.
Does verbatimModuleSyntax replace isolatedModules?
They address overlapping but distinct concerns. verbatimModuleSyntax enforces that every import and export carries an explicit type modifier when needed, with no silent elision. isolatedModules focuses on ensuring code is safe for single-file transpilation. For new projects, verbatimModuleSyntax is the recommended choice; the TypeScript 5.0 docs explicitly deprecate importsNotUsedAsValues and preserveValueImports in its favor.
Will export type * work in .js files with allowJs?
No. The type modifier on import and export statements is TypeScript-specific syntax. It is not valid JavaScript and will not appear in .js files. The pattern applies only to .ts and .tsx files.
Is there a performance difference between export type * and listing individual export type { A, B, C } names?
At the TypeScript level, both produce zero JavaScript output. The difference is maintenance: export type * automatically includes new types added to the source module, while individual specifiers require manual updates. For a stable, explicitly controlled public API surface, individual specifiers give more intentional control. For an internal schema package where all types should be public, export type * saves ongoing maintenance.
When export type * Is Enough and When You Still Need a Namespace
export type * handles the common case: a barrel file that surfaces all types from a module to consumers who import them as import type { Foo }. That covers most monorepo type boundary scenarios and most library .d.ts surfaces.
export type * as Namespace is the right choice when consumers benefit from a grouped namespace reference, particularly for large type surfaces where flat imports would produce name collisions or where the grouping communicates meaningful domain ownership. A design system exporting export type * as FormTypes from "./form" and export type * as TableTypes from "./table" lets consumers write FormTypes.FieldProps and TableTypes.ColumnDef without any flat-import collision risk.
The practical rule: use export type * by default in barrel files, and reach for export type * as Namespace when the grouping itself communicates something a flat list of names cannot. With verbatimModuleSyntax enforcing honest re-exports at compile time, the choice between the two forms becomes a question of API ergonomics rather than correctness.