TypeScript types for the OpenWorkers runtime.
bun add -d @openworkers/workers-typesAdd to your tsconfig.json:
{
"compilerOptions": {
"types": ["@openworkers/workers-types"]
}
}This includes only OpenWorkers types and excludes conflicting types (like @types/node or @types/bun). Best for pure worker projects.
If you need to mix with Node.js or Bun types, just install the package without configuring types. The types will merge with existing globals:
{
"compilerOptions": {
// no "types" array - all @types/* are included
}
}For per-file control:
/// <reference no-default-lib="true" />
/// <reference lib="esnext" />
/// <reference types="@openworkers/workers-types" />types/globals.d.ts- globalThis, selftypes/fetch.d.ts- Request, Response, Headers, fetchtypes/url.d.ts- URL, URLSearchParamstypes/streams.d.ts- ReadableStream, WritableStreamtypes/crypto.d.ts- Web Crypto APItypes/encoding.d.ts- TextEncoder, TextDecoder, atob, btoatypes/console.d.ts- Console APItypes/timers.d.ts- setTimeout, setIntervaltypes/events.d.ts- Event, EventTargettypes/abort.d.ts- AbortController, AbortSignaltypes/blob.d.ts- Blob, File, FormDatatypes/workers.d.ts- ExecutionContext, ScheduledEvent, ExportedHandlertypes/bindings.d.ts- BindingAssets, BindingStorage, BindingKV, BindingDatabase, BindingWorker