fix type errors
This commit is contained in:
parent
3dcd6bfac1
commit
576a4c442f
|
|
@ -129,7 +129,7 @@ const Players: React.FC = () => {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const { code, message } = await fetch.post(
|
const { code, message } = await fetch.post<fetch.ResponseBody>(
|
||||||
`/user/player/delete/${player.pid}`,
|
`/user/player/delete/${player.pid}`,
|
||||||
)
|
)
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
/* eslint-disable @typescript-eslint/indent */
|
/* eslint-disable @typescript-eslint/indent */
|
||||||
import * as net from '../../src/scripts/net'
|
import * as net from '../../src/scripts/net'
|
||||||
|
|
||||||
|
export { ResponseBody } from '../../src/scripts/net'
|
||||||
|
|
||||||
export const init = {} as typeof net.init
|
export const init = {} as typeof net.init
|
||||||
|
|
||||||
export const walkFetch = {} as jest.Mock<
|
export const walkFetch = {} as jest.Mock<
|
||||||
|
|
@ -8,22 +10,28 @@ export const walkFetch = {} as jest.Mock<
|
||||||
Parameters<typeof net.walkFetch>
|
Parameters<typeof net.walkFetch>
|
||||||
>
|
>
|
||||||
|
|
||||||
|
type FetchFn = <T = any>(url: string, data?: object) => Promise<T>
|
||||||
|
|
||||||
export const get = {} as jest.Mock<
|
export const get = {} as jest.Mock<
|
||||||
ReturnType<typeof net.get>,
|
ReturnType<typeof net.get>,
|
||||||
Parameters<typeof net.get>
|
Parameters<typeof net.get>
|
||||||
>
|
> &
|
||||||
|
FetchFn
|
||||||
|
|
||||||
export const post = {} as jest.Mock<
|
export const post = {} as jest.Mock<
|
||||||
ReturnType<typeof net.post>,
|
ReturnType<typeof net.post>,
|
||||||
Parameters<typeof net.post>
|
Parameters<typeof net.post>
|
||||||
>
|
> &
|
||||||
|
FetchFn
|
||||||
|
|
||||||
export const put = {} as jest.Mock<
|
export const put = {} as jest.Mock<
|
||||||
ReturnType<typeof net.post>,
|
ReturnType<typeof net.post>,
|
||||||
Parameters<typeof net.post>
|
Parameters<typeof net.post>
|
||||||
>
|
> &
|
||||||
|
FetchFn
|
||||||
|
|
||||||
export const del = {} as jest.Mock<
|
export const del = {} as jest.Mock<
|
||||||
ReturnType<typeof net.post>,
|
ReturnType<typeof net.post>,
|
||||||
Parameters<typeof net.post>
|
Parameters<typeof net.post>
|
||||||
>
|
> &
|
||||||
|
FetchFn
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user