Skip to content

Classes in Atoms lose their functions after modification #69

Open
@magneticflux-

Description

@magneticflux-

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
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions