Files
bun.sh/packages/bun-types
Ciro Spaciari 24d624b176 feat(Request.signal) Initial support for signal in Request + fetch and Request + Bun.serve (#2097)
* add fetch abort signal

* get aborted (still segfaults)

* bidings.zig u0 error

* still GC/memory error

* fix start crash

* fix AbortSignal fromJS

* change fromJS to obj.as

* addAbortSignalEventListenner

* handle abort types, and add tests

* fix tests

* add custom reason test

* merge 2 substring methods, use MAKE_STATIC_STRING_IMPL

* fix create AbortError and TimeoutError, move globalThis and exception creation to main thread

* fix tests and rebuild headers

* no need to check with substring reason is already an exception

* no need to check with substring reason is already an exception

* fix dumb error inverting conditions for check reason

* fix custom reason behavior

* Request signal

* remove package-lock.json

* Remove JSC.Strong from Request signal

* fix globals for fetch abort signal

* more tests, clone signal crashs

* fix AbortSignal.toJS

* fix toJS bidings for AbortSignal

* add streaming tests

* fix abortion before connecting

* fix tests and segfault

* add fetch testing abort after finish

* fix signal handler cleanup

* support signal event Bun.serve

* pull tests (failing)

* remove unsupported test

* formating

* fix server Request.signal, fix cleanNativeBindings

* add direct tests

* more pull tests

* fix stream tests

* fix fetch, pending onAborted fix in HTTPServerWritable

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-02-22 19:27:25 -08:00
..
2023-02-02 17:29:10 -08:00
2023-02-07 04:47:36 -08:00
2023-02-22 17:45:22 -08:00
2022-12-06 18:48:02 -08:00
2023-02-06 21:36:36 -08:00
2023-01-11 14:56:41 -08:00
2023-01-09 08:25:39 -08:00
2023-02-22 17:45:22 -08:00
2023-02-17 22:07:02 -08:00
2023-01-11 14:56:41 -08:00
2023-01-11 14:56:41 -08:00
2023-02-06 21:36:36 -08:00
2022-12-31 23:03:45 -08:00
2023-01-11 14:56:41 -08:00
2022-12-13 20:47:51 -08:00
2023-01-16 11:58:57 -08:00
2023-02-02 17:29:10 -08:00
2023-02-22 17:45:22 -08:00
2023-01-11 14:56:41 -08:00
2023-02-06 21:36:36 -08:00
2023-01-11 14:56:41 -08:00
2023-02-06 21:36:36 -08:00
2023-01-11 14:56:41 -08:00

Bun TypeScript type definitions

Logo

These are the type definitions for Bun's JavaScript runtime APIs.

Installation

Install the bun-types npm package:

# yarn/npm/pnpm work too, "bun-types" is an ordinary npm package
bun add bun-types

Usage

Add this to your tsconfig.json or jsconfig.json:

{
  "compilerOptions": {
    "lib": ["ESNext"],
    "module": "ESNext",
    "target": "ESNext",
    "moduleResolution": "Node",
    // "bun-types" is the important part
    "types": ["bun-types"]
  }
}

Contributing

bun-types is generated via ./bundle.ts.

Adding a new file

  1. Add it to ./index.d.ts

How to generate types.d.ts

./bundle.ts merges the types in this folder into a single file.

To run it:

bun build

Generated docs

📚 See here for docs