-
Notifications
You must be signed in to change notification settings - Fork 934
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
yup.setLocale() types #1321
Comments
I'm having the same issue. Typing used to be defined as Old type:
|
Same need here, for now i'm using patch-package to add the removed types manually, until it get supported. I copied the type from the definitelytyped package that @StevenVerbiest mentioned. |
Hi! For now, is also possible to overload the current type of setLocale with custom type definitions // yup.d.ts
import {
ArrayLocale,
BooleanLocale,
DateLocale,
MixedLocale,
NumberLocale,
ObjectLocale,
StringLocale,
} from 'yup/lib/locale';
declare module 'yup' {
export interface LocaleObject {
mixed?: MixedLocale;
string?: StringLocale;
number?: NumberLocale;
date?: DateLocale;
boolean?: BooleanLocale;
object?: ObjectLocale;
array?: ArrayLocale;
}
export function setLocale(custom: LocaleObject): void;
} The types of setLocale will works fine! |
The setLocale file was changed to .ts and the LocaleObject interface was created in locale.ts Close jquense#1321.
The setLocale file was changed to .ts and the LocaleObject interface was created in locale.ts Close #1321.
After upgrading the library and removing
@types/yup
to enable native TS support I've encountered a problem withyup.setLocale()
. I am having issues with the following code:The approach is taken straight from the docs. So why is the type
setLocale(custom: any): void
? Won'tparams.min
orparams.type
be present by default? Why those are not included. Yes, I can easily type it myself but it seems weird.Are there plans for typing it and if not - why not?
Thanks!
The text was updated successfully, but these errors were encountered: