@ariestools/lib-neutral
v8.7.26
Published
Ambient global types for the browser+node common runtime surface (WinterTC minimum common API subset)
Downloads
261
Readme
@ariestools/lib-neutral
Ambient global types for the browser+node common runtime surface — a curated subset of the WinterTC Minimum Common Web Platform API, typed with signatures valid in every environment.
Usage
In a neutral package's tsconfig.json:
{
"compilerOptions": {
"types": ["@ariestools/lib-neutral"]
}
}Setting types also disables automatic @types/* inclusion, so accidental
references to Node-only (process, Buffer) or browser-only (window,
document) globals become compile errors — the compiler is the first line of
defense for the package's neutrality claim; environment test matrices remain
the runtime proof.
Currently declared
setTimeout/clearTimeout/setInterval/clearInterval— with an opaque handle type (numberin browsers, an object in Node). Divine the concrete type where needed:type TimeoutHandle = ReturnType<typeof setTimeout>.AbortController/AbortSignal
Grow the surface only with APIs on the WinterTC common list, and only as packages actually need them.
