@protobuf-ts/runtime
Version:
Runtime library for code generated by the protoc plugin "protobuf-ts"
26 lines (25 loc) • 1.08 kB
TypeScript
import type { MessageInfo } from "./reflection-info";
import type { PartialMessage } from "./message-type-contract";
/**
* Copy partial data into the target message.
*
* If a singular scalar or enum field is present in the source, it
* replaces the field in the target.
*
* If a singular message field is present in the source, it is merged
* with the target field by calling mergePartial() of the responsible
* message type.
*
* If a repeated field is present in the source, its values replace
* all values in the target array, removing extraneous values.
* Repeated message fields are copied, not merged.
*
* If a map field is present in the source, entries are added to the
* target map, replacing entries with the same key. Entries that only
* exist in the target remain. Entries with message values are copied,
* not merged.
*
* Note that this function differs from protobuf merge semantics,
* which appends repeated fields.
*/
export declare function reflectionMergePartial<T extends object>(info: MessageInfo, target: T, source: PartialMessage<T>): void;