Inheriting sub-properties with same name is not working
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 15.5k
- Forks
- 1.5k
- Avg merge
- 10d 23h
- Merged PRs (30d)
- 1
Description
Sub-properties having the same name but belonging to different parents are shadowing each other during the augment process.
Input code
Parent Class code
/**
* @class ClassA
* @abstract
* @since 1.0.0
* @hideconstructor
*
*/
class ClassA {
constructor() { }
options = {
/**
* Prop foo
* @memberof ClassA
* @instance
* @public
* @type {Object}
*/
foo: undefined,
/**
* Prop foo.a
*
* @name foo.a
* @memberof! ClassA
* @instance
* @type {?string}
* @default null
*/
/**
* Prop foo.b
*
* @name foo.b
* @memberof! ClassA
* @instance
* @type {?string}
* @default null
*/
/**
* Prop bar
* @public
* @memberof ClassA
* @instance
* @type {Object}
* @since 4.1.0
*/
bar:{
/**
* Prop bar.a
*
* @name bar.a
* @memberof! ClassA
* @instance
* @type {?string}
* @default null
*/
a: {
/**
* Prop bar.a.a1
*
* @name bar.a.a1
* @memberof! ClassA
* @instance
* @type {?string}
* @default null
*/
a1
},
/**
* Prop bar.b
*
* @name bar.b
* @memberof! ClassA
* @instance
* @type {?string}
* @default null
*/
b: ''
}
}
}
Child Class code (extending parent)
/**
* @class ClassA_Child
* @augments ClassA
* @since 1.0.0
* @hideconstructor
*
*/
class ClassA {
constructor() {}
}
JSDoc configuration
Copy the content of the code from above in two separate files in a testcase folder: testcase/classA.js and testcase/classA_child.js. Create the conf.json file in the same folder.
{
"tags": {
"allowUnknownTags": true
},
"source": {
"include": ["testcase"],
"includePattern": ".+\\.js(doc|x)?$",
"excludePattern": "(^|\\/|\\\\)_"
},
"plugins": [],
"templates": {
"cleverLinks": false,
"monospaceLinks": false,
"default": {
"outputSourceFiles": true
}
}
}
JSDoc debug output
Attached is the generated docs and the tescase with the test files.
run jsdoc: node \node_modules\jsdoc\jsdoc.js -c testcase\conf.json -d docs
Expected behavior
All properties defined on ClassA should be visible and accessible on ClassA_Child
foo
foo.a
foo.b
bar
bar.a
bar.a.a1
bar.b
Current behavior
Because of the overriding/shadowing I only see (in ClassA_Child)
foo
foo.a
foo.b
bar
bara.a1
Your environment
| Software | Version |
|---|---|
| JSDoc | 3.6.6 |
| Node.js | 14.15.4 |
| npm | 6.14.10 |
| Operating system | Windows 10 |
| testcase.zip | |
| docs.zip |
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with testcase/classA.js, testcase/classA_child.js, and testcase/conf.json using the provided JSDoc command. Inspect the augment process responsible for inherited sub-properties with identical names under different parents. Done means ClassA_Child exposes foo, foo.a, foo.b, bar, bar.a, bar.a.a1, and bar.b without shadowing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100