ProtobufMessageType
Это содержимое пока не доступно на вашем языке.
Defined in: src/serialization/ProtobufSerializerOptions.ts:51
The slice of a Protobuf message type that ProtobufSerializer
uses. Declared structurally rather than imported from protobufjs,
the same call zodCodec makes with ParserLike: the schema belongs to
the user’s project, so actor-ts neither pins a library version nor
lazily imports something it never calls itself.
Why a message type and not a .proto path. Loading .proto at
runtime would mean filesystem access — unavailable in a browser, behind
a permission prompt on Deno, and a deployment concern everywhere
(the file has to ship next to the bundle). Taking the compiled type
pushes that choice to the user, who can reach it three ways without a
build step being mandatory:
// 1. parse a .proto source string at startup (no filesystem)const root = protobuf.parse(protoSource).root;const messageType = root.lookupType('Order');
// 2. a JSON descriptor bundled with the appconst messageType = protobuf.Root.fromJSON(descriptor).lookupType('Order');
// 3. generated static code (pbjs, ts-proto) — shape matches tooimport { Order } from './generated/order.js';verify and toObject exist only on protobufjs’s reflection types,
so both are optional here and generated static code still fits.
decode returns unknown, not T, on purpose. A reflection Type
decodes to a dynamic Message that TypeScript cannot see the fields of,
so declaring T there would make root.lookupType('Order') — the
documented way to get a message type — fail to typecheck. The cast to
T happens once, inside fromBinary, which is also where the plain-
object conversion decides what the value actually is.
Type Parameters
Section titled “Type Parameters”T = unknown
Properties
Section titled “Properties”fullName?
Section titled “fullName?”
readonlyoptionalfullName?:string
Defined in: src/serialization/ProtobufSerializerOptions.ts:61
Fully-qualified message name, used as the default manifest when set.
Methods
Section titled “Methods”decode()
Section titled “decode()”decode(
bytes):unknown
Defined in: src/serialization/ProtobufSerializerOptions.ts:55
Decode bytes back into a dynamic message.
Parameters
Section titled “Parameters”Uint8Array
Returns
Section titled “Returns”unknown
encode()
Section titled “encode()”encode(
message):ProtobufWriter
Defined in: src/serialization/ProtobufSerializerOptions.ts:53
Encode a message into a writer; finish() produces the bytes.
Parameters
Section titled “Parameters”message
Section titled “message”T
Returns
Section titled “Returns”toObject()?
Section titled “toObject()?”
optionaltoObject(message,options?):Record<string,unknown>
Defined in: src/serialization/ProtobufSerializerOptions.ts:59
Reflection only: convert a decoded message into a plain object.
Parameters
Section titled “Parameters”message
Section titled “message”unknown
options?
Section titled “options?”Returns
Section titled “Returns”Record<string, unknown>
verify()?
Section titled “verify()?”
optionalverify(message):string|null
Defined in: src/serialization/ProtobufSerializerOptions.ts:57
Reflection only: returns a reason string when the message doesn’t match the schema.
Parameters
Section titled “Parameters”message
Section titled “message”T
Returns
Section titled “Returns”string | null
