All files / validator/yupTypes number.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57                                                                                                                 
import { NumberLocale } from './Locale'
import { MixedSchema } from './mixed'
import { Refable } from './ref'
 
export interface NumberSchema<T extends number = number>
  extends MixedSchema<T> {
  /** 最小值 */
  min(limit: Refable<number>, message?: NumberLocale['min']): this
 
  /** 最大值 */
  max(limit: Refable<number>, message?: NumberLocale['max']): this
 
  /** 应小于 */
  lessThan(max: Refable<number>, message?: NumberLocale['lessThan']): this
 
  /** 应大于 */
  moreThan(min: Refable<number>, message?: NumberLocale['moreThan']): this
 
  /** 正数 */
  positive(message?: NumberLocale['positive']): this
 
  /** 负数 */
  negative(message?: NumberLocale['negative']): this
 
  /** 整数 */
  integer(message?: NumberLocale['integer']): this
 
  /** ID (positiveInteger 的别名) */
  id(message?: NumberLocale['id']): this
 
  /** 正整数 */
  positiveInteger(message?: NumberLocale['positiveInteger']): this
 
  /** 负整数 */
  negativeInteger(message?: NumberLocale['negativeInteger']): this
 
  /** 非正数 */
  nonPositive(message?: NumberLocale['nonPositive']): this
 
  /** 非负数 */
  nonNegative(message?: NumberLocale['nonNegative']): this
 
  /** 非正整数 */
  nonPositiveInteger(message?: NumberLocale['nonPositiveInteger']): this
 
  /** 非负整数 */
  nonNegativeInteger(message?: NumberLocale['nonNegativeInteger']): this
 
  truncate(): this
 
  round(type?: 'floor' | 'ceil' | 'trunc' | 'round'): this
}
 
export declare function number<T extends number = number>(
  payload?: (schema: NumberSchema<T>) => NumberSchema<T>,
): NumberSchema<T>