-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatibility with Cloudflare Workers #253
Comments
@Unvented Hi. You can use import { Value } from '@sinclair/typebox/value'
import { Type } from '@sinclair/typebox'
const T = Type.Object({
x: Type.Number(),
y: Type.Number(),
z: Type.Number()
})
const value = { x: 1, y: 2, z: 3 }
if(!Value.Check(T, value)) {
const errors = [...Value.Errors(T, value)]
console.log(errors)
} Alternatively, if you want to retain the performance, you can inspect the compiled validation routine with the const T = Type.Object({
x: Type.Number(),
y: Type.Number(),
z: Type.Number()
})
const C = TypeCompiler.Compile(T)
console.log(C.Code()) // use this code to validate Hope that helps |
@sinclairzx81 thank you so much <3 |
I'd like to use TypeBox in Cloudflare Workers, but i keep getting the below error.
Is there any way to work around this?
The text was updated successfully, but these errors were encountered: