Skip to content

Commit 1fc911c

Browse files
committed
Other: Fixed obvious issues with ext/descriptor, does not throw anymore when throwing descriptor.proto itself at it, see #757
1 parent b355115 commit 1fc911c

5 files changed

Lines changed: 330 additions & 126 deletions

File tree

cli/lib/tsd-jsdoc/publish.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ function getTypeOf(element) {
242242
// begins writing the definition of the specified element
243243
function begin(element, is_interface) {
244244
writeComment(element.comment, is_interface || isInterface(element) || isClassLike(element) || isNamespace(element) || element.isEnum);
245-
if (element.scope !== "global" || options.module || is_interface || isInterface(element))
245+
if (element.scope !== "global" || options.module)
246246
return;
247247
write("export ");
248248
}
@@ -543,7 +543,7 @@ function handleTypeDef(element, parent) {
543543
}
544544
} else {
545545
// see: https://github.com/dcodeIO/protobuf.js/issues/737
546-
// begin(element, true);
546+
// NO begin(element, true); - isn't exported
547547
writeln();
548548
write("type ", element.name);
549549
if (element.templates && element.templates.length)

ext/descriptor/index.d.ts

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import * as $protobuf from "../..";
22

3-
declare const descriptor: $protobuf.Namespace;
4-
5-
interface IFileDescriptorSet {
3+
export interface IFileDescriptorSet {
64
file: IFileDescriptorProto[];
75
}
86

9-
interface IFileDescriptorProto {
7+
export interface IFileDescriptorProto {
108
name?: string;
119
package?: string;
1210
dependency?: any;
@@ -21,7 +19,7 @@ interface IFileDescriptorProto {
2119
syntax?: string;
2220
}
2321

24-
interface IDescriptorProto {
22+
export interface IDescriptorProto {
2523
name?: string;
2624
field?: IFieldDescriptorProto[];
2725
extension?: IFieldDescriptorProto[];
@@ -34,25 +32,25 @@ interface IDescriptorProto {
3432
reservedName?: string[];
3533
}
3634

37-
interface IMessageOptions {
35+
export interface IMessageOptions {
3836
mapEntry?: boolean;
3937
}
4038

41-
interface IExtensionRange {
39+
export interface IExtensionRange {
4240
start?: number;
4341
end?: number;
4442
}
4543

46-
interface IReservedRange {
44+
export interface IReservedRange {
4745
start?: number;
4846
end?: number;
4947
}
5048

51-
interface IFieldOptions {
49+
export interface IFieldOptions {
5250
packed?: boolean;
5351
}
5452

55-
interface IFieldDescriptorProto {
53+
export interface IFieldDescriptorProto {
5654
name?: string;
5755
number?: number;
5856
label?: IFieldDescriptorProto_Label;
@@ -69,40 +67,58 @@ type IFieldDescriptorProto_Label = number;
6967

7068
type IFieldDescriptorProto_Type = number;
7169

72-
interface IEnumDescriptorProto {
70+
export interface IEnumDescriptorProto {
7371
name?: string;
7472
value?: IEnumValueDescriptorProto[];
7573
options?: IEnumOptions;
7674
}
7775

78-
interface IEnumValueDescriptorProto {
76+
export interface IEnumValueDescriptorProto {
7977
name?: string;
8078
number?: number;
8179
options?: any;
8280
}
8381

84-
interface IEnumOptions {
82+
export interface IEnumOptions {
8583
allowAlias?: boolean;
8684
}
8785

88-
interface IOneofDescriptorProto {
86+
export interface IOneofDescriptorProto {
8987
name?: string;
9088
options?: any;
9189
}
9290

93-
interface IServiceDescriptorProto {
91+
export interface IServiceDescriptorProto {
9492
name?: string;
9593
method?: IMethodDescriptorProto[];
9694
options?: any;
9795
}
9896

99-
interface IMethodDescriptorProto {
97+
export interface IMethodDescriptorProto {
10098
name?: string;
10199
inputType?: string;
102100
outputType?: string;
103101
options?: any;
104102
clientStreaming?: boolean;
105103
serverStreaming?: boolean;
106104
}
107-
108-
export = descriptor;
105+
export const FileDescriptorSet: $protobuf.Type;
106+
export const FileDescriptorProto: $protobuf.Type;
107+
export const DescriptorProto: $protobuf.Type;
108+
export const FieldDescriptorProto: $protobuf.Type;
109+
export const OneofDescriptorProto: $protobuf.Type;
110+
export const EnumDescriptorProto: $protobuf.Type;
111+
export const ServiceDescriptorProto: $protobuf.Type;
112+
export const EnumValueDescriptorProto: $protobuf.Type;
113+
export const MethodDescriptorProto: $protobuf.Type;
114+
export const FileOptions: $protobuf.Type;
115+
export const MessageOptions: $protobuf.Type;
116+
export const FieldOptions: $protobuf.Type;
117+
export const OneofOptions: $protobuf.Type;
118+
export const EnumOptions: $protobuf.Type;
119+
export const EnumValueOptions: $protobuf.Type;
120+
export const ServiceOptions: $protobuf.Type;
121+
export const MethodOptions: $protobuf.Type;
122+
export const UninterpretedOption: $protobuf.Type;
123+
export const SourceCodeInfo: $protobuf.Type;
124+
export const GeneratedCodeInfo: $protobuf.Type;

0 commit comments

Comments
 (0)