Menu

What remains without import type? Comparing tsc, esbuild, and side effects
📰

What remains without import type? Comparing tsc, esbuild, and side effects

DEV Community: esbuild·hiro@·about 13 hours ago
#HyXo2cnI
#devtoesbuild#devto#dev#type#import
Reading 0:00
15s threshold

Some configurations automatically erase an import used only as a type, even without import type . With verbatimModuleSyntax: true , however, the spelling also changed whether a module's side effect ran. Check type-checking success separately from runtime module evaluation.

In particular, these forms do not always emit the same JavaScript:

import type { Ticket } from "./registry.js"

import { type Ticket } from "./registry.js"

Put a visible marker in the imported module

The experiment ran on September 11, 2026, with macOS arm64, Node.js 24.15.0, TypeScript 7.0.2, and esbuild 0.28.2. Compiler options were strict: true , target: ES2022 , module: ESNext , and moduleResolution: Bundler . esbuild targeted Node ESM with bundling and tree shaking enabled. The test package did not declare sideEffects: false .

registry.ts contains only a type and a log showing that the module was evaluated. It performs no external requests or real application initialization.

export interface Ticket { title : string } console .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.