Skip to content

Commit

Permalink
🐛 Fix defer and resolve return types.
Browse files Browse the repository at this point in the history
Should solve #140
  • Loading branch information
elbywan committed Aug 3, 2022
1 parent 4c4838d commit 0c59c6c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const core: Wretch = {
resolve<R = unknown>(resolver, clear: boolean = false) {
return { ...this, _resolvers: clear ? [resolver] : [...this._resolvers, resolver] }
},
defer<R = unknown>(callback, clear = false) {
defer(callback, clear: boolean = false) {
return {
...this,
_deferred: clear ? [callback] : [...this._deferred, callback]
Expand Down
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ export interface Wretch<Self = unknown, Chain = unknown, Resolver = undefined> {
this: Self & Wretch<Self, Chain, Resolver>,
callback: WretchDeferredCallback<Self, Chain, Resolver>,
clear?: Clear
): Wretch<Self, Chain, Resolver>
): this

/**
* Programs a resolver to perform response chain tasks automatically.
Expand Down Expand Up @@ -359,7 +359,7 @@ export interface Wretch<Self = unknown, Chain = unknown, Resolver = undefined> {
originalRequest: Wretch<Self, Chain, Clear extends true ? undefined : Resolver>
) => ResolverReturn,
clear?: Clear
): Wretch<Self, Chain, ResolverReturn>
): Self & Wretch<Self, Chain, ResolverReturn>

/**
* Add middlewares to intercept a request before being sent.
Expand Down

0 comments on commit 0c59c6c

Please sign in to comment.