Skip to content

Commit

Permalink
fix(types): add missing cache prop to RequestInit
Browse files Browse the repository at this point in the history
  • Loading branch information
rindeal committed Sep 9, 2024
1 parent dca0aa0 commit 5664c8c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
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

0 comments on commit 5664c8c

Please sign in to comment.