Skip to content

Commit

Permalink
CLI: Check incompatible properties for namespaces only in tsd-jsdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Apr 18, 2017
1 parent ec6a133 commit ffdc93c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ Supported decorators are:
* **Type.d(typeName?: `string`)** &nbsp; *(optional)*<br />
annotates a class as a protobuf message type. If `typeName` is not specified, the constructor's runtime function name is used for the reflected type.
* **Field.d&lt;T>(fieldId: `number`, fieldType: `string | TMessageConstructor<TField>`, fieldRule?: `"optional" | "required" | "repeated"`, defaultValue?: `T`)**<br />
* **Field.d&lt;T>(fieldId: `number`, fieldType: `string | Constructor<T>`, fieldRule?: `"optional" | "required" | "repeated"`, defaultValue?: `T`)**<br />
annotates a property as a protobuf field with the specified id and protobuf type.
* **MapField.d&lt;T extends { [key: string]: any }>(fieldId: `number`, fieldKeyType: `string`, fieldValueType. `string | Constructor<{}>`)**<br />
Expand Down
8 changes: 4 additions & 4 deletions cli/lib/tsd-jsdoc/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,11 +395,9 @@ function writeInterfaceBody(element) {
write("}");
}

function writeProperty(property, withLet) {
function writeProperty(property, declare) {
writeComment(property.description);
if (!/^[\w$]+$/.test(property.name)) // incompatible
write("// ");
if (withLet)
if (declare)
write("let ");
write(property.name);
if (property.optional)
Expand Down Expand Up @@ -462,6 +460,8 @@ function handleNamespace(element/*, parent*/) {
var first = true;
if (element.properties)
element.properties.forEach(function(property) {
if (!/^[$\w]+$/.test(property.name)) // incompatible in namespace
return;
if (first) {
begin(element);
writeln("namespace ", element.name, " {");
Expand Down

0 comments on commit ffdc93c

Please sign in to comment.