Skip to content

Commit 2d3193c

Browse files
author
Maximilian Wehrstedt
committed
global config property to ignore private members
1 parent 7c454de commit 2d3193c

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
## Changelog
22

3+
# v0.8.6
4+
New features in this release:
5+
- You can ignore private members by default by adding the property "ignorePrivateMembers"
6+
to the jsconfig.json
7+
38
# v0.8.3
49
Bugfixes:
510
- Not all supported items were added to their parent member

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ $> jsdoc -d <target-dir>/<filename>.d.ts
3232
**Important: If you want to change the file name of the result file your path has to end with the file ending ```d.ts```**
3333

3434
## Options
35+
* **ignorePrivateMembers** Determines if private members should be omitted or not
3536
* **ignoreScopes** Array with scope names which should not be parsed. Possible values
3637
```
3738
[
@@ -75,6 +76,7 @@ module.exports = function(taggedVersion, latestVersion) {
7576
* @interface
7677
* @since
7778
* @module (function and variable declarations)
79+
* @private (not completed yet)
7880

7981
## Ignored Tags
8082
* @file

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@otris/jsdoc-tsd",
3-
"version": "0.8.5",
3+
"version": "0.8.6",
44
"description": "JSDoc Template for generate typescript definition files from JSDoc comments",
55
"main": "src-out/core/publish.js",
66
"repository": {

src/core/jsdoc-tsd-parser.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ export class JSDocTsdParser {
2929
this.config.ignoreScopes = [];
3030
}
3131

32+
if (typeof this.config.ignorePrivateMembers === "undefined") {
33+
this.config.ignorePrivateMembers = false;
34+
}
35+
3236
if (typeof this.config.versionComparator !== "function" && (typeof this.config.versionComparator !== "string" || this.config.versionComparator === "")) {
3337
this.config.versionComparator = (taggedVersion: string, latestVersion: string): boolean => {
3438
if (taggedVersion.match(/v?([0-9]+\.){2}[0-9]+/i)) {
@@ -96,7 +100,7 @@ export class JSDocTsdParser {
96100
jsdocItems.forEach((item) => {
97101
if (!this.evaluateSinceTag(item.since)) {
98102
this.rejectedItems.push(item.longname);
99-
} else if (!item.ignore && this.config.ignoreScopes.indexOf(item.scope) === -1 && (!item.access || item.access !== "private")) {
103+
} else if (!item.ignore && this.config.ignoreScopes.indexOf(item.scope) === -1 && !(this.config.ignorePrivateMembers && item.access === "private")) {
100104
let addItem = true;
101105
let addJsDocComment = true;
102106
let parsedItem: dom.DeclarationBase = {};
@@ -188,9 +192,6 @@ export class JSDocTsdParser {
188192
let domTopLevelDeclarations: { [key: string]: dom.TopLevelDeclaration } = {};
189193

190194
for (let jsdocItem of this.jsdocItems) {
191-
if (jsdocItem.longname === "lcmContractTermHelper.ContractTermReminderConfiguration") {
192-
let a = 0;
193-
}
194195
let parentItem = this.findParentItem(jsdocItem, domTopLevelDeclarations);
195196

196197
if (parentItem) {

0 commit comments

Comments
 (0)