@@ -21,7 +21,7 @@ With reference models, you can named your model and use it by referencing the na
21
21
22
22
For example:
23
23
``` typescript
24
- import { Elysia } from ' elysia'
24
+ import { Elysia , t } from ' elysia'
25
25
26
26
const app = new Elysia ()
27
27
.post (' /sign-in' , ({ body }) => body , {
@@ -38,7 +38,7 @@ const app = new Elysia()
38
38
39
39
We can make it cleaner, by declaring the model as a variable.
40
40
``` typescript
41
- import { Elysia } from ' elysia'
41
+ import { Elysia , t } from ' elysia'
42
42
43
43
// Maybe in a different file eg. models.ts
44
44
const SignDTO = t .Object ({
@@ -62,7 +62,7 @@ You can make it a bit cleaner by creating a "reference model".
62
62
Registering the models with ` setModel ` allows you to name a model and reference them directly in ` schema ` with auto-completion.
63
63
64
64
``` typescript
65
- import { Elysia } from ' elysia'
65
+ import { Elysia , t } from ' elysia'
66
66
67
67
const app = new Elysia ()
68
68
.model ({
@@ -82,7 +82,7 @@ Now when we need to quickly access the model's group, we can separate a `setMode
82
82
83
83
``` typescript
84
84
// auth.model.ts
85
- import { Elysia } from ' elysia'
85
+ import { Elysia , t } from ' elysia'
86
86
87
87
export const authModel = new Elysia ()
88
88
.model ({
@@ -110,7 +110,7 @@ const app = new Elysia()
110
110
111
111
``` typescript
112
112
// auth.model.ts
113
- import { Elysia } from ' elysia'
113
+ import { Elysia , t } from ' elysia'
114
114
115
115
export const authModel = new Elysia ()
116
116
.model ({
0 commit comments