Skip to content

Commit 8439a39

Browse files
committed
update
1 parent b954a8f commit 8439a39

6 files changed

Lines changed: 101 additions & 0 deletions

File tree

examples/proto/status.proto

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
syntax = "proto3";
2+
3+
import "google/protobuf/timestamp.proto";
4+
5+
package status;
6+
7+
message Status {
8+
google.protobuf.Timestamp created_at = 1;
9+
}

examples/proto/status_pb.d.ts

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/proto/test_proto.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { UserSchema } from './user_pb.js'
2+
import { StatusSchema } from './status_pb.js'
3+
import { create, fromBinary, toBinary } from '@bufbuild/protobuf'
4+
import assert from 'node:assert'
5+
6+
let msg = create(UserSchema, {
7+
name: 'hello world',
8+
status: create(StatusSchema, { createdAt: new Date() }),
9+
})
10+
11+
// Reference the inherited `.toBinary()` to ensure types from transitive types are included.
12+
msg = fromBinary(UserSchema, toBinary(UserSchema, msg))
13+
14+
assert.equal(msg.name, 'hello world')

examples/proto/user.proto

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
syntax = "proto3";
2+
3+
import "status.proto";
4+
5+
message User {
6+
string name = 1;
7+
status.Status status = 2;
8+
repeated string tags = 3;
9+
}

examples/proto/user_pb.d.ts

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ bzl_library(
2828
visibility = ["//visibility:public"],
2929
deps = [
3030
"//js/private:proto",
31+
"@bazel_skylib//rules:select_file",
3132
"@diff.bzl//diff:defs",
3233
"@protobuf//bazel/toolchains:proto_lang_toolchain_bzl",
3334
],

0 commit comments

Comments
 (0)