Skip to content

Commit 8aa6d07

Browse files
authored
Merge pull request #141 from timsu92/patch-2
docs(schema): add type infer method
2 parents fab8549 + ac79d31 commit 8aa6d07

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/concept/schema.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ interface Body {
5858

5959
This means that you will get strict type defining once from a schema and get inferred type to TypeScript without needing to write a single TypeScript.
6060

61+
However, if you really want to get the Typescript type, this will do, but not `Static` method of Typebox:
62+
```typescript
63+
const body = t.Object({
64+
username: t.String(),
65+
password: t.String(),
66+
});
67+
68+
type bodyTp = (typeof body)["static"]
69+
```
70+
6171
## Global and scope
6272
The global schema will define all types within the scope of a handler.
6373

0 commit comments

Comments
 (0)