diff --git a/examples/flow/output/test/test_grpc_js.js b/examples/flow/output/test/test_grpc_js.js index be399ae..e8a87e2 100644 --- a/examples/flow/output/test/test_grpc_js.js +++ b/examples/flow/output/test/test_grpc_js.js @@ -3,12 +3,13 @@ import grpc from 'grpc' import pbFile from './pbFile.js' -type TestEnum = + +export type TestEnum = | 'ELEMENT_A' | 'ELEMENT_B' ; -type TestMessage = {| +export type TestMessage = {| a?: string; b?: number; c?: number; @@ -25,38 +26,38 @@ type TestMessage = {| ; |}; -type TestNoStreamRequest = {| +export type TestNoStreamRequest = {| message?: TestMessage; |}; -type TestNoStreamReply = {| +export type TestNoStreamReply = {| message?: TestMessage; err_msg?: string; |}; -type TestStreamRequestRequest = {| +export type TestStreamRequestRequest = {| message?: TestMessage; |}; -type TestStreamRequestReply = {| +export type TestStreamRequestReply = {| message?: TestMessage; err_msg?: string; |}; -type TestStreamReplyRequest = {| +export type TestStreamReplyRequest = {| message?: TestMessage; |}; -type TestStreamReplyReply = {| +export type TestStreamReplyReply = {| message?: TestMessage; err_msg?: string; |}; -type TestStreamBothRequest = {| +export type TestStreamBothRequest = {| message?: TestMessage; |}; -type TestStreamBothReply = {| +export type TestStreamBothReply = {| message?: TestMessage; err_msg?: string; |}; diff --git a/examples/flow/templates/{{.File.Package}}/{{.File.Package}}_grpc_js.js.tmpl b/examples/flow/templates/{{.File.Package}}/{{.File.Package}}_grpc_js.js.tmpl index b155759..8acd68d 100644 --- a/examples/flow/templates/{{.File.Package}}/{{.File.Package}}_grpc_js.js.tmpl +++ b/examples/flow/templates/{{.File.Package}}/{{.File.Package}}_grpc_js.js.tmpl @@ -3,11 +3,12 @@ {{$Package:=.File.Package}} import grpc from 'grpc' import pbFile from './pbFile.js' -{{range .File.EnumType}}type {{.Name}} = {{range .Value}} +{{range .File.EnumType}} +export type {{.Name}} = {{range .Value}} | '{{.Name}}'{{end}} ;{{end}} {{range .File.MessageType}} -type {{.Name}} = {|{{range .Field}} +export type {{.Name}} = {|{{range .Field}} {{.Name}}?: {{. | jsType}};{{end}}{{range .EnumType}} {{.Name}}?:{{range .Value}} | '{{.Name}}'{{end}}