TypeScript types for the OpenWorkers runtime
npm install @openworkers/workers-typesTypeScript types for the OpenWorkers runtime.
``bash`
bun add -d @openworkers/workers-types
Add to your tsconfig.json:
`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:
`json`
{
"compilerOptions": {
// no "types" array - all @types/* are included
}
}
For per-file control:
`typescript`
///
///
///
- 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
-