Skip to content

Commit 2a30df8

Browse files
committed
Other: Use typedefs in ext/descriptor (like everywhere else), see #757
1 parent b9f1790 commit 2a30df8

File tree

4 files changed

+115
-100
lines changed

4 files changed

+115
-100
lines changed

ext/descriptor/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var buffer = descriptor.FileDescriptorSet.encode(fileDescriptorSet).finish();
2323
var decoded = descriptor.FileDescriptorSet.decode(buffer);
2424

2525
// convert it back to a protobuf.js root
26-
root = protobuf.Root.fromDescriptor(decoded, "proto2");
26+
root = protobuf.Root.fromDescriptor(decoded);
2727

2828
// and start all over again
2929
```

ext/descriptor/index.d.ts

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

3-
export interface IFileDescriptorSet {
4-
file: IFileDescriptorProto[];
5-
}
3+
type FileDescriptorSetProperties = {
4+
file: FileDescriptorProtoProperties[];
5+
};
66

7-
export interface IFileDescriptorProto {
7+
type FileDescriptorProtoProperties = {
88
name?: string;
99
package?: string;
1010
dependency?: any;
1111
publicDependency?: any;
1212
weakDependency?: any;
13-
messageType?: IDescriptorProto[];
14-
enumType?: IEnumDescriptorProto[];
15-
service?: IServiceDescriptorProto[];
16-
extension?: IFieldDescriptorProto[];
13+
messageType?: DescriptorProtoProperties[];
14+
enumType?: EnumDescriptorProtoProperties[];
15+
service?: ServiceDescriptorProtoProperties[];
16+
extension?: FieldDescriptorProtoProperties[];
1717
options?: any;
1818
sourceCodeInfo?: any;
1919
syntax?: string;
20-
}
20+
};
2121

22-
export interface IDescriptorProto {
22+
type DescriptorProtoProperties = {
2323
name?: string;
24-
field?: IFieldDescriptorProto[];
25-
extension?: IFieldDescriptorProto[];
26-
nestedType?: IDescriptorProto[];
27-
enumType?: IEnumDescriptorProto[];
28-
extensionRange?: IExtensionRange[];
29-
oneofDecl?: IOneofDescriptorProto[];
30-
options?: IMessageOptions;
31-
reservedRange?: IReservedRange[];
24+
field?: FieldDescriptorProtoProperties[];
25+
extension?: FieldDescriptorProtoProperties[];
26+
nestedType?: DescriptorProtoProperties[];
27+
enumType?: EnumDescriptorProtoProperties[];
28+
extensionRange?: ExtensionRangeProperties[];
29+
oneofDecl?: OneofDescriptorProtoProperties[];
30+
options?: MessageOptionsProperties;
31+
reservedRange?: ReservedRangeProperties[];
3232
reservedName?: string[];
33-
}
33+
};
3434

35-
export interface IMessageOptions {
35+
type MessageOptionsProperties = {
3636
mapEntry?: boolean;
37-
}
37+
};
3838

39-
export interface IExtensionRange {
39+
type ExtensionRangeProperties = {
4040
start?: number;
4141
end?: number;
42-
}
42+
};
4343

44-
export interface IReservedRange {
44+
type ReservedRangeProperties = {
4545
start?: number;
4646
end?: number;
47-
}
47+
};
4848

49-
export interface IFieldOptions {
49+
type FieldOptionsProperties = {
5050
packed?: boolean;
51-
}
51+
};
5252

53-
export interface IFieldDescriptorProto {
53+
type FieldDescriptorProtoProperties = {
5454
name?: string;
5555
number?: number;
56-
label?: IFieldDescriptorProto_Label;
57-
type?: IFieldDescriptorProto_Type;
56+
label?: FieldDescriptorProtoLabel;
57+
type?: FieldDescriptorProtoType;
5858
typeName?: string;
5959
extendee?: string;
6060
defaultValue?: any;
6161
oneofIndex?: number;
6262
jsonName?: any;
63-
options?: IFieldOptions;
64-
}
63+
options?: FieldOptionsProperties;
64+
};
6565

66-
type IFieldDescriptorProto_Label = number;
66+
type FieldDescriptorProtoLabel = number;
6767

68-
type IFieldDescriptorProto_Type = number;
68+
type FieldDescriptorProtoType = number;
6969

70-
export interface IEnumDescriptorProto {
70+
type EnumDescriptorProtoProperties = {
7171
name?: string;
72-
value?: IEnumValueDescriptorProto[];
73-
options?: IEnumOptions;
74-
}
72+
value?: EnumValueDescriptorProtoProperties[];
73+
options?: EnumOptionsProperties;
74+
};
7575

76-
export interface IEnumValueDescriptorProto {
76+
type EnumValueDescriptorProtoProperties = {
7777
name?: string;
7878
number?: number;
7979
options?: any;
80-
}
80+
};
8181

82-
export interface IEnumOptions {
82+
type EnumOptionsProperties = {
8383
allowAlias?: boolean;
84-
}
84+
};
8585

86-
export interface IOneofDescriptorProto {
86+
type OneofDescriptorProtoProperties = {
8787
name?: string;
8888
options?: any;
89-
}
89+
};
9090

91-
export interface IServiceDescriptorProto {
91+
type ServiceDescriptorProtoProperties = {
9292
name?: string;
93-
method?: IMethodDescriptorProto[];
93+
method?: MethodDescriptorProtoProperties[];
9494
options?: any;
95-
}
95+
};
9696

97-
export interface IMethodDescriptorProto {
97+
type MethodDescriptorProtoProperties = {
9898
name?: string;
9999
inputType?: string;
100100
outputType?: string;
101101
options?: any;
102102
clientStreaming?: boolean;
103103
serverStreaming?: boolean;
104-
}
104+
};
105105
export const FileDescriptorSet: $protobuf.Type;
106106
export const FileDescriptorProto: $protobuf.Type;
107107
export const DescriptorProto: $protobuf.Type;

0 commit comments

Comments
 (0)