Skip to content

Commit

Permalink
CLI: Sanitize CR-only line endings (coming from jsdoc?)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Nov 26, 2017
1 parent c482a5b commit 20a2627
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
8 changes: 4 additions & 4 deletions cli/lib/tsd-jsdoc/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ function getChildrenOf(parent) {
// gets the literal type of an element
function getTypeOf(element) {
if (element.tsType)
return element.tsType;
return element.tsType.replace(/\r?\n|\r/g, "\n");
var name = "any";
var type = element.type;
if (type && type.names && type.names.length) {
Expand Down Expand Up @@ -388,7 +388,7 @@ function writeInterfaceBody(element) {
writeln("{");
++indent;
if (element.tsType)
writeln(element.tsType);
writeln(element.tsType.replace(/\r?\n|\r/g, "\n"));
else if (element.properties && element.properties.length)
element.properties.forEach(writeProperty);
--indent;
Expand Down Expand Up @@ -529,7 +529,7 @@ function handleClass(element, parent) {
++indent;

if (element.tsType)
writeln(element.tsType);
writeln(element.tsType.replace(/\r?\n|\r/g, "\n"));

// constructor
if (!is_interface && !element.virtual)
Expand Down Expand Up @@ -675,7 +675,7 @@ function handleTypeDef(element, parent) {
write("<", element.templates.join(", "), ">");
write(" = ");
if (element.tsType)
write(element.tsType);
write(element.tsType.replace(/\r?\n|\r/g, "\n"));
else {
var type = getTypeOf(element);
if (element.type && element.type.names.length === 1 && element.type.names[0] === "function")
Expand Down
31 changes: 24 additions & 7 deletions ext/descriptor/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ export const FileDescriptorSet: $protobuf.Type;

export const FileDescriptorProto: $protobuf.Type;

export const DescriptorProto: $protobuf.Type & { ExtensionRange: $protobuf.Type, ReservedRange: $protobuf.Type};
export const DescriptorProto: $protobuf.Type & {
ExtensionRange: $protobuf.Type,
ReservedRange: $protobuf.Type
};

export const FieldDescriptorProto: $protobuf.Type & { Label: $protobuf.Enum, Type: $protobuf.Enum};
export const FieldDescriptorProto: $protobuf.Type & {
Label: $protobuf.Enum,
Type: $protobuf.Enum
};

export const OneofDescriptorProto: $protobuf.Type;

Expand All @@ -18,11 +24,16 @@ export const EnumValueDescriptorProto: $protobuf.Type;

export const MethodDescriptorProto: $protobuf.Type;

export const FileOptions: $protobuf.Type & { OptimizeMode: $protobuf.Enum};
export const FileOptions: $protobuf.Type & {
OptimizeMode: $protobuf.Enum
};

export const MessageOptions: $protobuf.Type;

export const FieldOptions: $protobuf.Type & { CType: $protobuf.Enum, JSType: $protobuf.Enum};
export const FieldOptions: $protobuf.Type & {
CType: $protobuf.Enum,
JSType: $protobuf.Enum
};

export const OneofOptions: $protobuf.Type;

Expand All @@ -34,11 +45,17 @@ export const ServiceOptions: $protobuf.Type;

export const MethodOptions: $protobuf.Type;

export const UninterpretedOption: $protobuf.Type & { NamePart: $protobuf.Type};
export const UninterpretedOption: $protobuf.Type & {
NamePart: $protobuf.Type
};

export const SourceCodeInfo: $protobuf.Type & { Location: $protobuf.Type};
export const SourceCodeInfo: $protobuf.Type & {
Location: $protobuf.Type
};

export const GeneratedCodeInfo: $protobuf.Type & { Annotation: $protobuf.Type};
export const GeneratedCodeInfo: $protobuf.Type & {
Annotation: $protobuf.Type
};

export interface IFileDescriptorSet {
file: IFileDescriptorProto[];
Expand Down

0 comments on commit 20a2627

Please sign in to comment.