Skip to main content

Runtime - Browser

Add the browser DOM type definitions and bundler module resolution that code shipped to the browser needs, layered on top of the Nova baseline and strict presets.

Why Use This Preset?

  1. Loads the DOM and DOM.Iterable libs so browser globals like document, window, and NodeList iteration type-check without manual wiring.
  2. Sets moduleResolution to Bundler so imports resolve the way a bundler resolves them rather than the way Node does.
  3. Uses ESNext modules so your bundler controls the final output format instead of TypeScript downleveling it.
  4. Drops in as the environment layer after the essentials and strict presets so you only declare where the code runs.

Usage

Add the preset as the last entry in 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-browser.json"
  ]
}

What This Preset Configures

The preset sets the following compilerOptions, overriding the matching values from the layers below it.

SettingValueDescription
libDOM, DOM.Iterable, ESNextLoads browser DOM globals, DOM iterable types, and the latest JavaScript types.
moduleESNextEmits modern ESM and leaves the final format to your bundler.
moduleResolutionBundlerResolves imports the way a bundler does, matched to the module setting.

info

The lib array replaces the parent value rather than merging with it, so this preset restates ESNext alongside the browser libs.