TypeScript/tests/cases/conformance/jsdoc/typedefTagNested.ts
Nathan Shively-Sanders 0bb897273f
Parse nested prop and param tags the same way (#25139)
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 }}
 */
```
2018-06-21 16:12:55 -07:00

46 lines
790 B
TypeScript

// @noEmit: true
// @allowJs: true
// @checkJs: true
// @strict: true
// @Filename: a.js
/** @typedef {Object} App
* @property {string} name
* @property {Object} icons
* @property {string} icons.image32
* @property {string} icons.image64
*/
var ex;
/** @type {App} */
const app = {
name: 'name',
icons: {
image32: 'x.png',
image64: 'y.png',
}
}
/** @typedef {Object} Opp
* @property {string} name
* @property {Object} oops
* @property {string} horrible
* @type {string} idea
*/
var intercessor = 1
/** @type {Opp} */
var mistake;
/** @typedef {Object} Upp
* @property {string} name
* @property {Object} not
* @property {string} nested
*/
/** @type {Upp} */
var sala = { name: 'uppsala', not: 0, nested: "ok" };
sala.name
sala.not
sala.nested