A = (obj, prop, factory) => {
	const value = obj[prop];
	if (value === undefined) {
		obj[prop] = factory();
	} else if (Array.isArray(value)) {
		/** @type {EXPECTED_ANY[] | undefined} */
		let newArray;
		for (let i = 0; i < value.length; i++) {
			const item = value[i];
			if (item === "...") {
				if (newArray === undefined) {
					newArray = value.slice(0, i);
					obj[prop] = /** @type {T[P]} */ (/** @type {unknown} */ (newArray));
				}
				const items = /** @type {EXPECTED_ANY[]} */ (
					/** @type {unknown} */ (factory())
				);
				if (items !== undefined) {
					for (const item of items) {
						newArray.push(item);
					}
				}
			} else if (newArray !== undefined) {
				newArray.push(item);
			}
		}
	}
}
Sets a dynamic default value when undefined, by calling the factory function.
factory must return an array or undefined
When the current value is already an array an contains "..." it's replaced with
the result of the factory function
@template T
@template {keyof T} P
@param {T} obj an object
@param {P} prop a property of this object
@param {() => T[P]} factory a default value factory for the property
@returns {void}