June 2025posted on 06.04.2025TypeScript: Type-only imports and exports TypeScript can enforce explicit type imports and exports using the importsNotUsedAsValues configuration. { "compilerOptions": { "importsNotUsedAsValues": "error", } } Setting this to error will report an error if there is a type being imported without import type syntax. import type { MyType } from './types'; export type { MyType }; Bundlers prefer this to help avoid potiential problems with types being incorrectly bundled.No reactions yet
TypeScript: Type-only imports and exports
TypeScript can enforce explicit type imports and exports using the importsNotUsedAsValues configuration.
Setting this to
errorwill report an error if there is a type being imported withoutimport typesyntax.Bundlers prefer this to help avoid potiential problems with types being incorrectly bundled.