Documentation
    Preparing search index...

    Interface ComponentSerializerShape<T>

    The structural shape of @fourjs/serialization's ComponentSerializer<T>.

    Declared with method syntax, exactly as the original is, because TypeScript's methods are bivariant in their parameters — which is what lets a serializer for one concrete component type be stored in a registry that hands out serializers for Component. node is unknown rather than Node: this serializer does not use it, and unknown accepts whatever the registry passes.

    interface ComponentSerializerShape<T> {
        deserialize(data: JsonValue, node: unknown): T;
        serialize(component: T): JsonValue;
    }

    Type Parameters

    • T
    Index
    • Rebuilds the component from a payload. Attaching is the caller's job.

      Parameters

      Returns T

    • Produces the component's payload; must be representable JSON.

      Parameters

      • component: T

      Returns JsonValue