Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 1x 1x 1x 2x | import {compareBy, DataClass} from "@lightningkite/khrysalis-runtime";
import {DataClassProperty} from "./DataClassProperty";
export function prop<K extends DataClass, KEY extends keyof K & string>(key: KEY): DataClassProperty<K, K[KEY]> {
return new DataClassProperty(
key,
x => x[key],
(a, b) => {
const dict: Partial<K> = {}
dict[key] = b
return a.copy(dict)
},
compareBy(x => x[key])
)
} |