-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterface.valibot.ts
More file actions
56 lines (50 loc) · 1.42 KB
/
interface.valibot.ts
File metadata and controls
56 lines (50 loc) · 1.42 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import {
InferOutput,
array,
boolean,
email,
literal,
number,
object,
pipe,
string,
union,
} from 'valibot'
export const Interface_BaseSubModel1 = object({
description: string(),
createdAt: string(),
updatedAt: string(),
})
export type Interface_BaseSubModel1 = InferOutput<typeof Interface_BaseSubModel1>
export const Interface_BaseSubModel2 = object({
description: string(),
createdAt: string(),
updatedAt: string(),
})
export type Interface_BaseSubModel2 = InferOutput<typeof Interface_BaseSubModel2>
export const Interface_BaseSubModel3 = object({
name: string(),
age: number(),
isActive: boolean(),
})
export type Interface_BaseSubModel3 = InferOutput<typeof Interface_BaseSubModel3>
export const Interface_BaseSubModel4 = object({
title: string(),
tags: array(string()),
published: boolean(),
})
export type Interface_BaseSubModel4 = InferOutput<typeof Interface_BaseSubModel4>
export const Interface_BaseSubModel5 = object({
id: number(),
email: pipe(string(), email()),
role: union([literal('admin'), literal('user'), literal('guest')]),
})
export type Interface_BaseSubModel5 = InferOutput<typeof Interface_BaseSubModel5>
export const Interface_ComplexUnion = union([
Interface_BaseSubModel1,
Interface_BaseSubModel2,
Interface_BaseSubModel3,
Interface_BaseSubModel4,
Interface_BaseSubModel5,
])
export type Interface_ComplexUnion = InferOutput<typeof Interface_ComplexUnion>