Open devcaeg opened 1 month ago
Thanks for the implementation! Should we call it valibot
instead of valibot/types
? Are there any downsides to this change? I need to do some research on my own before merging.
Are you sure you're able to override type
declarations in this way? In my experiments I get a "Duplicate identifier" error.
Thanks for the implementation! Should we call it
valibot
instead ofvalibot/types
? Are there any downsides to this change? I need to do some research on my own before merging.
In reality there should be no difference.
Are you sure you're able to override
type
declarations in this way? In my experiments I get a "Duplicate identifier" error.
I use this method on several projects and it works well. I do the override in .d.ts
files.
For example, the adonisjs
framework uses this method.
https://docs.adonisjs.com/guides/digging-deeper/emitter#making-events-type-safe
Thanks for the info and the link. I will try to review it next week.
For example, the
adonisjs
framework uses this method.
Do they also use a *.d.ts
file internally that can be overwritten by a custom *.d.ts
file?
Have you checked if the following works without modifying Valibot's source code?
// valibot.d.ts
declare module 'valibot' {
type Prettify<TObject> = TObject;
}
Have you checked if the following works without modifying Valibot's source code?
// valibot.d.ts declare module 'valibot' { type Prettify<TObject> = TObject; }
I have tried this method but it doesn't work for me.
I have investigated this PR. Your workaround works, but I found one drawback. If Prettify
is not defined in a custom *.d.ts
file, the Prettify
type will no longer be resolved in the type preview:
I expect the preview to show
type Input = { email: string }
and nottype Input = Prettify<…>
728