From 46aac75261bc24e865e561c7ceb19c42a4ba5858 Mon Sep 17 00:00:00 2001 From: Greg Curtis Date: Fri, 13 May 2022 13:10:40 -0400 Subject: [PATCH] fix: request.compiler_version is undefined (#140) When running with buf, request.compiler_version is undefined, which causes a TypeError when attempting to assign major, minor and patch. Fixes #139. --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index e8dec121..866eacfd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -116,7 +116,7 @@ for (const fileDescriptor of request.proto_file) { } } - const { major = 0, minor = 0, patch = 0 } = request.compiler_version; + const { major = 0, minor = 0, patch = 0 } = request.compiler_version ?? {}; const comments = [ `Generated by the protoc-gen-ts. DO NOT EDIT!`,