TypeScript Syntax
import type — type-only imports
Imports a declaration for use in type positions without emitting a runtime import for that statement. It cannot be used as a runtime constructor or value. A separate value import is necessary when the dependency must execute or supply a runtime binding. Multi-file example: save each labeled file separately in one directory and compile the project. Observed output: '7'. 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
import type { T } from "./module";Working Example
Example Snippettypescript
// File: model.tsexport class Item { constructor(public id: number) {} }
// File: main.tsimport type { Item } from "./model";const item: Item = { id: 7 };console.log(item.id);