corps/json-delta

ReadonlyArray Type not supported

jantimon opened this issue · 0 comments

applyDiff creates a shallowCopy so it does not modify the input.
However it does not accept read only data structures.

Would it be possible to change that e.g.:

interface JsonMap {
  [key: string]: Readonly<AnyJson>;
}
interface JsonArray extends ReadonlyArray<AnyJson> {}

It would also be nice to return the input type:

export function applyDiff<T extends AnyJson>(o: T, d: Diff | void): T {