Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
"prettier": "^3.3.3",
"remark-parse": "^11.0.0",
"remark-stringify": "^11.0.0",
"tsd": "^0.31.1",
"typescript": "^5.5",
"tsd": "^0.33.0",
"typescript": "^5.9.0",
"unified": "^11.0.5"
},
"dependencies": {
Expand All @@ -64,5 +64,13 @@
"esbuild": "^0.25.0",
"magic-string": "^0.30.12",
"regexpu-core": "^6.1.1"
},
"peerDependencies": {
"typescript": "^5.9.0"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
}
}
2 changes: 1 addition & 1 deletion test-d/experimental.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from 'fastly:experimental';
import { expectType } from 'tsd';

expectType<(path: string) => Uint8Array>(includeBytes);
expectType<(path: string) => Uint8Array<ArrayBuffer>>(includeBytes);
expectType<(enabled: boolean) => void>(enableDebugLogging);
expectType<(base: URL | null | undefined) => void>(setBaseURL);
expectType<(backend: string) => void>(setDefaultBackend);
Expand Down
15 changes: 8 additions & 7 deletions test-d/globals.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,8 @@ import { expectError, expectType } from 'tsd';
expectType<URLSearchParams>(
new URLSearchParams({
[Symbol.iterator]: function* () {
yield '';
yield ['', ''];
return;
},
}),
);
Expand Down Expand Up @@ -458,7 +459,7 @@ import { expectError, expectType } from 'tsd';
expectError(new TextEncoder(''));
const encoder = new TextEncoder();
expectType<TextEncoder>(encoder);
expectType<(input?: string) => Uint8Array>(encoder.encode);
expectType<(input?: string) => Uint8Array<ArrayBuffer>>(encoder.encode);
expectType<'utf-8'>(encoder.encoding);
expectError((encoder.encoding = 'd'));
}
Expand All @@ -484,7 +485,7 @@ import { expectError, expectType } from 'tsd';
expectType<(address: string) => Geolocation>(
fastly.getGeolocationForIpAddress,
);
expectType<(path: string) => Uint8Array>(fastly.includeBytes);
expectType<(path: string) => Uint8Array<ArrayBuffer>>(fastly.includeBytes);
}

// CompressionStream
Expand All @@ -494,9 +495,9 @@ import { expectError, expectType } from 'tsd';
let stream = new CompressionStream('deflate');
stream = new CompressionStream('deflate-raw');
stream = new CompressionStream('gzip');
expectType<ReadableStream<Uint8Array>>(stream.readable);
expectType<ReadableStream<Uint8Array<ArrayBuffer>>>(stream.readable);
expectError((stream.readable = 'd'));
expectType<WritableStream<Uint8Array>>(stream.writable);
expectType<WritableStream<Uint8Array<ArrayBuffer>>>(stream.writable);
expectError((stream.writable = 'd'));
}

Expand All @@ -507,8 +508,8 @@ import { expectError, expectType } from 'tsd';
let stream = new DecompressionStream('deflate');
stream = new DecompressionStream('deflate-raw');
stream = new DecompressionStream('gzip');
expectType<ReadableStream<Uint8Array>>(stream.readable);
expectType<ReadableStream<Uint8Array<ArrayBuffer>>>(stream.readable);
expectError((stream.readable = 'd'));
expectType<WritableStream<Uint8Array>>(stream.writable);
expectType<WritableStream<Uint8Array<ArrayBuffer>>>(stream.writable);
expectError((stream.writable = 'd'));
}
4 changes: 2 additions & 2 deletions types/cache-override.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ declare module 'fastly:cache-override' {
* to return the new body.
*/
bodyTransformFn?: (
body: Uint8Array,
) => Uint8Array | PromiseLike<Uint8Array>;
body: Uint8Array<ArrayBuffer>,
) => Uint8Array<ArrayBuffer> | PromiseLike<Uint8Array<ArrayBuffer>>;
}
/**
* The cache override mode for a request
Expand Down
2 changes: 1 addition & 1 deletion types/experimental.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ declare module 'fastly:experimental' {
* **Note**: Can only be used during build-time initialization, not when processing requests.
* @experimental
*/
export function includeBytes(path: string): Uint8Array;
export function includeBytes(path: string): Uint8Array<ArrayBuffer>;

/**
* Whether or not to allow Dynamic Backends.
Expand Down
16 changes: 8 additions & 8 deletions types/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ declare class TextEncoder {
* UTF-8 encodes the `input` string and returns a `Uint8Array` containing the encoded bytes.
* @param [input='an empty string'] The text to encode.
*/
encode(input?: string): Uint8Array;
encode(input?: string): Uint8Array<ArrayBuffer>;
// /**
// * UTF-8 encodes the `src` string to the `dest` Uint8Array and returns an object
// * containing the read Unicode code units and written UTF-8 bytes.
Expand Down Expand Up @@ -998,7 +998,7 @@ declare interface Fastly {
* @hidden
* @experimental
*/
includeBytes(path: string): Uint8Array;
includeBytes(path: string): Uint8Array<ArrayBuffer>;
}

/**
Expand Down Expand Up @@ -1055,15 +1055,15 @@ declare class CompressionStream {
* console.log(stream.readable instanceof ReadableStream); // true
* ```
*/
readonly readable: ReadableStream<Uint8Array>;
readonly readable: ReadableStream<Uint8Array<ArrayBuffer>>;
/**
* @example
* ```js
* let stream = new CompressionStream("gzip");
* console.log(stream.writable instanceof WritableStream); // true
* ```
*/
readonly writable: WritableStream<Uint8Array>;
readonly writable: WritableStream<Uint8Array<ArrayBuffer>>;
}

/**
Expand Down Expand Up @@ -1110,15 +1110,15 @@ declare class DecompressionStream {
* console.log(stream.readable instanceof ReadableStream); // true
* ```
*/
readonly readable: ReadableStream<Uint8Array>;
readonly readable: ReadableStream<Uint8Array<ArrayBuffer>>;
/**
* @example
* ```js
* let stream = new DecompressionStream("gzip");
* console.log(stream.writable instanceof WritableStream); // true
* ```
*/
readonly writable: WritableStream<Uint8Array>;
readonly writable: WritableStream<Uint8Array<ArrayBuffer>>;
}

// Note: the contents below here are, partially modified, copies of content from TypeScript's
Expand Down Expand Up @@ -1175,7 +1175,7 @@ interface Blob {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
slice(start?: number, end?: number, contentType?: string): Blob;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream) */
stream(): ReadableStream<Uint8Array>;
stream(): ReadableStream<Uint8Array<ArrayBuffer>>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
text(): Promise<string>;
}
Expand Down Expand Up @@ -1265,7 +1265,7 @@ declare type XMLHttpRequestBodyInit =
* @group Fetch API
*/
declare interface Body {
readonly body: ReadableStream<Uint8Array> | null;
readonly body: ReadableStream<Uint8Array<ArrayBuffer>> | null;
readonly bodyUsed: boolean;
arrayBuffer(): Promise<ArrayBuffer>;
blob(): Promise<Blob>;
Expand Down
2 changes: 1 addition & 1 deletion types/secret-store.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ declare module 'fastly:secret-store' {
* always avoid using this method when possible, instead passing
* the secret directly.
*/
rawBytes(): Uint8Array;
rawBytes(): Uint8Array<ArrayBuffer>;
}
}
Loading