TypeScript Syntax
export type — type-only re-export
A type-only export publishes a name to TypeScript type consumers without creating a corresponding JavaScript export. Consumers needing a runtime value must import an actual value export. This is useful for explicit public declaration boundaries. Multi-file example: save each labeled file separately in one directory and compile the project. Observed output: '8'. Local verification: TypeScript 5.8.3, strict mode, ES2022, CommonJS, Node.js 22.16.0. Disposable library declarations are enabled for the fixture suite.
Formal Syntax & Structure
typescript syntaxtypescript
export type { T } from "./module";Working Example
Example Snippettypescript
// File: model.tsexport type Item = { id: number };
// File: api.tsexport type { Item } from "./model";
// File: main.tsimport type { Item } from "./api";const item: Item = { id: 8 };console.log(item.id);