ecyrbe / zodios

typescript http client and server with zod validation
https://www.zodios.org/
MIT License
1.71k stars 46 forks source link

V11, How to add native fetch params? #330

Closed michael-land closed 1 year ago

michael-land commented 1 year ago
image
new Zodios(definitions, {
  fetchConfig: {
    credentials: 'include',
  } as any,
});

I have to cast to any to skip type error, Not sure if this is the recommend way to add native fetch parameters, looks like zodios just forward these props.

https://github.com/ecyrbe/zodios/blob/feature/v11/packages/fetch/src/fetch-provider/fetch.types.ts#L3-L9 https://github.com/ecyrbe/zodios/blob/feature/v11/packages/fetch/src/fetch-provider/fetcher-provider.fetch.ts#L35-L51

maybe we need to improve the FetchProviderConfig typing?

ecyrbe commented 1 year ago

I have no issue autocompleting, image

check your ts config file, and enabling "dom" lib should fix your issue :

{
  "compilerOptions": {
    "lib": ["ES2019", "DOM"],
     ...
  },
 ...
}