Replies: 2 comments 2 replies
-
I am currently writing my bachelor thesis and plan to investigate ArkType in it as well. I plan to publish the paper in September. Furthermore I will integrate the research into the Valibot docs. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Would love to have an update on this, especially since ArkType v2 was released on January 2025. https://arktype.io/docs/intro/your-first-type import { type } from 'arktype';
// define
const user = type({
'name': 'string',
'platform': "'android' | 'ios'",
'versions?': '(number | string)[]',
});
/* {
name: string;
platform: 'android' | 'ios';
versions?: (string | number)[] | undefined;
} */
type User = typeof user.infer;
// validate
const out = user({
name: 'Alan Turing',
device: {
platform: 'enigma',
versions: [0, '1', 0n],
},
});
if (out instanceof type.errors) {
// platform must be "android" or "ios" (was missing)
console.error(out.summary);
} else {
console.log(`Hello, ${out.name}`);
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Curious to know how Valibot compares to arktype. When would I use Valibot over arktype and vice versa? Thanks a lot 😊
Beta Was this translation helpful? Give feedback.
All reactions