Skip to main content

Runtime - Cloudflare Workers

Configure TypeScript for the Cloudflare Workers edge runtime by pairing ESNext modules with bundler resolution while leaving the actual build to Wrangler.

Why Use This Preset?

  1. Sets ESNext modules with Bundler resolution so imports resolve the way Wrangler and esbuild expect.
  2. Enables isolatedModules so each file type-checks independently, matching how the bundler transpiles your Worker.
  3. Sets noEmit so TypeScript checks types only and lets Wrangler own the output, avoiding duplicate JavaScript on disk.
  4. Targets the ESNext library so you write against the latest language features the V8 isolate supports.
  5. Layers cleanly after dx-essentials and dx-strict, keeping runtime concerns separate from your strictness baseline.

Usage

Add the preset to the extends array of your tsconfig.json, after the essentials and strict layers.

tsconfig.json
json
{
  "extends": [
    "@cbnventures/nova/presets/tsconfig/dx-essentials.json",
    "@cbnventures/nova/presets/tsconfig/dx-strict.json",
    "@cbnventures/nova/presets/tsconfig/runtime-cloudflare-workers.json"
  ]
}

What This Preset Configures

This preset sets the following compilerOptions.

SettingValueDescription
isolatedModulestrueType-checks each file on its own so the bundler can transpile files in isolation.
lib["ESNext"]Exposes the latest ECMAScript APIs without bundling any DOM type definitions.
moduleESNextEmits modern ECMAScript module syntax for the bundler to consume.
moduleResolutionBundlerResolves imports the way a bundler does, matching the Wrangler build pipeline.
noEmittrueRuns type-checking only and leaves JavaScript output to Wrangler.

info

The lib array replaces the parent's value rather than merging with it, so this preset deliberately omits any DOM or WebWorker libraries that a Worker isolate does not provide.