You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The same possibility to extend the built-in types referenced in LocaleObject isn't possible since they're not exported from index.ts, which causes typescript validation to fail when trying to pass default messages for added methods to setLocale.
Expected behavior
MixedLocale, StringLocale, NumberLocale,DateLocale,ObjectLocale, ArrayLocale, TupleLocale and BooleanLocale interfaces should be exported from src/index.ts (lib/index.d.ts in build output) to support declaration merging and enable using setLocale in a type-safe way for extended methods.
The text was updated successfully, but these errors were encountered:
Describe the bug
When adding custom method to schema using
addMethod
, it's possible to use module augmentation to extend the schema interface (See 'Extending built-in schema with new methods' example).The same possibility to extend the built-in types referenced in
LocaleObject
isn't possible since they're not exported from index.ts, which causes typescript validation to fail when trying to pass default messages for added methods tosetLocale
.To Reproduce
Example where I'm adding
divisibleBy
method to number schema:https://codesandbox.io/p/sandbox/muddy-dust-59pzxg?file=%2Fsrc%2FYupNumberExtensionExample.ts
Expected behavior
MixedLocale, StringLocale, NumberLocale,DateLocale,ObjectLocale, ArrayLocale, TupleLocale and BooleanLocale interfaces should be exported from
src/index.ts
(lib/index.d.ts
in build output) to support declaration merging and enable using setLocale in a type-safe way for extended methods.The text was updated successfully, but these errors were encountered: