API reference@evolu/commonType › createTypeErrorFormatter

function createTypeErrorFormatter<Error>(
  format: (
    error: Simplify<
      Omit<Error, "value"> & {
        value: string;
      }
    >,
  ) => string,
): TypeErrorFormatter<Error>;

Defined in: packages/common/src/Type.ts:671

Creates a formatter function for TypeError.

The formatter generates human-readable error messages using a custom formatting function and a safely stringified error value.

Example

const formatStringError = createTypeErrorFormatter<StringError>(
  (value) => `A value ${value} is not a string.`,
);