Skip to content

Commit

Permalink
🎨 Relaxed Response & Options types
Browse files Browse the repository at this point in the history
  • Loading branch information
elbywan committed Mar 7, 2018
1 parent 171ac48 commit 16c0b97
Show file tree
Hide file tree
Showing 21 changed files with 61 additions and 43 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -625,7 +625,7 @@ wretch("...").opts({ credentials: "same-origin" })
|-----|-----|-----|-----|-----|-----|-----|
```ts
type WretcherError = Error & { status: number, response: Response, text?: string, json?: Object }
type WretcherError = Error & { status: number, response: WretcherResponse, text?: string, json?: Object }
```
```js
Expand Down Expand Up @@ -899,7 +899,7 @@ type Middleware = (options?: {[key: string]: any}) => ConfiguredMiddleware
// A configured middleware (with options curried)
type ConfiguredMiddleware = (next: FetchLike) => FetchLike
// A "fetch like" function, accepting an url and fetch options and returning a response promise
type FetchLike = (url: string, opts: RequestInit) => Promise<Response>
type FetchLike = (url: string, opts: WretcherOptions) => Promise<WretcherResponse>
```
#### middlewares(middlewares: ConfiguredMiddleware[], clear = false)
Expand Down
2 changes: 1 addition & 1 deletion dist/bundle/wretch.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/bundle/wretch.js.map

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion dist/config.d.ts
Expand Up @@ -9,6 +9,9 @@ declare const config: {
PerformanceObserver: any;
AbortController: any;
};
polyfill(p: string, doThrow?: boolean, instance?: boolean, ...args: any[]): any;
polyfill(p: string, { doThrow, instance }?: {
doThrow?: boolean;
instance?: boolean;
}, ...args: any[]): any;
};
export default config;
9 changes: 4 additions & 5 deletions dist/config.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/config.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion dist/middleware.d.ts
@@ -1,6 +1,8 @@
import { WretcherOptions } from "./wretcher";
import { WretcherResponse } from "./resolver";
export declare type Middleware = (options?: {
[key: string]: any;
}) => ConfiguredMiddleware;
export declare type ConfiguredMiddleware = (next: FetchLike) => FetchLike;
export declare type FetchLike = (url: string, opts: RequestInit) => Promise<Response>;
export declare type FetchLike = (url: string, opts: WretcherOptions) => Promise<WretcherResponse>;
export declare const middlewareHelper: (middlewares: ConfiguredMiddleware[]) => (fetchFunction: FetchLike) => FetchLike;
2 changes: 1 addition & 1 deletion dist/middleware.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/perfs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 16c0b97

Please sign in to comment.