Skip to content

Move snapshotting behaviour into the types #83

@thegedge

Description

@thegedge

Based on this comment, we could move a lot of the MQT snapshotting behaviour into the types themselves. That way we could avoid hardcoding a ton of logic in a single function, like how we deal with snapshotting references in an array/map:

const type = getType(value) as MapType<IAnyType>;
const childrenAreReferences = isReferenceType(type.childrenType);
return Object.fromEntries(
Array.from(value.entries()).map(([k, v]) => {
return [k, childrenAreReferences ? v[$identifier] : snapshot(v)];
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorAn improvement to the implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions