Skip to content

Commit 643af46

Browse files
committed
more type fixes
1 parent f543fe7 commit 643af46

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

packages/plexus-api/src/api.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
PlexusApiReq,
77
PlexusApiRes,
88
PlexusApiSendOptions,
9+
PlexusApiFetchOptions,
910
} from './types'
1011
// let's get Blob from Node.js or browser
1112
let Blob
@@ -284,7 +285,7 @@ export class ApiInstance {
284285
get<ResponseType = any>(
285286
path: string,
286287
query?: Record<string, any>,
287-
options?: PlexusApiSendOptions
288+
options?: PlexusApiFetchOptions
288289
) {
289290
const params = new URLSearchParams(query)
290291

@@ -309,7 +310,7 @@ export class ApiInstance {
309310
>(
310311
path: string,
311312
body: BodyType = {} as BodyType,
312-
reqOptions = {} as PlexusApiSendOptions
313+
reqOptions = {} as PlexusApiFetchOptions
313314
) {
314315
const bodyString = typeof body === 'string' ? body : JSON.stringify(body)
315316
const options = {
@@ -340,7 +341,7 @@ export class ApiInstance {
340341
put<ResponseType = any>(
341342
path: string,
342343
body: Record<string, any> | string = {},
343-
options?: PlexusApiSendOptions
344+
options?: PlexusApiFetchOptions
344345
) {
345346
if (typeof body !== 'string') {
346347
body = JSON.stringify(body)
@@ -359,7 +360,7 @@ export class ApiInstance {
359360
delete<ResponseType = any>(
360361
path: string,
361362
body: Record<string, any> | string = {},
362-
options?: PlexusApiSendOptions
363+
options?: PlexusApiFetchOptions
363364
) {
364365
if (typeof body !== 'string') {
365366
body = JSON.stringify(body)
@@ -379,7 +380,7 @@ export class ApiInstance {
379380
patch<ResponseType = any>(
380381
path: string,
381382
body: Record<string, any> | string = {},
382-
options?: PlexusApiSendOptions
383+
options?: PlexusApiFetchOptions
383384
) {
384385
if (typeof body !== 'string') {
385386
body = JSON.stringify(body)
@@ -399,7 +400,7 @@ export class ApiInstance {
399400
gql<ResponseType = any>(
400401
query: string,
401402
variables?: Record<string, any>,
402-
options?: PlexusApiSendOptions
403+
options?: PlexusApiFetchOptions
403404
) {
404405
this._headers.set('Content-Type', 'application/json')
405406

packages/plexus-api/src/types.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,13 @@ export interface PlexusApiOptions {
4141
window?: RequestInit['window']
4242
}
4343

44-
export interface PlexusApiSendOptions extends PlexusApiOptions {
44+
export interface PlexusApiFetchOptions extends PlexusApiOptions {
45+
headers?: RequestInit['headers']
46+
}
47+
48+
export interface PlexusApiSendOptions extends PlexusApiFetchOptions {
4549
method: ApiMethod
4650
body?: RequestInit['body']
47-
headers?: RequestInit['headers']
4851
}
4952

5053
export interface ApiStore {

0 commit comments

Comments
 (0)