Type.Intersect

Creates an Intersect type.

Example

Example usage is shown below.

const T = Type.Intersect([                          // const T = {
  Type.Object({ x: Type.Number() }),                //   allOf: [{
  Type.Object({ y: Type.Number() }),                //     type: 'object',
])                                                  //     required: ['x'],
                                                    //     properties: {
                                                    //       x: { type: 'number' }
                                                    //     }
                                                    //  }, {
                                                    //    type: 'object',
                                                    //    required: ['y'],
                                                    //    properties: {
                                                    //      y: { type: 'number' }
                                                    //    }
                                                    //  }]
                                                    // }

type T = Static<typeof T>                           // type T = { 
                                                    //   x: number
                                                    // } & {
                                                    //   y: number
                                                    // }

Guard

Use the IsIntersect function to guard values of this type.

Type.IsIntersect(value)                             // value is TIntersect

Options

export interface TIntersectOptions extends TSchemaOptions {
  /** 
   * A schema to apply to any properties in the object that were not validated 
   * by other keywords like `properties`, `patternProperties`, or `additionalProperties`. 
   * If `false`, no additional properties are allowed. 
   */
  unevaluatedProperties?: TSchema | boolean
}