Valibot
https://gyazo.com/a5399828a77241d56fa0e38e755c9da8
initial commitは2023/7/7
Zodのchainableなデザインを辞めることでbundle sizeを小さく抑えられる code:ts
import * as v from 'valibot';
const LoginSchema = v.object({…});
type LoginData = v.InferOutput<typeof LoginSchema>;
function getLoginData(data: unknown): LoginData {
return v.parse(LoginSchema, data);
}
Zodより絶対こっちのアプローチのほうが正しいよなあ..mrsekut.icon
lodashとかmomentとかの問題があったのに、なぜZodはchainするデザインにしたのか
命名規則
i18n
エラーメッセージの多言語対応
v.InferInputが使えないやつがあって一貫性がない
code:ts
import * as v from 'valibot';
type Email = v.InferInput<typeof Email>; // Type 'EmailValidation<string>' does not satisfy the constraint 'BaseSchema<any, any> | BaseSchemaAsync<any, any>'.
const Email = v.email()
書き方がおかしいのか
こうか
code:ts
type Email = v.InferInput<typeof Email>;
docs
多すぎだし、アルファベット順だから見づらいmrsekut.icon
Storages
deleteGlobalConfig
deleteGlobalMessage
deleteSchemaMessage
deleteSpecificMessage
getGlobalConfig
getGlobalMessage
getSchemaMessage
getSpecificMessage
setGlobalConfig
setGlobalMessage
setSchemaMessage
setSpecificMessage
Utils
entriesFromList
getDotPath
isOfKind
isOfType
isValiError
ValiError
Async
arrayAsync
awaitAsync
checkAsync
customAsync
fallbackAsync
forwardAsync
getDefaultsAsync
getFallbacksAsync
intersectAsync
lazyAsync
looseObjectAsync
looseTupleAsync
mapAsync
nonNullableAsync
nonNullishAsync
nonOptionalAsync
nullableAsync
nullishAsync
objectAsync
objectWithRestAsync
optionalAsync
parseAsync
parserAsync
partialAsync
partialCheckAsync
pipeAsync
rawCheckAsync
rawTransformAsync
recordAsync
requiredAsync
safeParseAsync
safeParserAsync
setAsync
strictObjectAsync
strictTupleAsync
transformAsync
tupleAsync
tupleWithRestAsync
undefinedableAsync
unionAsync
variantAsync
Types
AnySchema
ArrayInput
ArrayIssue
ArrayPathItem
ArrayRequirement
ArraySchema
ArraySchemaAsync
AwaitActionAsync
Base64Action
Base64Issue
BaseIssue
BaseMetadata
BaseSchema
BaseSchemaAsync
BaseTransformation
BaseTransformationAsync
BaseValidation
BaseValidationAsync
BicAction
BicIssue
BigintIssue
BigintSchema
BlobIssue
BlobSchema
BooleanIssue
BooleanSchema
Brand
BrandAction
BrandName
BytesAction
BytesIssue
CheckAction
CheckActionAsync
CheckIssue
CheckItemsAction
CheckItemsIssue
Class
Config
ContentInput
ContentRequirement
CreditCardAction
CreditCardIssue
Cuid2Action
Cuid2Issue
CustomIssue
CustomSchema
CustomSchemaAsync
Dataset
DateIssue
DateSchema
DecimalAction
DecimalIssue
DeepPickN
Default
DefaultAsync
DefaultValue
DescriptionAction
EmailAction
EmailIssue
EmojiAction
EmojiIssue
EmptyAction
EmptyIssue
EndsWithAction
EndsWithIssue
Enum
EnumIssue
EnumSchema
ErrorMessage
EveryItemAction
EveryItemIssue
ExcludesAction
ExcludesIssue
Fallback
FallbackAsync
FileIssue
FileSchema
FilterItemsAction
FindItemAction
FiniteAction
FiniteIssue
FirstTupleItem
FlatErrors
FunctionIssue
FunctionSchema
GenericIssue
GenericMetadata
GenericSchema
GenericSchemaAsync
GenericTransformation
GenericTransformationAsync
GenericValidation
GenericValidationAsync
GlobalConfig
HashAction
HashIssue
HashType
HexadecimalAction
HexadecimalIssue
HexColorAction
HexColorIssue
ImeiAction
ImeiIssue
IncludesAction
IncludesIssue
InferDefault
InferDefaults
InferFallback
InferFallbacks
InferIntersectInput
InferIntersectOutput
InferMapInput
InferMapOutput
InferNonNullableInput
InferNonNullableIssue
InferNonNullableOutput
InferNonNullishInput
InferNonNullishIssue
InferNonNullishOutput
InferNonOptionalInput
InferNonOptionalIssue
InferNonOptionalOutput
InferNullableOutput
InferNullishOutput
InferObjectInput
InferObjectIssue
InferObjectOutput
InferOptionalOutput
InferRecordInput
InferRecordOutput
InferSetInput
InferSetOutput
InferTupleInput
InferTupleIssue
InferTupleOutput
InferVariantIssue
InstanceIssue
InstanceSchema
IntegerAction
IntegerIssue
IntersectIssue
IntersectOptions
IntersectOptionsAsync
IntersectSchema
IntersectSchemaAsync
IpAction
IpIssue
Ipv4Action
Ipv4Issue
Ipv6Action
Ipv6Issue
IsoDateAction
IsoDateIssue
IsoDateTimeAction
IsoDateTimeIssue
IsoTimeAction
IsoTimeIssue
IsoTimeSecondAction
IsoTimeSecondIssue
IsoTimestampAction
IsoTimestampIssue
IsoWeekAction
IsoWeekIssue
IssueDotPath
IssuePathItem
LazySchema
LazySchemaAsync
LengthAction
LengthInput
LengthIssue
Literal
LiteralIssue
LooseObjectIssue
LooseObjectSchema
LooseObjectSchemaAsync
LooseTupleIssue
LooseTupleSchema
LooseTupleSchemaAsync
LiteralSchema
Mac48Action
Mac48Issue
Mac64Action
Mac64Issue
MacAction
MacIssue
MapIssue
MapItemsAction
MapPathItem
MapSchema
MapSchemaAsync
MaxBytesAction
MaxBytesIssue
MaxLengthAction
MaxLengthIssue
MaxSizeAction
MaxSizeIssue
MaxValueAction
MaxValueIssue
MaybePromise
MaybeReadonly
MimeTypeAction
MimeTypeIssue
MinBytesAction
MinBytesIssue
MinLengthAction
MinLengthIssue
MinSizeAction
MinSizeIssue
MinValueAction
MinValueIssue
MultipleOfAction
MultipleOfIssue
NanIssue
NanSchema
NeverIssue
NeverSchema
NonEmptyAction
NonEmptyIssue
NonNullable
NonNullableIssue
NonNullableSchema
NonNullableSchemaAsync
NonNullish
NonNullishIssue
NonNullishSchema
NonNullishSchemaAsync
NonOptional
NonOptionalIssue
NonOptionalSchema
NonOptionalSchemaAsync
NoPipe
NormalizeAction
NormalizeForm
NotBytesAction
NotBytesIssue
NotLengthAction
NotLengthIssue
NotSizeAction
NotSizeIssue
NotValueAction
NotValueIssue
NullableSchema
NullableSchemaAsync
NullishSchema
NullishSchemaAsync
NullIssue
NullSchema
NumberIssue
NumberSchema
ObjectEntries
ObjectEntriesAsync
ObjectIssue
ObjectKeys
ObjectPathItem
ObjectSchema
ObjectSchemaAsync
ObjectWithRestIssue
ObjectWithRestSchema
ObjectWithRestSchemaAsync
OctalAction
OctalIssue
OptionalSchema
OptionalSchemaAsync
Parser
ParserAsync
PartialCheckAction
PartialCheckIssue
PartialInput
PathKeys
PicklistOptions
PicklistIssue
PicklistSchema
PipeAction
PipeActionAsync
PipeItem
PipeItemAsync
PromiseIssue
PromiseSchema
RawCheckAction
RawCheckIssue
RawTransformAction
RawTransformIssue
ReadonlyAction
RecordIssue
RecordSchema
ReduceItemsAction
RegexAction
RegexIssue
SafeIntegerAction
SafeIntegerIssue
SafeParser
SafeParserAsync
SafeParseResult
SchemaWithFallback
SchemaWithFallbackAsync
SetPathItem
SetIssue
SetSchema
SetSchemaAsync
SizeAction
SizeInput
SizeIssue
SomeItemAction
SomeItemIssue
SortItemsAction
StartsWithAction
StartsWithIssue
StrictObjectIssue
StrictObjectSchema
StrictObjectSchemaAsync
StrictTupleIssue
StrictTupleSchema
StrictTupleSchemaAsync
StringIssue
StringSchema
SymbolIssue
SymbolSchema
ToLowerCaseAction
ToMaxValueAction
ToMinValueAction
ToUpperCaseAction
TransformAction
TrimAction
TrimEndAction
TrimStartAction
TupleIssue
TupleItems
TupleItemsAsync
TupleSchema
TupleSchemaAsync
TupleWithRestIssue
TupleWithRestSchema
TupleWithRestSchemaAsync
TypedDataset
UlidAction
UlidIssue
UndefinedableSchema
UndefinedableSchemaAsync
UndefinedIssue
UndefinedSchema
UnionOptions
UnionOptionsAsync
UnionIssue
UnionSchema
UnionSchemaAsync
UnknownPathItem
UnknownSchema
UntypedDataset
UrlAction
UrlIssue
UuidAction
UuidIssue
ValueAction
ValueInput
ValueIssue
VariantIssue
VariantOptions
VariantOptionsAsync
VariantSchema
VariantSchemaAsync
VoidIssue
VoidSchema