Skip to content

Missing interfaces in typescript file ~probably is jsdoc issue~ [It is CLI issue] #1414

Open
@VitalyName

Description

@VitalyName

protobuf.js version: 6.9.0
nodejs: 14.2.0

If I have class after enum in JS file (after pbjs command), I can't see interfaces for it in TS file after pbts command. But interfaces for classes before enum is in TS file and they work fine.
However if I change jsdoc from 3.6.4 to 3.5.5 version, all interface is generated fine.

Examle:

/**
 * IntSize enum.
 * @exports IntSize
 * @enum {number}
 * @property {number} IS_DEFAULT=0 IS_DEFAULT value
 * @property {number} IS_8=8 IS_8 value
 * @property {number} IS_16=16 IS_16 value
 * @property {number} IS_32=32 IS_32 value
 * @property {number} IS_64=64 IS_64 value
 */
$root.IntSize = (function() {
    var valuesById = {}, values = Object.create(valuesById);
    values[valuesById[0] = "IS_DEFAULT"] = 0;
    values[valuesById[8] = "IS_8"] = 8;
    values[valuesById[16] = "IS_16"] = 16;
    values[valuesById[32] = "IS_32"] = 32;
    values[valuesById[64] = "IS_64"] = 64;
    return values;
})();

$root.NanoPBOptions = (function() {

    /**
     * Properties of a NanoPBOptions.
     * @exports INanoPBOptions
     * @interface INanoPBOptions
     * @property {number|null} [maxSize] NanoPBOptions maxSize
     * @property {number|null} [maxLength] NanoPBOptions maxLength
     * @property {number|null} [maxCount] NanoPBOptions maxCount
     * @property {IntSize|null} [intSize] NanoPBOptions intSize
     * @property {FieldType|null} [type] NanoPBOptions type
     * @property {boolean|null} [longNames] NanoPBOptions longNames
     * @property {boolean|null} [packedStruct] NanoPBOptions packedStruct
     * @property {boolean|null} [packedEnum] NanoPBOptions packedEnum
     * @property {boolean|null} [skipMessage] NanoPBOptions skipMessage
     * @property {boolean|null} [noUnions] NanoPBOptions noUnions
     * @property {number|null} [msgid] NanoPBOptions msgid
     * @property {boolean|null} [anonymousOneof] NanoPBOptions anonymousOneof
     * @property {boolean|null} [proto3] NanoPBOptions proto3
     * @property {boolean|null} [enumToString] NanoPBOptions enumToString
     * @property {boolean|null} [fixedLength] NanoPBOptions fixedLength
     * @property {boolean|null} [fixedCount] NanoPBOptions fixedCount
     */

I debug this. I seen list of Doclet objects in taffy().get() here: my_project/node_modules/protobufjs/cli/lib/tsd-jsdoc/publish.js

// JSDoc hook
exports.publish = function publish(taffy, opts) {
    options = opts || {};

Many Doclet objects have field "memberof". Next in source code it field used for filtering of element list.

Whre I use jsdoc 3.5.5, Doclet for interface INanoPBOptions is memberof "undefined". So it is root element and interface will be created in TS.
Whre I use jsdoc 3.6.4, Doclet for interface INanoPBOptions is memberof "module:IntSize". It take it from enum? So it is not root element and interface will not be created in TS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions