diff --git a/src/main.ts b/src/main.ts index a6468fadb..c199528b2 100644 --- a/src/main.ts +++ b/src/main.ts @@ -436,7 +436,7 @@ export function makeUtils(options: Options): Utils { ...makeTimestampMethods(options, longs, bytes), ...longs, ...makeComparisonUtils(), - ...makeNiceGrpcServerStreamingMethodResult(), + ...makeNiceGrpcServerStreamingMethodResult(options), ...makeGrpcWebErrorClass(bytes), ...makeExtensionClass(options), ...makeAssertionUtils(bytes), @@ -872,14 +872,20 @@ function makeComparisonUtils() { return { isObject, isSet }; } -function makeNiceGrpcServerStreamingMethodResult() { +function makeNiceGrpcServerStreamingMethodResult(options: Options) { const NiceGrpcServerStreamingMethodResult = conditionalOutput( "ServerStreamingMethodResult", - code` - export type ServerStreamingMethodResult = { - [Symbol.asyncIterator](): AsyncIterator; - }; - `, + options.outputIndex + ? code` + type ServerStreamingMethodResult = { + [Symbol.asyncIterator](): AsyncIterator; + }; + ` + : code` + export type ServerStreamingMethodResult = { + [Symbol.asyncIterator](): AsyncIterator; + }; + `, ); return { NiceGrpcServerStreamingMethodResult };