Skip to content

Commit

Permalink
Other: Fixed obvious issues with ext/descriptor, does not throw anymo…
Browse files Browse the repository at this point in the history
…re when throwing descriptor.proto itself at it, see #757
  • Loading branch information
dcodeIO committed Apr 13, 2017
1 parent b355115 commit 1fc911c
Show file tree
Hide file tree
Showing 5 changed files with 330 additions and 126 deletions.
4 changes: 2 additions & 2 deletions cli/lib/tsd-jsdoc/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ function getTypeOf(element) {
// begins writing the definition of the specified element
function begin(element, is_interface) {
writeComment(element.comment, is_interface || isInterface(element) || isClassLike(element) || isNamespace(element) || element.isEnum);
if (element.scope !== "global" || options.module || is_interface || isInterface(element))
if (element.scope !== "global" || options.module)
return;
write("export ");
}
Expand Down Expand Up @@ -543,7 +543,7 @@ function handleTypeDef(element, parent) {
}
} else {
// see: https://github.com/dcodeIO/protobuf.js/issues/737
// begin(element, true);
// NO begin(element, true); - isn't exported
writeln();
write("type ", element.name);
if (element.templates && element.templates.length)
Expand Down
52 changes: 34 additions & 18 deletions ext/descriptor/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import * as $protobuf from "../..";

declare const descriptor: $protobuf.Namespace;

interface IFileDescriptorSet {
export interface IFileDescriptorSet {
file: IFileDescriptorProto[];
}

interface IFileDescriptorProto {
export interface IFileDescriptorProto {
name?: string;
package?: string;
dependency?: any;
Expand All @@ -21,7 +19,7 @@ interface IFileDescriptorProto {
syntax?: string;
}

interface IDescriptorProto {
export interface IDescriptorProto {
name?: string;
field?: IFieldDescriptorProto[];
extension?: IFieldDescriptorProto[];
Expand All @@ -34,25 +32,25 @@ interface IDescriptorProto {
reservedName?: string[];
}

interface IMessageOptions {
export interface IMessageOptions {
mapEntry?: boolean;
}

interface IExtensionRange {
export interface IExtensionRange {
start?: number;
end?: number;
}

interface IReservedRange {
export interface IReservedRange {
start?: number;
end?: number;
}

interface IFieldOptions {
export interface IFieldOptions {
packed?: boolean;
}

interface IFieldDescriptorProto {
export interface IFieldDescriptorProto {
name?: string;
number?: number;
label?: IFieldDescriptorProto_Label;
Expand All @@ -69,40 +67,58 @@ type IFieldDescriptorProto_Label = number;

type IFieldDescriptorProto_Type = number;

interface IEnumDescriptorProto {
export interface IEnumDescriptorProto {
name?: string;
value?: IEnumValueDescriptorProto[];
options?: IEnumOptions;
}

interface IEnumValueDescriptorProto {
export interface IEnumValueDescriptorProto {
name?: string;
number?: number;
options?: any;
}

interface IEnumOptions {
export interface IEnumOptions {
allowAlias?: boolean;
}

interface IOneofDescriptorProto {
export interface IOneofDescriptorProto {
name?: string;
options?: any;
}

interface IServiceDescriptorProto {
export interface IServiceDescriptorProto {
name?: string;
method?: IMethodDescriptorProto[];
options?: any;
}

interface IMethodDescriptorProto {
export interface IMethodDescriptorProto {
name?: string;
inputType?: string;
outputType?: string;
options?: any;
clientStreaming?: boolean;
serverStreaming?: boolean;
}

export = descriptor;
export const FileDescriptorSet: $protobuf.Type;
export const FileDescriptorProto: $protobuf.Type;
export const DescriptorProto: $protobuf.Type;
export const FieldDescriptorProto: $protobuf.Type;
export const OneofDescriptorProto: $protobuf.Type;
export const EnumDescriptorProto: $protobuf.Type;
export const ServiceDescriptorProto: $protobuf.Type;
export const EnumValueDescriptorProto: $protobuf.Type;
export const MethodDescriptorProto: $protobuf.Type;
export const FileOptions: $protobuf.Type;
export const MessageOptions: $protobuf.Type;
export const FieldOptions: $protobuf.Type;
export const OneofOptions: $protobuf.Type;
export const EnumOptions: $protobuf.Type;
export const EnumValueOptions: $protobuf.Type;
export const ServiceOptions: $protobuf.Type;
export const MethodOptions: $protobuf.Type;
export const UninterpretedOption: $protobuf.Type;
export const SourceCodeInfo: $protobuf.Type;
export const GeneratedCodeInfo: $protobuf.Type;
Loading

0 comments on commit 1fc911c

Please sign in to comment.