mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
9 lines
205 B
TypeScript
9 lines
205 B
TypeScript
import type { z } from 'zod'
|
|
|
|
export async function readJson<Schema extends z.ZodType>(
|
|
response: Response,
|
|
schema: Schema,
|
|
): Promise<z.infer<Schema>> {
|
|
return schema.parse(await response.json())
|
|
}
|