@openworkers/workers-types
v0.1.6
Published
TypeScript types for the OpenWorkers runtime
Readme
@openworkers/workers-types
TypeScript types for the OpenWorkers runtime.
Installation
bun add -d @openworkers/workers-typesUsage
Exclusive mode (recommended)
Add 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.
Compatible mode
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
}
}Triple-slash directive
For per-file control:
/// <reference no-default-lib="true" />
/// <reference lib="esnext" />
/// <reference types="@openworkers/workers-types" />Structure
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
