Replies: 1 comment 2 replies
-
@wyozi Hi, Does this work? import { Type, Static, TObject, TProperties } from '@sinclair/typebox'
export const Amend = <T extends TObject, P extends TProperties>(schema: T, properties: P) =>
Type.Composite([schema, Type.Object(properties)])
const first = Type.Object({
x: Type.Number(),
y: Type.Number()
})
const second = Amend(first, {
z: Type.Number()
})
type T = Static<typeof second> |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey, would it be possible to amend an existing type object in a stable way?
I mean something like
Seems like a bit of a weird usecase, but it's for a library concept I'm prototyping.
Beta Was this translation helpful? Give feedback.
All reactions