Skip to content

Commit 2d65ff4

Browse files
committed
typed options for fetch
Signed-off-by: karthik Ganeshram <[email protected]>
1 parent 6af1d00 commit 2d65ff4

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

crates/spin-js-engine/src/js_sdk/modules/spinSdk.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ function fetch(uri: string, options?: FetchOptions) {
8989

9090
declare global {
9191
const spinSdk: SpinSDK
92-
function fetch(uri: string, options?: object) : Promise<FetchResult>
93-
92+
function fetch(uri: string, options?: FetchOptions) : Promise<FetchResult>
9493
}
9594

9695
/** @internal */

types/lib/modules/spinSdk.d.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ interface SpinSDK {
3030
srem: (address: string, key: string, values: Array<string>) => bigint;
3131
};
3232
}
33+
interface FetchOptions {
34+
method?: string;
35+
headers?: Record<string, string>;
36+
body?: ArrayBuffer;
37+
}
3338
interface FetchHeaders {
3439
entries: () => Iterator<[string, string]>;
3540
}
@@ -44,6 +49,6 @@ interface FetchResult {
4449
}
4550
declare global {
4651
const spinSdk: SpinSDK;
47-
function fetch(uri: string, options?: object): Promise<FetchResult>;
52+
function fetch(uri: string, options?: FetchOptions): Promise<FetchResult>;
4853
}
4954
export { HttpRequest, HttpResponse, HandleRequest };

0 commit comments

Comments
 (0)