zeed
    Preparing search index...

    Class Type<T>

    Core Type class for schema validation and type inference Implements StandardSchemaV1 for cross-library compatibility

    Type Parameters

    • T = unknown
    Index

    Constructors

    Properties

    _args?: any
    _check?: (obj: any) => boolean
    _default?: any
    _enumValues?: any
    _info?: any
    _meta?: TypeMeta
    _object?: any
    _optional?: boolean
    _ret?: any
    _type?: any
    _union?: any
    type: string

    Accessors

    • get "~standard"(): any

      Standard Schema V1 compliance property Provides a standard interface for validation and type inference

      Returns any

    Methods

    • Sets a default value for the type, which will be used if the value is not provided The default value can be a function that receives the schema as argument, or a static value.

      Parameters

      • value: T | ((schema?: this) => T)

      Returns Type<T>

    • Extends the type with an object, merging the properties

      Type Parameters

      • O

      Parameters

      • obj: O

      Returns Type<
          T & Extract<
              {
                  [K in string
                  | number
                  | symbol]: TypeObjectFixOptional<
                      { [K in string
                      | number
                      | symbol]: Infer<O[K]> },
                  >[K]
              },
              unknown,
          >,
      >

    • Omits certain keys from an object schema

      Type Parameters

      • K extends string | number | symbol

      Parameters

      • keys: Record<K, true>

      Returns Type<Omit<T, K>>

    • Marks the type as optional, meaning it can be undefined This is useful for properties that are not required.

      Returns Type<T | undefined>

    • Makes some or all properties of an object schema optional

      Returns Type<Partial<T>>

    • Makes some or all properties of an object schema optional

      Type Parameters

      • K extends string | number | symbol

      Parameters

      • keys: Record<K, true>

      Returns Type<Partial<Pick<T, K>> & Omit<T, K>>

    • Picks certain keys from an object schema

      Type Parameters

      • K extends string | number | symbol

      Parameters

      • keys: Record<K, true>

      Returns Type<Pick<T, K>>

    • Makes some or all properties of an object schema required

      Returns Type<Required<T>>

    • Makes some or all properties of an object schema required

      Type Parameters

      • K extends string | number | symbol

      Parameters

      • keys: Record<K, true>

      Returns Type<Required<Pick<T, K>> & Omit<T, K>>

    • Validation method for standard-schema compliance

      Parameters

      • value: any

      Returns any