Skip to content

Commit ffdc93c

Browse files
committed
CLI: Check incompatible properties for namespaces only in tsd-jsdoc
1 parent ec6a133 commit ffdc93c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ Supported decorators are:
554554
* **Type.d(typeName?: `string`)** &nbsp; *(optional)*<br />
555555
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.
556556

557-
* **Field.d&lt;T>(fieldId: `number`, fieldType: `string | TMessageConstructor<TField>`, fieldRule?: `"optional" | "required" | "repeated"`, defaultValue?: `T`)**<br />
557+
* **Field.d&lt;T>(fieldId: `number`, fieldType: `string | Constructor<T>`, fieldRule?: `"optional" | "required" | "repeated"`, defaultValue?: `T`)**<br />
558558
annotates a property as a protobuf field with the specified id and protobuf type.
559559

560560
* **MapField.d&lt;T extends { [key: string]: any }>(fieldId: `number`, fieldKeyType: `string`, fieldValueType. `string | Constructor<{}>`)**<br />

cli/lib/tsd-jsdoc/publish.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,9 @@ function writeInterfaceBody(element) {
395395
write("}");
396396
}
397397

398-
function writeProperty(property, withLet) {
398+
function writeProperty(property, declare) {
399399
writeComment(property.description);
400-
if (!/^[\w$]+$/.test(property.name)) // incompatible
401-
write("// ");
402-
if (withLet)
400+
if (declare)
403401
write("let ");
404402
write(property.name);
405403
if (property.optional)
@@ -462,6 +460,8 @@ function handleNamespace(element/*, parent*/) {
462460
var first = true;
463461
if (element.properties)
464462
element.properties.forEach(function(property) {
463+
if (!/^[$\w]+$/.test(property.name)) // incompatible in namespace
464+
return;
465465
if (first) {
466466
begin(element);
467467
writeln("namespace ", element.name, " {");

0 commit comments

Comments
 (0)