chore: linting

This commit is contained in:
Max Leiter 2023-02-26 15:22:05 -08:00
parent 27a604dc90
commit a54a22f142
5 changed files with 14 additions and 13 deletions

View file

@ -18,17 +18,19 @@ export function Providers({ children }: PropsWithChildren<unknown>) {
)
}
export type ApiResponse<T> = {
data: T
error: never
} | {
data: never
error: string
}
export type ApiResponse<T> =
| {
data: T
error: never
}
| {
data: never
error: string
}
async function fetcher<T>(url: string): Promise<unknown> {
const response = await fetch(url)
const data: ApiResponse<T> = await response.json() as ApiResponse<T>
const data: ApiResponse<T> = (await response.json()) as ApiResponse<T>
if (data.error) {
throw new Error(data.error)

View file

@ -43,7 +43,7 @@ function VisibilityControl({
})
if (res.ok) {
const json = await res.json() as PostWithFiles
const json = (await res.json()) as PostWithFiles
setVisibility(json.visibility)
router.refresh()
setToast({

View file

@ -59,7 +59,7 @@ const PostList = ({
}
}
)
const json = await res.json() as PostWithFiles[]
const json = (await res.json()) as PostWithFiles[]
setPosts(json)
setSearching(false)
}

View file

@ -36,7 +36,7 @@ export function useApiTokens({ userId, initialTokens }: UseApiTokens) {
}
)
const response = await res.json() as ApiResponse<SerializedApiToken>
const response = (await res.json()) as ApiResponse<SerializedApiToken>
if (response.error) {
throw new Error(response.error)
return

3
types/index.d.ts vendored
View file

@ -1,2 +1 @@
import "@total-typescript/ts-reset";
import "@total-typescript/ts-reset"