Typescript 3.8 introduced type-only imports and exports.
import typeonly imports declarations to be used for type annotations and declarations. It always gets fully erased, so there’s no remnant of it at runtime. Similarly,export typeonly provides an export that can be used for type contexts, and is also erased from TypeScript’s output.
This can be helpful for edge-case problems, such as when isolatedModules is enabled and you are re-exporting types. Most of the time this provides no benefit.
However in the future, tools might become better at optimising [[performance]] and reliability around type definition analysis.
import type { SomeThing } from "./some-module.js"; export type { SomeThing };