ts-fortress
    Preparing search index...

    Function strictRecord

    • Creates a strict record type that rejects excess properties. This is an alias for record(shape, { excessProperty: 'reject' }).

      Type Parameters

      Parameters

      • shape: S
      • Optionaloptions: Partial<Readonly<{ typeName: string }>>

      Returns Readonly<
          {
              assertIs: (
                  a: unknown,
              ) => asserts a is RecordTypeFromShapeImplSub<S, OptionalTypeKeys<S>>;
              cast: (a: unknown) => RecordTypeFromShapeImplSub;
              defaultValue: RecordTypeFromShapeImplSub;
              fill: (a: unknown) => RecordTypeFromShapeImplSub;
              is: (
                  a: unknown,
              ) => a is RecordTypeFromShapeImplSub<S, OptionalTypeKeys<S>>;
              prune: <
                  B extends
                      | Readonly<{ [key in string | number | symbol]: TypeOf<S[key]> }>
                      | MergeIntersection<
                          Readonly<
                              { [key in string
                              | number
                              | symbol]?: TypeOf<(...)[(...)]> },
                          >,
                      >
                      | MergeIntersection<
                          Readonly<
                              { [key in string
                              | number
                              | symbol]?: TypeOf<(...)> } & {
                                  [key in string | number | symbol]: TypeOf<(...)[(...)]>
                              },
                          >,
                      >,
              >(
                  a: B,
              ) => RecordTypeFromShapeImplSub;
              typeName: string;
              validate: (
                  a: unknown,
              ) => Result<
                  RecordTypeFromShapeImplSub<S, OptionalTypeKeys<S>>,
                  readonly Readonly<
                      {
                          actualValue: unknown;
                          details?: ValidationErrorDetails;
                          expectedType: string;
                          path: readonly string[];
                          typeName: string;
                      },
                  >[],
              >;
          },
      > & Readonly<{ shape: S }>