Skip to content

Commit

Permalink
Improve fetch typing (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
penalosa authored and jasnell committed Dec 1, 2022
1 parent a99d365 commit ef7dbe2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/workerd/api/global-scope.h
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ class ServiceWorkerGlobalScope: public WorkerGlobalScope {

structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;

fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
fetch(input: RequestInfo, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;
});
}

Expand Down
6 changes: 3 additions & 3 deletions src/workerd/api/http.h
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ class Fetcher: public jsg::Object {
JSG_METHOD_NAMED(delete, delete_);

JSG_TS_OVERRIDE({
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
fetch(input: RequestInfo, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;
get: never;
put: never;
delete: never;
Expand Down Expand Up @@ -529,10 +529,10 @@ struct RequestInitializerDict {

JSG_STRUCT(method, headers, body, redirect, fetcher, cf, mode, credentials, cache,
referrer, referrerPolicy, integrity, signal, observe);
JSG_STRUCT_TS_OVERRIDE(RequestInit {
JSG_STRUCT_TS_OVERRIDE(RequestInit<CfType = IncomingRequestCfProperties | RequestInitCfProperties> {
headers?: HeadersInit;
body?: BodyInit | null;
cf?: IncomingRequestCfProperties | RequestInitCfProperties;
cf?: CfType;
});
};

Expand Down

0 comments on commit ef7dbe2

Please sign in to comment.