From 37d97c5693d12697315b2a270c7fbfb9b1d492cf Mon Sep 17 00:00:00 2001 From: Mathieu Acthernoene Date: Fri, 6 Jan 2017 11:41:42 +0100 Subject: [PATCH] Export types --- examples/flow/output/test/test_grpc_js.js | 21 ++++++++++--------- .../{{.File.Package}}_grpc_js.js.tmpl | 5 +++-- 2 files changed, 14 insertions(+), 12 deletions(-) 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}}