import { PathItem, Query, ILens } from './types.js'; import { Type, Expect } from 'free-types-core'; import { Next } from './utils.js'; import { ModifyPath } from './Modify.js'; import { Lens } from './Lens.js'; import { FollowPath, NOT_FOUND } from './Follow.js'; export { Replace, $Replace }; type Replace> = [ Q ] extends [never] ? Data : _Replace, Data, V>; type ValidValue['path']> = [ Q ] extends [never] ? unknown : Path extends [...any[], infer $T extends Expect] ? $T['constraints'] : Path extends [...any[], infer $T extends Expect, infer N extends number] ? $T['constraints'][N] : unknown; type _Replace> = I extends L['path']['length'] ? V : F extends NOT_FOUND ? Data : ModifyPath>>; interface $Replace> extends Type<1> { type: _Replace, this[0], V>; }