Skip to content
New issue

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

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

Already on GitHub? # to your account

fix(types): add missing cache prop to RequestInit #3569

Merged
merged 1 commit into from
Oct 15, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions test/types/fetch.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,18 @@ declare const request: Request
declare const headers: Headers
declare const response: Response

expectType<string | undefined>(requestInit.method)
expectType<boolean | undefined>(requestInit.keepalive)
expectType<HeadersInit | undefined>(requestInit.headers)
expectType<BodyInit | undefined>(requestInit.body)
expectType<RequestRedirect | undefined>(requestInit.redirect)
expectType<string | undefined>(requestInit.integrity)
expectType<AbortSignal | null | undefined>(requestInit.signal)
expectType<RequestCache | undefined>(requestInit.cache)
expectType<RequestCredentials | undefined>(requestInit.credentials)
expectType<HeadersInit | undefined>(requestInit.headers)
expectType<string | undefined>(requestInit.integrity)
expectType<boolean | undefined>(requestInit.keepalive)
expectType<string | undefined>(requestInit.method)
expectType<RequestMode | undefined>(requestInit.mode)
expectType<RequestRedirect | undefined>(requestInit.redirect)
expectType<string | undefined>(requestInit.referrer)
expectType<ReferrerPolicy | undefined>(requestInit.referrerPolicy)
expectType<AbortSignal | null | undefined>(requestInit.signal)
expectType<null | undefined>(requestInit.window)

expectType<Dispatcher | undefined>(requestInit2.dispatcher)
Expand Down
17 changes: 9 additions & 8 deletions types/fetch.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,20 +119,21 @@ type RequestDestination =
| 'xslt'

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

export type ReferrerPolicy =
Expand Down
Loading