From ffdc93c7cf7c8a716316b00864ea7c510e05b0c8 Mon Sep 17 00:00:00 2001 From: dcodeIO Date: Tue, 18 Apr 2017 21:16:33 +0200 Subject: [PATCH] CLI: Check incompatible properties for namespaces only in tsd-jsdoc --- README.md | 2 +- cli/lib/tsd-jsdoc/publish.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 78fbd8bfe..5dd18fb95 100644 --- a/README.md +++ b/README.md @@ -554,7 +554,7 @@ Supported decorators are: * **Type.d(typeName?: `string`)**   *(optional)*
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<T>(fieldId: `number`, fieldType: `string | TMessageConstructor`, fieldRule?: `"optional" | "required" | "repeated"`, defaultValue?: `T`)**
+* **Field.d<T>(fieldId: `number`, fieldType: `string | Constructor`, fieldRule?: `"optional" | "required" | "repeated"`, defaultValue?: `T`)**
annotates a property as a protobuf field with the specified id and protobuf type. * **MapField.d<T extends { [key: string]: any }>(fieldId: `number`, fieldKeyType: `string`, fieldValueType. `string | Constructor<{}>`)**
diff --git a/cli/lib/tsd-jsdoc/publish.js b/cli/lib/tsd-jsdoc/publish.js index 4c4c39593..c28073159 100644 --- a/cli/lib/tsd-jsdoc/publish.js +++ b/cli/lib/tsd-jsdoc/publish.js @@ -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) @@ -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, " {");