Skip to content

Commit 429303b

Browse files
committed
Raise TypeScript baseline to 5.9 and adopt generic Uint8Array types
1 parent abaab6a commit 429303b

File tree

6 files changed

+33
-17
lines changed

6 files changed

+33
-17
lines changed

package-lock.json

Lines changed: 12 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"remark-parse": "^11.0.0",
5353
"remark-stringify": "^11.0.0",
5454
"tsd": "^0.31.1",
55-
"typescript": "^5.5",
55+
"typescript": "^5.9.0",
5656
"unified": "^11.0.5"
5757
},
5858
"dependencies": {
@@ -64,5 +64,13 @@
6464
"esbuild": "^0.25.0",
6565
"magic-string": "^0.30.12",
6666
"regexpu-core": "^6.1.1"
67+
},
68+
"peerDependencies": {
69+
"typescript": "^5.9.0"
70+
},
71+
"peerDependenciesMeta": {
72+
"typescript": {
73+
"optional": true
74+
}
6775
}
6876
}

types/cache-override.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ declare module 'fastly:cache-override' {
3737
* to return the new body.
3838
*/
3939
bodyTransformFn?: (
40-
body: Uint8Array,
41-
) => Uint8Array | PromiseLike<Uint8Array>;
40+
body: Uint8Array<ArrayBuffer>,
41+
) => Uint8Array<ArrayBuffer> | PromiseLike<Uint8Array<ArrayBuffer>>;
4242
}
4343
/**
4444
* The cache override mode for a request

types/experimental.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ declare module 'fastly:experimental' {
4646
* **Note**: Can only be used during build-time initialization, not when processing requests.
4747
* @experimental
4848
*/
49-
export function includeBytes(path: string): Uint8Array;
49+
export function includeBytes(path: string): Uint8Array<ArrayBuffer>;
5050

5151
/**
5252
* Whether or not to allow Dynamic Backends.

types/globals.d.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ declare class TextEncoder {
843843
* UTF-8 encodes the `input` string and returns a `Uint8Array` containing the encoded bytes.
844844
* @param [input='an empty string'] The text to encode.
845845
*/
846-
encode(input?: string): Uint8Array;
846+
encode(input?: string): Uint8Array<ArrayBuffer>;
847847
// /**
848848
// * UTF-8 encodes the `src` string to the `dest` Uint8Array and returns an object
849849
// * containing the read Unicode code units and written UTF-8 bytes.
@@ -998,7 +998,7 @@ declare interface Fastly {
998998
* @hidden
999999
* @experimental
10001000
*/
1001-
includeBytes(path: string): Uint8Array;
1001+
includeBytes(path: string): Uint8Array<ArrayBuffer>;
10021002
}
10031003

10041004
/**
@@ -1055,15 +1055,15 @@ declare class CompressionStream {
10551055
* console.log(stream.readable instanceof ReadableStream); // true
10561056
* ```
10571057
*/
1058-
readonly readable: ReadableStream<Uint8Array>;
1058+
readonly readable: ReadableStream<Uint8Array<ArrayBuffer>>;
10591059
/**
10601060
* @example
10611061
* ```js
10621062
* let stream = new CompressionStream("gzip");
10631063
* console.log(stream.writable instanceof WritableStream); // true
10641064
* ```
10651065
*/
1066-
readonly writable: WritableStream<Uint8Array>;
1066+
readonly writable: WritableStream<Uint8Array<ArrayBuffer>>;
10671067
}
10681068

10691069
/**
@@ -1110,15 +1110,15 @@ declare class DecompressionStream {
11101110
* console.log(stream.readable instanceof ReadableStream); // true
11111111
* ```
11121112
*/
1113-
readonly readable: ReadableStream<Uint8Array>;
1113+
readonly readable: ReadableStream<Uint8Array<ArrayBuffer>>;
11141114
/**
11151115
* @example
11161116
* ```js
11171117
* let stream = new DecompressionStream("gzip");
11181118
* console.log(stream.writable instanceof WritableStream); // true
11191119
* ```
11201120
*/
1121-
readonly writable: WritableStream<Uint8Array>;
1121+
readonly writable: WritableStream<Uint8Array<ArrayBuffer>>;
11221122
}
11231123

11241124
// Note: the contents below here are, partially modified, copies of content from TypeScript's
@@ -1175,7 +1175,7 @@ interface Blob {
11751175
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
11761176
slice(start?: number, end?: number, contentType?: string): Blob;
11771177
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream) */
1178-
stream(): ReadableStream<Uint8Array>;
1178+
stream(): ReadableStream<Uint8Array<ArrayBuffer>>;
11791179
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
11801180
text(): Promise<string>;
11811181
}
@@ -1265,7 +1265,7 @@ declare type XMLHttpRequestBodyInit =
12651265
* @group Fetch API
12661266
*/
12671267
declare interface Body {
1268-
readonly body: ReadableStream<Uint8Array> | null;
1268+
readonly body: ReadableStream<Uint8Array<ArrayBuffer>> | null;
12691269
readonly bodyUsed: boolean;
12701270
arrayBuffer(): Promise<ArrayBuffer>;
12711271
blob(): Promise<Blob>;

types/secret-store.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ declare module 'fastly:secret-store' {
3939
* always avoid using this method when possible, instead passing
4040
* the secret directly.
4141
*/
42-
rawBytes(): Uint8Array;
42+
rawBytes(): Uint8Array<ArrayBuffer>;
4343
}
4444
}

0 commit comments

Comments
 (0)