import type { BasePath, BasePathArray, PathFn } from '../global/path.js'; import type { PropFn } from '../global/prop.js'; import type { List, Obj, Path } from '../internal/types/tools/index.js'; declare const objWith: { /** * Returns a new object with the specified property set to the given value. * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. * @param prop Property name or `prop` function representing the property to set. * @param value Value to set. * * @example * ```typescript * const obj = { a: 1, b: 2, c: { d: [{ e: 3 }] } }; * objWith(obj, 'a', 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * objWith(obj, prop('a'), 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * objWith(obj, path('c.d[0].e'), 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * objWith(obj, ['c', 'd', '0', 'e'], 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * ``` */ < O extends object, const K extends { [P in keyof O]: O[P] extends PropertyKey ? P : never; }[keyof O], >( o: O, prop: K | PropFn, value: O[K], ): O; /** * Returns a new object with the specified property set to the given value. * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. * @param path Property path or `path` function representing the property to set. * @param value Value to set. * * @example * ```typescript * const obj = { a: 1, b: 2, c: { d: [{ e: 3 }] } }; * objWith(obj, 'a', 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * objWith(obj, prop('a'), 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * objWith(obj, path('c.d[0].e'), 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * objWith(obj, ['c', 'd', '0', 'e'], 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * ``` */ | BasePathArray>( o: O, path: PathFn, value: Obj.Get extends List ? Path : never>, ): O; /** * Returns a new object with the specified property set to the given value. * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. * @param path Property path or `path` function representing the property to set. * @param value Value to set. * * @example * ```typescript * const obj = { a: 1, b: 2, c: { d: [{ e: 3 }] } }; * objWith(obj, 'a', 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * objWith(obj, prop('a'), 2); // => { a: 2, b: 2, c: { d: [{ e: 3 }] } } * objWith(obj, path('c.d[0].e'), 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * objWith(obj, ['c', 'd', '0', 'e'], 4); // => { a: 1, b: 2, c: { d: [{ e: 4 }] } } * ``` */ >( o: O, path: PP, value: Obj.Get extends List ? Path : never>, ): O; }; export default objWith; //# sourceMappingURL=with.d.ts.map