Skip to content

Commit f551a24

Browse files
committed
Add support for BoolValue
1 parent fa05ee7 commit f551a24

File tree

5 files changed

+9
-2
lines changed

5 files changed

+9
-2
lines changed

examples/basic/basic.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import "google/protobuf/empty.proto";
3838
import "google/protobuf/descriptor.proto";
3939
import "google/protobuf/struct.proto";
4040
import "google/protobuf/any.proto";
41+
import "google/protobuf/wrappers.proto";
4142

4243
package basic;
4344

@@ -83,6 +84,7 @@ message OptionalFields {
8384
repeated Nested a_repeated_message = 4;
8485
repeated string a_repeated_string = 5;
8586
optional google.protobuf.Any anyValue = 13;
87+
optional google.protobuf.BoolValue boolValue = 14;
8688
}
8789

8890
message HasExtensions {

examples/basic/protocol/basic.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export interface OptionalFields {
4848
aRepeatedMessage?: OptionalFields_Nested[];
4949
aRepeatedString?: string[];
5050
anyValue?: unknown;
51+
boolValue?: boolean;
5152
}
5253

5354
export interface HasExtensions {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ollion/protobufjs-typescript-gen",
3-
"version": "2.0.6",
3+
"version": "2.0.7",
44
"main": "dist/index.js",
55
"author": "Nikhil Verma <[email protected]>",
66
"license": "MIT",

src/services.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ function getServiceTypeInfo(
6969
case '.google.protobuf.ListValue':
7070
return { code: 'any[]', import: null };
7171

72+
case '.google.protobuf.BoolValue':
73+
return { code: 'boolean', import: null };
74+
7275
case '.google.protobuf.Struct':
7376
return { code: 'Record<string, any>', import: null };
7477

src/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function getCommentBlock(object: ReflectionObject) {
2525
export function getImport(
2626
object: ReflectionObject,
2727
targetObject: ReflectionObject | null,
28-
options: ProtoGenOptions
28+
options: ProtoGenOptions,
2929
) {
3030
if (!targetObject) {
3131
return null;
@@ -126,6 +126,7 @@ export function fieldToTypescriptType(field: FieldBase, options: ProtoGenOptions
126126
break;
127127

128128
case 'bool':
129+
case 'google.protobuf.BoolValue':
129130
type = 'boolean';
130131
break;
131132

0 commit comments

Comments
 (0)