fabian-hiller / valibot

The modular and type safe schema library for validating structural data 🤖
https://valibot.dev
MIT License
6.08k stars 189 forks source link

Simple Object with key #731

Closed NagRock closed 2 months ago

NagRock commented 2 months ago

Hey!

Migration page says:


import { z } from 'zod';
const Schema = z.object({ key: z.string() });

// To this
import * as v from 'valibot';
const Schema = v.object({ key: v.string() });```

But when I try to use it I get: `Expected 0 arguments, but got 1`. 

Is this migration page outdated or I'm doing something wrong?
NagRock commented 2 months ago

Ok, looks like it requires typescript 5+

fabian-hiller commented 2 months ago

Something seems wrong here. Does it work for you on our playground?

NagRock commented 2 months ago

I had TS version 4.9.5. After bump to latest its working. Thanks

fabian-hiller commented 2 months ago

We will add a warning when installation in the next release.