Skip to content

Parse nested prop and param tags the same way#25139

Merged
sandersn merged 1 commit into
masterfrom
fix-nested-typedef-parsing
Jun 21, 2018
Merged

Parse nested prop and param tags the same way#25139
sandersn merged 1 commit into
masterfrom
fix-nested-typedef-parsing

Conversation

@sandersn
Copy link
Copy Markdown
Member

That is, only nest them if their name matches the provided parent name. Otherwise do not nest them. Now this code creates a type with three properties a,b,c instead of two a,b:

/**
 * @typedef {Object} T
 * @param {string} a
 * @param {object} b
 * @param {string} c
 */

Note that this commit changes the behaviour of an incorrect typedef that contains both an @type child tag and @property child tags.

Previously, the @type would be incorrectly nested under a @property tag with type object, just like @property tags would be. Now, the @type tag causes the entire typedef to ignore the @property tags and treat the typedef as if it were an instance of the typedef-and-nested-type pattern:

/**
 * @typedef {Object} name
 * @type {{ the, actual, type }}
 */

Fixes #25072
Fixes #25118

That is, only nest them if their name matches the provided parent name.
Otherwise do not nest them.

Note that this commit changes the behaviour of an incorrect typedef that
contains both an `@type` child tag and `@property` child tags.

Previously, the `@type` would be incorrectly nested under a `@property`
tag with type `object`, just like `@property` tags would be. Now, the
`@type` tag causes the entire typedef to ignore the `@property` tags and
treat the typedef as if it were an instance of the
typedef-and-nested-type pattern:

```js
/**
 * @typedef {Object} name
 * @type {{ the, actual, type }}
 */
```
@sandersn sandersn requested review from a user and mhegazy June 21, 2018 22:44
@sandersn sandersn merged commit 0bb8972 into master Jun 21, 2018
@sandersn sandersn deleted the fix-nested-typedef-parsing branch June 21, 2018 23:13
@austin-rausch
Copy link
Copy Markdown

Thanks for the quick fix on that, keep up the good work guys!

@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants