extend
@rotorsoft/act-root / act/src / extend
Function: extend()
extend<
S
,T
>(source
,schema
,target?
):Readonly
<S
&T
>
Defined in: libs/act/src/utils.ts:120
Extends the target payload with the source payload after validating the source.
Type Parameters
S
S
extends Record
<string
, unknown
>
T
T
extends Record
<string
, unknown
>
Parameters
source
Readonly
<S
>
The source object to validate and merge
schema
ZodType
<S
>
The Zod schema for the source
target?
Readonly
<T
>
(Optional) The target object to extend
Returns
Readonly
<S
& T
>
The merged and validated object
Example
const config = extend(envConfig, configSchema, defaultConfig);