Skip to content

Commit 84303d6

Browse files
authored
Merge pull request #93
Add support to TS v6
2 parents 82f1443 + bde9ff7 commit 84303d6

11 files changed

Lines changed: 615 additions & 733 deletions

File tree

.github/workflows/tests.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- uses: actions/setup-node@v6
2424
with:
2525
node-version: ${{ matrix.node-version }}
26-
- run: npm ci
26+
- run: npm ci --legacy-peer-deps
2727
- run: npm run test-node
2828

2929
test-browsers:
@@ -35,7 +35,7 @@ jobs:
3535
- uses: actions/checkout@v6
3636
- uses: actions/setup-node@v6
3737
- name: Install dependencies
38-
run: npm ci
38+
run: npm ci --legacy-peer-deps
3939

4040
- name: Install Chrome
4141
run: npx playwright install --with-deps chromium
@@ -52,9 +52,9 @@ jobs:
5252
steps:
5353
- uses: actions/checkout@v6
5454
- uses: actions/setup-node@v6
55-
- run: npm ci
55+
- run: npm ci --legacy-peer-deps
5656
- run: npm run test-type-definitions
57-
- run: npm i typescript@4.7 @types/node@18.0.0
57+
- run: npm i typescript@4.7 @types/node@18.0.0 --legacy-peer-deps
5858
- run: npm run test-type-definitions-legacy
5959

6060
lint:
@@ -66,5 +66,5 @@ jobs:
6666
steps:
6767
- uses: actions/checkout@v6
6868
- uses: actions/setup-node@v6
69-
- run: npm ci
69+
- run: npm ci --legacy-peer-deps
7070
- run: npm run lint

lib/types/dom.d.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ export namespace DOM {
5858
*/
5959
getWriter(): WritableStreamDefaultWriter<W>;
6060
}
61+
interface ReadableStreamBYOBReaderReadOptions {
62+
min?: number;
63+
}
6164
/**
6265
* The `ReadableStream` interface of the Streams API represents a readable stream of byte data.
6366
*
@@ -126,7 +129,12 @@ export namespace DOM {
126129
*
127130
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read)
128131
*/
129-
read<T extends ArrayBufferView>(view: T): Promise<globalThis.ReadableStreamReadResult<T>>;
132+
read<T extends Exclude<BufferSource, ArrayBuffer>>(
133+
view: T,
134+
// `options` are included in TS v6 definitions but not in v5; to keep the types common
135+
// we redeclare `ReadableStreamBYOBReaderReadOptions`
136+
options?: ReadableStreamBYOBReaderReadOptions
137+
): Promise<globalThis.ReadableStreamReadResult<T>>;
130138
/**
131139
* The **`releaseLock()`** method of the ReadableStreamBYOBReader interface releases the reader's lock on the stream.
132140
*

0 commit comments

Comments
 (0)