superstruct
superstruct copied to clipboard
Does "create" supports "passthrough"
When using Superstruct for data coercion, can I allow other non-defined fields ? Same as zod's passthrough method.
I would use type here.
import { assert, string, type } from 'superstruct'
const myStruct = type({ name: string() })
const data = {
name: 'yeoffrey',
age: 23,
}
assert(data, myStruct) // Passes
I'm closing this as @yeoffrey seems to have answered the question.
@Bonjour123 if you have any more detail about this or further questions, please head over to our newly opened GitHub Discussions page — we'll be happy to help you out there! :)