How to use multiple types in record value? #837
Answered
by
sinclairzx81
dhruv-nudge
asked this question in
Q&A
-
I want to do something like this
|
Beta Was this translation helpful? Give feedback.
Answered by
sinclairzx81
Apr 19, 2024
Replies: 1 comment 1 reply
-
@dhruv-nudge Hiya, try the following import { Type, Static } from '@sinclair/typebox'
const T = Type.Record(Type.String(), Type.Union([
Type.Number(),
Type.String(),
Type.Boolean(),
Type.Date()
]))
type T = Static<typeof T>
// type T = {
// [x: string]: string | number | boolean | Date;
// } Hope this helps |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
dhruv-nudge
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@dhruv-nudge Hiya, try the following
TypeScript Link Here
Hope this helps
S