@karmaniverous/serify-deserify
    Preparing search index...

    Interface SerifyOptionTypeCallbacks<T>

    A pair of serifier/deserifier callbacks for a given type.

    The callbacks are declared with method syntax so that their parameters are checked bivariantly. This lets a strongly-typed callback (e.g. (value: bigint) => string) satisfy the [unknown, unknown] index signature inherited from SerifiableTypeMap without resorting to any.

    interface SerifyOptionTypeCallbacks<T extends [unknown, unknown]> {
        deserifier(value: T[1]): T[0];
        serifier(value: T[0]): T[1];
    }

    Type Parameters

    • T extends [unknown, unknown]

      The [UnserifiedType, SerifiedType] tuple of the target type.

    Index
    • Converts a serified value back into the target type.

      Parameters

      • value: T[1]

        The serified value, with its contents already deserified.

      Returns T[0]

      The deserified value.

    • Converts an unserifiable value of the target type into a serifiable one.

      Parameters

      • value: T[0]

        The unserified value.

      Returns T[1]

      The serified value. May itself contain unserified values, which will be serified recursively.