Object.assign. It can accept
typestructs, returning a struct matching whichever is passed in as the first parameter (ie, which struct is being "assigned" into).
deprecatedstructs validate that a value matches a specific struct, or that it is
undefined. But in addition, when the value is not
undefined, it will call the
logfunction you pass in so you can warn users that they're using a deprecated API.
dynamicallows you to create a struct with validation logic that can change at runtime. The callback will be called with
(value, context)and must return the struct to continue validation with.
lazyallows you to create a self-referential struct, useful for defining recursive data structures.
🤖 Note that TypeScript can't automatically infer the type from this kind of recursive structure, so you'll need to pass in the type manually.
omitallows you to create a new struct based on an existing object struct, but excluding specific properties.
partialallows you to create a new struct based on an existing object struct, but with all of its properties being optional.
pickallows you to create a new struct based on an existing object struct, but only including specific properties.