@baseline-types/dom-newly-available - DOM types for Baseline Newly available
This package contains the DOM types for the web APIs that are currently
Baseline Newly available. Unlike the per-year
@baseline-types/dom-<year> packages, it is not frozen to a fixed year — it
tracks the latest Baseline state and moves forward as more APIs reach
Newly available. It is a drop-in replacement for @types/web / the built-in dom
library that lets you pin your project to the newly available web platform surface
instead of always tracking the latest specs.
The types are generated from
the same spec data (@webref/idl + @mdn/browser-compat-data) as @types/web,
then cut down with compute-baseline
to the Baseline Newly available set. The cut is referentially closed, so the output is a
valid superset of the strict "Baseline Newly available" set (an API that depends on a
type which is not yet newly available keeps that type).
Installation
With TypeScript 4.5+ using lib replacement, swap the built-in DOM lib for this package:
npm install @typescript/lib-dom@npm:@baseline-types/dom-newly-available --save-dev
pnpm add @typescript/lib-dom@npm:@baseline-types/dom-newly-available --save-dev
yarn add @typescript/lib-dom@npm:@baseline-types/dom-newly-available --dev
If you are using TypeScript 6.0+, set libReplacement
to true in your tsconfig.json.
That's all — your project now sees only the DOM APIs that are Baseline Newly available.
TypeScript 4.4 and below
To use this package without lib replacement you need to do two things:
Install the dependency:
npm install @baseline-types/dom-newly-available --save-dev.Update your
tsconfig.json. There are two cases depending on whether you havelibdefined.- Without "lib" - Add
"lib": []plus the entry matching your"target"(e.g."lib": ["es2017"]for"target": "es2017"). - With "lib" - Remove
"dom".
- Without "lib" - Add
Removing "dom" lets this package provide the global declarations instead.
What "Baseline Newly available" means here
- An API is included if its Baseline status is Newly available as of the underlying
browser-compat-data snapshot. "Newly available" means every core browser has
shipped it (
baseline_low_date); "Widely available" additionally means ~30 months have passed since then (baseline_high_date). - The cut moves over time: each data refresh can promote more APIs into this set (and, for the newly-available cut, some of those APIs later also appear in the widely-available cut).
- A few references that can't be satisfied in a given scope (e.g. an enum whose
only interface was cut) are degraded to
any. - When unsure whether an API has Baseline data at all (e.g.
WebAssembly), it is kept rather than dropped.
SemVer
This project does not respect semantic versioning — the underlying spec data and
Baseline computation change over time, and any update could add or remove types.
The Baseline state in the package name is the stable axis. The version's patch
component is the release date (1.0.YYYYMMDD, e.g. 1.0.20260707), so the
version simply records the day each data refresh was cut.
Deploy Metadata
You can read what changed in version 1.0.20260718 at https://github.com/uhyo/TypeScript-Baseline-Types/releases/tag/%40baseline-types%2Fdom-newly-available%401.0.20260718.