+22
-4
lib/mod.ts
+22
-4
lib/mod.ts
···
1534
1534
* @returns structured message schema
1535
1535
*/
1536
1536
// #__NO_SIDE_EFFECTS__
1537
-
export const message = <TShape extends LooseMessageShape, TTags extends Record<keyof TShape, number>>(
1537
+
export const message = <TShape extends LooseMessageShape, const TTags extends Record<keyof TShape, number>>(
1538
1538
shape: TShape,
1539
1539
tags: TTags,
1540
1540
): MessageSchema<TShape, TTags> => {
···
1881
1881
* encoded as a count of seconds and fractions of seconds at nanosecond
1882
1882
* resolution.
1883
1883
*/
1884
-
export const Timestamp = /*#__PURE__*/ message({
1884
+
export const Timestamp: MessageSchema<{
1885
+
seconds: OptionalSchema<Int64Schema, 0n>;
1886
+
nanos: OptionalSchema<Int32Schema, 0>;
1887
+
}, {
1888
+
readonly seconds: 1;
1889
+
readonly nanos: 2;
1890
+
}> = /*#__PURE__*/ message({
1885
1891
seconds: /*#__PURE__*/ optional(/*#__PURE__*/ int64(), 0n),
1886
1892
nanos: /*#__PURE__*/ optional(/*#__PURE__*/ int32(), 0),
1887
1893
}, {
···
1893
1899
* represents a signed, fixed-length span of time represented as a count of
1894
1900
* seconds and fractions of seconds at nanosecond resolution.
1895
1901
*/
1896
-
export const Duration = /*#__PURE__*/ message({
1902
+
export const Duration: MessageSchema<{
1903
+
seconds: OptionalSchema<Int64Schema, 0n>;
1904
+
nanos: OptionalSchema<Int32Schema, 0>;
1905
+
}, {
1906
+
readonly seconds: 1;
1907
+
readonly nanos: 2;
1908
+
}> = /*#__PURE__*/ message({
1897
1909
seconds: /*#__PURE__*/ optional(/*#__PURE__*/ int64(), 0n),
1898
1910
nanos: /*#__PURE__*/ optional(/*#__PURE__*/ int32(), 0),
1899
1911
}, {
···
1905
1917
* contains an arbitrary serialized protocol buffer message along with a URL
1906
1918
* that describes the type of the serialized message.
1907
1919
*/
1908
-
export const Any = /*#__PURE__*/ message({
1920
+
export const Any: MessageSchema<{
1921
+
typeUrl: OptionalSchema<StringSchema, ''>;
1922
+
value: OptionalSchema<BytesSchema, Uint8Array<ArrayBuffer>>;
1923
+
}, {
1924
+
readonly typeUrl: 1;
1925
+
readonly value: 2;
1926
+
}> = /*#__PURE__*/ message({
1909
1927
typeUrl: /*#__PURE__*/ optional(/*#__PURE__*/ string(), ''),
1910
1928
value: /*#__PURE__*/ optional(/*#__PURE__*/ bytes(), /*#__PURE__*/ new Uint8Array(0)),
1911
1929
}, {