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 d897dc8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
20 changes: 9 additions & 11 deletions test/types/fetch.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,21 @@ 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<BodyInit | undefined>(requestInit4.body)
expectType<RequestCache | undefined>(requestInit.cache)
expectType<RequestCredentials | undefined>(requestInit.credentials)
expectType<Dispatcher | undefined>(requestInit2.dispatcher)
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)

expectType<BodyInit | undefined>(requestInit4.body)

expectType<number | undefined>(responseInit.status)
expectType<string | undefined>(responseInit.statusText)
expectType<HeadersInit | undefined>(responseInit.headers)
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 d897dc8

Please sign in to comment.