Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsdoc for globalThis #2093

Open
truongan07 opened this issue Nov 1, 2023 · 1 comment
Open

jsdoc for globalThis #2093

truongan07 opened this issue Nov 1, 2023 · 1 comment

Comments

@truongan07
Copy link

if (undefined === globalThis.using) {
    /**
     * @type {object}
     */
    globalThis.using = {};
}

i want

using

@truongan07
Copy link
Author

Jsdoc doesn't support to add dynamic property of object

if (undefined === globalThis.using) {
    /**
     * @type {object}
     */
    globalThis.using = {};
}

/**
* what is jsdoc at here ?
*/
const addProperty = (key, value) => {
       globalThis.using[key] = value;
};
const setUsing = obj => {
   Object.keys(obj).each(key => {
       // do something to jsdoc logs dynamic new property
       // Object.assign(globalThis.using, { [key]: obj[key] });

       // or jsdoc probable logs new property like this
       // globalThis.using[key] = obj[key];

       // or jsdoc logs new property from callback
       addProperty(key, obj[key]);
   });
};
const listMethods = { computing: () => {}, makeBlock: () => {} };

setUsing(listMethods);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant