Skip to content

Commit

Permalink
fix noImplicitReturns error in Value.unwrap
Browse files Browse the repository at this point in the history
Fixes #432
  • Loading branch information
boukeversteegh authored Dec 8, 2021
1 parent 488e564 commit e58da74
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1370,19 +1370,20 @@ function generateUnwrap(fullProtoTypeName: string): Code[] {

if (isAnyValueTypeName(fullProtoTypeName)) {
chunks.push(code`unwrap(message: Value): string | number | boolean | Object | null | Array<any> | undefined {
if (message.stringValue !== undefined) {
if (message?.stringValue !== undefined) {
return message.stringValue;
} else if (message.numberValue !== undefined) {
} else if (message?.numberValue !== undefined) {
return message.numberValue;
} else if (message.boolValue !== undefined) {
} else if (message?.boolValue !== undefined) {
return message.boolValue;
} else if (message.structValue !== undefined) {
} else if (message?.structValue !== undefined) {
return message.structValue;
} else if (message.listValue !== undefined) {
} else if (message?.listValue !== undefined) {
return message.listValue;
} else if (message.nullValue !== undefined) {
} else if (message?.nullValue !== undefined) {
return null;
}
return undefined;
}`);
}

Expand Down

0 comments on commit e58da74

Please sign in to comment.