Export types

This commit is contained in:
Mathieu Acthernoene 2017-01-06 11:41:42 +01:00
parent ab2a5d5181
commit 37d97c5693
2 changed files with 14 additions and 12 deletions

View File

@ -3,12 +3,13 @@
import grpc from 'grpc' import grpc from 'grpc'
import pbFile from './pbFile.js' import pbFile from './pbFile.js'
type TestEnum =
export type TestEnum =
| 'ELEMENT_A' | 'ELEMENT_A'
| 'ELEMENT_B' | 'ELEMENT_B'
; ;
type TestMessage = {| export type TestMessage = {|
a?: string; a?: string;
b?: number; b?: number;
c?: number; c?: number;
@ -25,38 +26,38 @@ type TestMessage = {|
; ;
|}; |};
type TestNoStreamRequest = {| export type TestNoStreamRequest = {|
message?: TestMessage; message?: TestMessage;
|}; |};
type TestNoStreamReply = {| export type TestNoStreamReply = {|
message?: TestMessage; message?: TestMessage;
err_msg?: string; err_msg?: string;
|}; |};
type TestStreamRequestRequest = {| export type TestStreamRequestRequest = {|
message?: TestMessage; message?: TestMessage;
|}; |};
type TestStreamRequestReply = {| export type TestStreamRequestReply = {|
message?: TestMessage; message?: TestMessage;
err_msg?: string; err_msg?: string;
|}; |};
type TestStreamReplyRequest = {| export type TestStreamReplyRequest = {|
message?: TestMessage; message?: TestMessage;
|}; |};
type TestStreamReplyReply = {| export type TestStreamReplyReply = {|
message?: TestMessage; message?: TestMessage;
err_msg?: string; err_msg?: string;
|}; |};
type TestStreamBothRequest = {| export type TestStreamBothRequest = {|
message?: TestMessage; message?: TestMessage;
|}; |};
type TestStreamBothReply = {| export type TestStreamBothReply = {|
message?: TestMessage; message?: TestMessage;
err_msg?: string; err_msg?: string;
|}; |};

View File

@ -3,11 +3,12 @@
{{$Package:=.File.Package}} {{$Package:=.File.Package}}
import grpc from 'grpc' import grpc from 'grpc'
import pbFile from './pbFile.js' import pbFile from './pbFile.js'
{{range .File.EnumType}}type {{.Name}} = {{range .Value}} {{range .File.EnumType}}
export type {{.Name}} = {{range .Value}}
| '{{.Name}}'{{end}} | '{{.Name}}'{{end}}
;{{end}} ;{{end}}
{{range .File.MessageType}} {{range .File.MessageType}}
type {{.Name}} = {|{{range .Field}} export type {{.Name}} = {|{{range .Field}}
{{.Name}}?: {{. | jsType}};{{end}}{{range .EnumType}} {{.Name}}?: {{. | jsType}};{{end}}{{range .EnumType}}
{{.Name}}?:{{range .Value}} {{.Name}}?:{{range .Value}}
| '{{.Name}}'{{end}} | '{{.Name}}'{{end}}