ts-proto 2.11.4 → 2.11.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -47,9 +47,9 @@ function generateMethodDefinition(ctx, methodDesc) {
|
|
|
47
47
|
return (0, ts_poet_1.code) `
|
|
48
48
|
{
|
|
49
49
|
name: '${methodDesc.name}',
|
|
50
|
-
requestType: ${inputType},
|
|
50
|
+
requestType: ${inputType} as typeof ${inputType},
|
|
51
51
|
requestStream: ${methodDesc.clientStreaming},
|
|
52
|
-
responseType: ${outputType},
|
|
52
|
+
responseType: ${outputType} as typeof ${outputType},
|
|
53
53
|
responseStream: ${methodDesc.serverStreaming},
|
|
54
54
|
options: ${generateMethodOptions(ctx, methodDesc.options)}
|
|
55
55
|
}
|
|
@@ -72,7 +72,7 @@ function generateMethodOptions(ctx, options) {
|
|
|
72
72
|
const values = options._unknownFields[key];
|
|
73
73
|
const valuesChunks = [];
|
|
74
74
|
for (const value of values) {
|
|
75
|
-
valuesChunks.push((0, ts_poet_1.code) `${ctx.options.env == "node" ? "Buffer.from" : "new Uint8Array"}([${value.join(", ")}])`);
|
|
75
|
+
valuesChunks.push((0, ts_poet_1.code) `${ctx.options.env == "node" ? "Buffer.from" : "new Uint8Array"}([${value.join(", ")}]) as ${ctx.options.env == "node" ? "Buffer" : "Uint8Array"}`);
|
|
76
76
|
}
|
|
77
77
|
unknownFieldsChunks.push((0, ts_poet_1.code) `${key}: [\n${(0, ts_poet_1.joinCode)(valuesChunks, { on: "," })}\n],`);
|
|
78
78
|
}
|
|
@@ -61,9 +61,9 @@ function generateServiceDefinition(ctx, fileDesc, sourceInfo, serviceDesc) {
|
|
|
61
61
|
const outputDecoder = (0, encode_1.generateDecoder)(ctx, methodDesc.outputType);
|
|
62
62
|
chunks.push((0, ts_poet_1.code) `
|
|
63
63
|
${methodDesc.formattedName}: {
|
|
64
|
-
path: '/${(0, utils_1.maybePrefixPackage)(fileDesc, serviceDesc.name)}/${methodDesc.name}',
|
|
65
|
-
requestStream: ${methodDesc.clientStreaming},
|
|
66
|
-
responseStream: ${methodDesc.serverStreaming},
|
|
64
|
+
path: '/${(0, utils_1.maybePrefixPackage)(fileDesc, serviceDesc.name)}/${methodDesc.name}' as const,
|
|
65
|
+
requestStream: ${methodDesc.clientStreaming} as const,
|
|
66
|
+
responseStream: ${methodDesc.serverStreaming} as const,
|
|
67
67
|
requestSerialize: (value: ${inputType}): Buffer =>
|
|
68
68
|
Buffer.from(${inputEncoder}),
|
|
69
69
|
requestDeserialize: (value: Buffer): ${inputType} => ${inputDecoder},
|