Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(types): make RequestInit properties assignable #1446

Merged
merged 1 commit into from May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions test/types/fetch.test-d.ts
Expand Up @@ -29,6 +29,9 @@ const responseInit: ResponseInit = { status: 200, statusText: 'OK' }
const requestInit2: RequestInit = {
dispatcher: new Agent()
}
const requestInit3: RequestInit = {}
// Test assignment. See https://github.com/whatwg/fetch/issues/1445
requestInit3.credentials = 'include'

declare const request: Request
declare const headers: Headers
Expand Down
26 changes: 13 additions & 13 deletions types/fetch.d.ts
Expand Up @@ -101,19 +101,19 @@ type RequestDestination =
| 'xslt'

export interface RequestInit {
readonly method?: string
readonly keepalive?: boolean
readonly headers?: HeadersInit
readonly body?: BodyInit
readonly redirect?: RequestRedirect
readonly integrity?: string
readonly signal?: AbortSignal
readonly credentials?: RequestCredentials
readonly mode?: RequestMode
readonly referrer?: string
readonly referrerPolicy?: ReferrerPolicy
readonly window?: null
readonly dispatcher?: Dispatcher
method?: string
keepalive?: boolean
headers?: HeadersInit
body?: BodyInit
redirect?: RequestRedirect
integrity?: string
signal?: AbortSignal
credentials?: RequestCredentials
mode?: RequestMode
referrer?: string
referrerPolicy?: ReferrerPolicy
window?: null
dispatcher?: Dispatcher
}

export type ReferrerPolicy =
Expand Down