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 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;
|};

View File

@ -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}}