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

Classes in Atoms lose their functions after modification #69

Open
magneticflux- opened this issue May 4, 2020 · 0 comments · May be fixed by #71
Open

Classes in Atoms lose their functions after modification #69

magneticflux- opened this issue May 4, 2020 · 0 comments · May be fixed by #71

Comments

@magneticflux-
Copy link

Due to the way setKey is written, the original prototype is forgotten. This means all of the functions disappear as well.

export function setKey<T, K extends keyof T>(k: K, v: T[K], o: T): T {
if (k in o && structEq(v, o[k])) {
return o
} else {
// this is the fastest way to do it, see
// https://jsperf.com/focal-setkey-for-loop-vs-object-assign
const r: { [k in keyof T]: T[k] } = {} as any
for (const p in o) r[p] = o[p]
r[k] = v
return r
}
}

@magneticflux- magneticflux- linked a pull request Jun 16, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant