Skip to content

Commit

Permalink
fix FetchRequestData type for determineBodyPromise
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Newcomer committed Feb 4, 2021
1 parent 8a2e21d commit 759c470
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
12 changes: 2 additions & 10 deletions packages/adapter/addon/-private/utils/determine-body-promise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@ import { DEBUG } from '@glimmer/env';

import continueOnReject from './continue-on-reject';

type FetchRequestData = {
url?: string;
method?: string;
[key: string]: any;
};

type RequestData = import('../../rest').RequestData;
type Payload = object | string | undefined;

interface CustomSyntaxError extends SyntaxError {
Expand Down Expand Up @@ -68,10 +63,7 @@ function _determineContent(response: Response, requestData: JQueryAjaxSettings,
return ret;
}

export function determineBodyPromise(
response: Response,
requestData: JQueryAjaxSettings | FetchRequestData
): Promise<Payload> {
export function determineBodyPromise(response: Response, requestData: RequestData): Promise<Payload> {
// response.text() may resolve or reject
// it is a native promise, may not have finally
return continueOnReject(response.text()).then(payload => _determineContent(response, requestData, payload));
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter/addon/rest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export interface JQueryRequestInit extends JQueryAjaxSettings {
type: string;
}

type RequestData = {
export type RequestData = {
url: string;
method: string;
[key: string]: any;
Expand Down

0 comments on commit 759c470

Please sign in to comment.