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
Sometimes, I have a type A that might be used in other types. If I need to add constraints on that type, I would have to repeat those constraints every time I create a validator for a type that references type A.
typeUrl=stringtypeVideo={url: Urllength: number}typeImage={url: Urlwidth: numberheight: number}registerType('Video')register('Image')constimageValidator=createValidator<Image>(undefined,{constraints: {Url: x=>x.startsWith('http://')// this can't be moved to an object or babel-macro will complain}})constvideoValidator=createValidator<Video>(undefined,{constraints: {Url: x=>x.startsWith('http://')}})
It would be nice if one of the following was possible:
Type constraints can be defined when registering the corresponding type
Sometimes, I have a type
A
that might be used in other types. If I need to add constraints on that type, I would have to repeat those constraints every time I create a validator for a type that references typeA
.It would be nice if one of the following was possible:
Type constraints can be defined when registering the corresponding type
Type constraints can be defined globally
The text was updated successfully, but these errors were encountered: