Class: default<TType, TContext, TOut>
yup.default
Type parameters​
Name | Type |
---|---|
TType | extends Maybe <number > = number | undefined |
TContext | extends AnyObject = AnyObject |
TOut | extends TType = TType |
Hierarchy​
BaseSchema
<TType
,TContext
,TOut
>↳
default
Constructors​
constructor​
• new default<TType
, TContext
, TOut
>()
Type parameters​
Name | Type |
---|---|
TType | extends Maybe <number > = undefined | number |
TContext | extends AnyObject = AnyObject |
TOut | extends Maybe <number > = TType |
Overrides​
Properties​
__inputType​
• Readonly
__inputType: TType
Inherited from​
__isYupSchema__​
• Readonly
__isYupSchema__: boolean
Inherited from​
__outputType​
• Readonly
__outputType: TOut
Inherited from​
_blacklist​
• Protected
_blacklist: default
Inherited from​
_whitelist​
• Protected
_whitelist: default
Inherited from​
deps​
• Readonly
deps: readonly string
[]
Inherited from​
equals​
• equals: <U>(enums
: (default
<unknown
> | Maybe
<U
>)[], message?
: Message
<{ values
: any
}>) => BaseSchema
<any
, AnyObject
, any
>
Type declaration​
â–¸ <U
>(enums
, message?
): BaseSchema
<any
, AnyObject
, any
>
Type parameters​
Name | Type |
---|---|
U | extends any |
Parameters​
Name | Type |
---|---|
enums | (default <unknown > | Maybe <U >)[] |
message? | Message <{ values : any }> |
Returns​
BaseSchema
<any
, AnyObject
, any
>
Inherited from​
exclusiveTests​
• Protected
exclusiveTests: Record
<string
, boolean
>
Inherited from​
is​
• is: <U>(enums
: (default
<unknown
> | Maybe
<U
>)[], message?
: Message
<{ values
: any
}>) => BaseSchema
<any
, AnyObject
, any
>
Type declaration​
â–¸ <U
>(enums
, message?
): BaseSchema
<any
, AnyObject
, any
>
Type parameters​
Name | Type |
---|---|
U | extends any |
Parameters​
Name | Type |
---|---|
enums | (default <unknown > | Maybe <U >)[] |
message? | Message <{ values : any }> |
Returns​
BaseSchema
<any
, AnyObject
, any
>
Inherited from​
nope​
• nope: <U>(enums
: (default
<unknown
> | Maybe
<U
>)[], message?
: Message
<{ values
: any
}>) => BaseSchema
<any
, AnyObject
, any
>
Type declaration​
â–¸ <U
>(enums
, message?
): BaseSchema
<any
, AnyObject
, any
>
Type parameters​
Name | Type |
---|---|
U | extends any |
Parameters​
Name | Type |
---|---|
enums | (default <unknown > | Maybe <U >)[] |
message? | Message <{ values : any }> |
Returns​
BaseSchema
<any
, AnyObject
, any
>
Inherited from​
not​
• not: <U>(enums
: (default
<unknown
> | Maybe
<U
>)[], message?
: Message
<{ values
: any
}>) => BaseSchema
<any
, AnyObject
, any
>
Type declaration​
â–¸ <U
>(enums
, message?
): BaseSchema
<any
, AnyObject
, any
>
Type parameters​
Name | Type |
---|---|
U | extends any |
Parameters​
Name | Type |
---|---|
enums | (default <unknown > | Maybe <U >)[] |
message? | Message <{ values : any }> |
Returns​
BaseSchema
<any
, AnyObject
, any
>
Inherited from​
spec​
• spec: SchemaSpec
<any
>
Inherited from​
tests​
• tests: Test
[]
Inherited from​
transforms​
• transforms: TransformFunction
<AnySchema
<any
, any
, any
>>[]
Inherited from​
type​
• Readonly
type: string
Inherited from​
Accessors​
_type​
• get
_type(): string
Returns​
string
Inherited from​
BaseSchema._type
Methods​
_cast​
â–¸ Protected
_cast(rawValue
, _options
): any
Parameters​
Name | Type |
---|---|
rawValue | any |
_options | CastOptions <TContext > |
Returns​
any
Inherited from​
_getDefault​
â–¸ Protected
_getDefault(): any
Returns​
any
Inherited from​
_isPresent​
â–¸ Protected
_isPresent(value
): boolean
Parameters​
Name | Type |
---|---|
value | unknown |
Returns​
boolean
Inherited from​
_typeCheck​
â–¸ Protected
_typeCheck(value
): value is NonNullable<TType>
Parameters​
Name | Type |
---|---|
value | any |
Returns​
value is NonNullable<TType>
Overrides​
_validate​
â–¸ Protected
_validate(_value
, options
, cb
): void
Parameters​
Name | Type |
---|---|
_value | any |
options | undefined | InternalOptions <TContext > |
cb | Callback <any > |
Returns​
void
Inherited from​
cast​
â–¸ cast(value
, options?
): TType
Parameters​
Name | Type |
---|---|
value | any |
options? | CastOptions <TContext > |
Returns​
TType
Inherited from​
clone​
â–¸ clone(spec?
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
spec? | Partial <SchemaSpec <any >> |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
concat​
â–¸ concat<TOther
>(schema
): TOther
Type parameters​
Name | Type |
---|---|
TOther | extends default <any , any , any , TOther > |
Parameters​
Name | Type |
---|---|
schema | TOther |
Returns​
TOther
Inherited from​
default​
â–¸ default<D
>(def
): If
<D
, default
<undefined
| TType
, TContext
, undefined
| TType
>, default
<Defined
<TType
>, TContext
, Defined
<TType
>>>
Type parameters​
Name | Type |
---|---|
D | extends Maybe <number > |
Parameters​
Name | Type |
---|---|
def | Thunk <D > |
Returns​
If
<D
, default
<undefined
| TType
, TContext
, undefined
| TType
>, default
<Defined
<TType
>, TContext
, Defined
<TType
>>>
Inherited from​
defined​
â–¸ defined(msg?
): DefinedNumberSchema
<TType
, TContext
>
Parameters​
Name | Type |
---|---|
msg? | Message <{}> |
Returns​
DefinedNumberSchema
<TType
, TContext
>
Inherited from​
describe​
â–¸ describe(): SchemaDescription
Returns​
SchemaDescription
Inherited from​
emptyAsUndefined​
â–¸ emptyAsUndefined(): default
<TType
, TContext
, TType
>
Returns​
default
<TType
, TContext
, TType
>
getDefault​
â–¸ getDefault(options?
): TType
Parameters​
Name | Type |
---|---|
options? | ResolveOptions <any > |
Returns​
TType
Inherited from​
integer​
â–¸ integer(message?
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
message? | Message <{}> |
Returns​
default
<TType
, TContext
, TOut
>
isType​
â–¸ isType(v
): boolean
Parameters​
Name | Type |
---|---|
v | any |
Returns​
boolean
Inherited from​
isValid​
â–¸ isValid(value
, options?
): Promise
<boolean
>
Parameters​
Name | Type |
---|---|
value | any |
options? | ValidateOptions <TContext > |
Returns​
Promise
<boolean
>
Inherited from​
isValidSync​
â–¸ isValidSync(value
, options?
): value is TOut
Parameters​
Name | Type |
---|---|
value | any |
options? | ValidateOptions <TContext > |
Returns​
value is TOut
Inherited from​
label​
â–¸ label(label
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
label | string |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
lessThan​
â–¸ lessThan(less
, message?
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
less | number | default <number > |
message? | Message <{ less : number }> |
Returns​
default
<TType
, TContext
, TOut
>
max​
â–¸ max(max
, message?
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
max | number | default <number > |
message? | Message <{ max : number }> |
Returns​
default
<TType
, TContext
, TOut
>
meta​
â–¸ meta(): undefined
| Record
<string
, unknown
>
Returns​
undefined
| Record
<string
, unknown
>
Inherited from​
â–¸ meta(obj
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
obj | Record <string , unknown > |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
min​
â–¸ min(min
, message?
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
min | number | default <number > |
message? | Message <{ min : number }> |
Returns​
default
<TType
, TContext
, TOut
>
moreThan​
â–¸ moreThan(more
, message?
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
more | number | default <number > |
message? | Message <{ more : number }> |
Returns​
default
<TType
, TContext
, TOut
>
negative​
â–¸ negative(msg?
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
msg? | Message <{ less : number }> |
Returns​
default
<TType
, TContext
, TOut
>
notOneOf​
â–¸ notOneOf<U
>(enums
, message?
): default
<TType
, TContext
, TOut
>
Type parameters​
Name | Type |
---|---|
U | extends Maybe <number > |
Parameters​
Name | Type |
---|---|
enums | (default <unknown > | Maybe <U >)[] |
message? | Message <{ values : any }> |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
notRequired​
â–¸ notRequired(): default
<TType
, TContext
, TType
>
Returns​
default
<TType
, TContext
, TType
>
Inherited from​
nullable​
â–¸ nullable(isNullable?
): default
<null
| TType
, TContext
, null
| TType
>
Parameters​
Name | Type |
---|---|
isNullable? | true |
Returns​
default
<null
| TType
, TContext
, null
| TType
>
Inherited from​
â–¸ nullable(isNullable
): default
<Exclude
<TType
, null
>, TContext
, Exclude
<TType
, null
>>
Parameters​
Name | Type |
---|---|
isNullable | false |
Returns​
default
<Exclude
<TType
, null
>, TContext
, Exclude
<TType
, null
>>
Inherited from​
oneOf​
â–¸ oneOf<U
>(enums
, message?
): default
<TType
, TContext
, TOut
>
Type parameters​
Name | Type |
---|---|
U | extends Maybe <number > |
Parameters​
Name | Type |
---|---|
enums | (default <unknown > | Maybe <U >)[] |
message? | Message <{ values : any }> |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
optional​
â–¸ optional(): default
<TType
, TContext
, TType
>
Returns​
default
<TType
, TContext
, TType
>
Inherited from​
positive​
â–¸ positive(msg?
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
msg? | Message <{ more : number }> |
Returns​
default
<TType
, TContext
, TOut
>
required​
â–¸ required(msg?
): RequiredNumberSchema
<TType
, TContext
>
Parameters​
Name | Type |
---|---|
msg? | Message <{}> |
Returns​
RequiredNumberSchema
<TType
, TContext
>
Inherited from​
resolve​
â–¸ resolve(options
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
options | ResolveOptions <any > |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
round​
â–¸ round(method
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
method | "ceil" | "floor" | "round" | "trunc" |
Returns​
default
<TType
, TContext
, TOut
>
strict​
â–¸ strict(isStrict?
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
isStrict? | boolean |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
strip​
â–¸ strip(strip?
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
strip? | boolean |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
test​
â–¸ test(options
): default
<TType
, TContext
, TOut
>
Adds a test function to the schema's queue of tests. tests can be exclusive or non-exclusive.
- exclusive tests, will replace any existing tests of the same name.
- non-exclusive: can be stacked
If a non-exclusive test is added to a schema with an exclusive test of the same name the exclusive test is removed and further tests of the same name will be stacked.
If an exclusive test is added to a schema with non-exclusive tests of the same name the previous tests are removed and further tests of the same name will replace each other.
Parameters​
Name | Type |
---|---|
options | TestConfig <TType , TContext > |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
â–¸ test(test
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
test | TestFunction <TType , TContext > |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
â–¸ test(name
, test
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
name | string |
test | TestFunction <TType , TContext > |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
â–¸ test(name
, message
, test
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
name | string |
message | Message <{}> |
test | TestFunction <TType , TContext > |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
transform​
â–¸ transform(fn
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
fn | TransformFunction <default <TType , TContext , TOut >> |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
truncate​
â–¸ truncate(): default
<TType
, TContext
, TOut
>
Returns​
default
<TType
, TContext
, TOut
>
typeError​
â–¸ typeError(message
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
message | Message <{}> |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
validate​
â–¸ validate(value
, options?
): Promise
<TOut
>
Parameters​
Name | Type |
---|---|
value | any |
options? | ValidateOptions <TContext > |
Returns​
Promise
<TOut
>
Inherited from​
validateAt​
â–¸ validateAt(path
, value
, options?
): Promise
<TOut
>
Parameters​
Name | Type |
---|---|
path | string |
value | any |
options? | ValidateOptions <TContext > |
Returns​
Promise
<TOut
>
Inherited from​
validateSync​
â–¸ validateSync(value
, options?
): TOut
Parameters​
Name | Type |
---|---|
value | any |
options? | ValidateOptions <TContext > |
Returns​
TOut
Inherited from​
validateSyncAt​
â–¸ validateSyncAt(path
, value
, options?
): TOut
Parameters​
Name | Type |
---|---|
path | string |
value | any |
options? | ValidateOptions <TContext > |
Returns​
TOut
Inherited from​
when​
â–¸ when(options
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
options | ConditionOptions <default <TType , TContext , TOut >> |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
â–¸ when(keys
, options
): default
<TType
, TContext
, TOut
>
Parameters​
Name | Type |
---|---|
keys | string | string [] |
options | ConditionOptions <default <TType , TContext , TOut >> |
Returns​
default
<TType
, TContext
, TOut
>
Inherited from​
withMutation​
â–¸ withMutation<T
>(fn
): T
Type parameters​
Name |
---|
T |
Parameters​
Name | Type |
---|---|
fn | (schema : default <TType , TContext , TOut >) => T |
Returns​
T