-
Notifications
You must be signed in to change notification settings - Fork 56
/
index.ts
30 lines (28 loc) · 899 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { z } from 'zod'
export const GempaBaseSchema = z.object({
date: z.string(),
time: z.string(),
latitude: z.string(),
longitude: z.string(),
magnitude: z.string(),
depth: z.string()
})
export const GempaSchema = z.object({
location: z.string(),
warning: z.array(z.string())
}).merge(GempaBaseSchema)
export const GempaNowSchema = z.object({
location: z.string(),
}).merge(GempaBaseSchema)
export const GempaRealtimeSchema = z.object({
location: z.array(z.string()),
isConfirmed: z.boolean()
}).merge(GempaBaseSchema)
export type Gempa = z.infer<typeof GempaSchema>
export type GempaNow = z.infer<typeof GempaNowSchema>
export type GempaRealtime = z.infer<typeof GempaRealtimeSchema>
export const TsunamiSchema = z.object({
location: z.string(),
info: z.string()
}).merge(GempaBaseSchema)
export type Tsunami = z.infer<typeof TsunamiSchema>