Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move snapshotting behaviour into the types #83

Open
thegedge opened this issue May 9, 2024 · 0 comments
Open

Move snapshotting behaviour into the types #83

thegedge opened this issue May 9, 2024 · 0 comments
Labels
refactor An improvement to the implementation

Comments

@thegedge
Copy link
Contributor

thegedge commented May 9, 2024

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)];
})

@thegedge thegedge added the refactor An improvement to the implementation label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor An improvement to the implementation
Projects
None yet
Development

No branches or pull requests

1 participant