question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Properties missing when adding a module/namespace

See original GitHub issue

Using the current beta, I have this example code:

'use strict';

/** @module util */

/**
 * @class MyClass
 * @param {string} message
 * @returns {MyClass}
 */
class MyClass {
    constructor(message) {
        /** @type {string} */
        this.message = message;
    }
}

Which is converted to

/**
 * @module util
 */
declare namespace util {
    /**
     * @class MyClass
     * @param {string} message
     * @returns {MyClass}
     */
    class MyClass {
        constructor(message: string);

    }

}

As you can see, the message property is missing.

When I use the following code (without module), this.message is not missing:

'use strict';

/**
 * @class MyClass
 * @param {string} message
 * @returns {MyClass}
 */
class MyClass {
    constructor(message) {
        /** @type {string} */
        this.message = message;
    }
}

Converted:

/**
 * @class MyClass
 * @param {string} message
 * @returns {MyClass}
 */
declare class MyClass {
    constructor(message: string);

    /**
     * @type {string}
     */
    message: string;

}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
bennycodecommented, Aug 17, 2017

@englercj The jsdoc3/jsdoc#1182 issue has been resolved with JSDoc 3.5.0: https://github.com/jsdoc3/jsdoc/issues/1182#issuecomment-313750674

Current release version of JSDoc is 3.5.4, so it looks like this issue here can get fixed? 🤗

0reactions
bennycodecommented, Jun 6, 2018

Sorry, I haven’t tested with JSDoc 3.5.0. It has been a while. But Florian posted demo code here which could be used for a unit test in your library?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to access properties of namespace from imported ...
Importing from this module which exports the namespace is as its default export doesn't recognize any of the properties within the namespace ...
Read more >
Can modules have properties the same way that objects can?
modules is a Python 2 issue -- Python 3.4 works as intended. If you need access to the class object in Py2, add...
Read more >
How To Use Namespaces in TypeScript | DigitalOcean
In TypeScript, you can use namespaces to organize your code. Previously known as internal modules, namespaces in TypeScript are based on an ...
Read more >
Documentation - Namespaces and Modules - TypeScript
This post outlines the various ways to organize your code using modules and namespaces in TypeScript. We'll also go over some advanced topics...
Read more >
JavaScript modules - MDN Web Docs
This guide gives you all you need to get started with JavaScript module syntax.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found