alinea
Version:
[](https://npmjs.org/package/alinea) [](https://packagephobia.com/result?p=alinea)
27 lines (26 loc) • 1.21 kB
TypeScript
import { LinkResolver } from 'alinea/backend/resolver/LinkResolver';
import * as Y from 'yjs';
import { Label } from '../Label.js';
import { Shape } from '../Shape.js';
export type RecordMutator<T> = {
set: <K extends keyof T>(k: K, v: T[K]) => void;
};
export declare class RecordShape<T = object> implements Shape<T, RecordMutator<T>> {
label: Label;
properties: Record<string, Shape>;
initialValue?: T | undefined;
constructor(label: Label, properties: Record<string, Shape>, initialValue?: T | undefined);
innerTypes(parents: Array<string>): import("../Shape.js").ShapeInfo[];
concat<X>(that: RecordShape<X> | undefined): RecordShape<T & X>;
create(): T;
typeOfChild<C>(yValue: T, child: string): Shape<C>;
toY(value: T): Y.Map<unknown>;
fromY(map: Y.Map<any>): T;
applyY(value: T, map: Y.Doc | Y.Map<any>, key: string): undefined;
init(parent: Y.Map<any>, key: string): void;
watch(parent: Y.Map<any>, key: string): (fun: () => void) => () => any;
mutator(parent: Y.Map<any>, key: string, readOnly: boolean): {
set: <K extends keyof T>(k: K, v: T[K]) => void;
};
applyLinks(value: T, loader: LinkResolver): Promise<void>;
}