Skip to content

Commit

Permalink
Ensure consistent null in missing file names
Browse files Browse the repository at this point in the history
  • Loading branch information
murgatroid99 committed Dec 9, 2021
1 parent 8d77104 commit 2af9a05
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/proto-loader/bin/proto-loader-gen-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ function generateMessageInterfaces(formatter: TextFormatter, messageType: Protob
let usesLong: boolean = false;
let seenDeps: Set<string> = new Set<string>();
const childTypes = getChildMessagesAndEnums(messageType);
formatter.writeLine(`// Original file: ${messageType.filename?.replace(/\\/g, '/')}`);
formatter.writeLine(`// Original file: ${(messageType.filename ?? 'null')?.replace(/\\/g, '/')}`);
formatter.writeLine('');
messageType.fieldsArray.sort((fieldA, fieldB) => fieldA.id - fieldB.id);
for (const field of messageType.fieldsArray) {
Expand Down Expand Up @@ -437,7 +437,7 @@ function generateMessageInterfaces(formatter: TextFormatter, messageType: Protob
}

function generateEnumInterface(formatter: TextFormatter, enumType: Protobuf.Enum, options: GeneratorOptions, nameOverride?: string) {
formatter.writeLine(`// Original file: ${enumType.filename?.replace(/\\/g, '/')}`);
formatter.writeLine(`// Original file: ${(enumType.filename ?? 'null')?.replace(/\\/g, '/')}`);
formatter.writeLine('');
if (options.includeComments) {
formatComment(formatter, enumType.comment);
Expand Down Expand Up @@ -590,7 +590,7 @@ function generateServiceDefinitionInterface(formatter: TextFormatter, serviceTyp
}

function generateServiceInterfaces(formatter: TextFormatter, serviceType: Protobuf.Service, options: GeneratorOptions) {
formatter.writeLine(`// Original file: ${serviceType.filename?.replace(/\\/g, '/')}`);
formatter.writeLine(`// Original file: ${(serviceType.filename ?? 'null')?.replace(/\\/g, '/')}`);
formatter.writeLine('');
const grpcImportPath = options.grpcLib.startsWith('.') ? getPathToRoot(serviceType) + options.grpcLib : options.grpcLib;
formatter.writeLine(`import type * as grpc from '${grpcImportPath}'`);
Expand Down

0 comments on commit 2af9a05

Please sign in to comment.