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

[BUG] Nested object schema definitions don't work #269

Open
chladnefazole opened this issue Jun 24, 2024 · 1 comment
Open

[BUG] Nested object schema definitions don't work #269

chladnefazole opened this issue Jun 24, 2024 · 1 comment

Comments

@chladnefazole
Copy link

Describe the bug
Nested object schema definitions don't work.

To Reproduce
For example, I have interface:

export interface Example {
    id?: number,
    someObj: {
        prop1: number,
        prop2: number,
    }
}

I represent it like this:

/**
 * Object containing some stuff
 * @typedef {object} Example
 * @property {number} id - An ID
 * @property {object} someObj - Object containing properties
 * @property {number} someObj.prop1 - Property 1
 * @property {number} someObj.prop2 - Property 2
 */

Expected behavior
example.someObj should show as an OBJECT containing some number properties.

Instead I get:
image

ie. example.someObj is shown to have type number, and its description is not the one I set for it (Object containing properties), but instead it shows the description of someObj's last property (Property 2)

Desktop (please complete the following information):

  • Latest version
@markgarrigan
Copy link

This works for me... Change your {object} in the Example definition to the actual definition of SomeObj

/**
 * @typedef {object} SomeObj
 * @property {number} id
 * @property {string} name
 * @property {number} age
 */
 
/**
 * @typedef {object} Example
 * @property {number} id
 * @property {string} name
 * @property {SomeObj} someObj
 */

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

2 participants