Skip to content

Commit

Permalink
fix: Constructors were a bit broken
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit0 committed Jan 17, 2021
1 parent 213760b commit d746d85
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 58 deletions.
5 changes: 4 additions & 1 deletion src/lib/converter/plugins/CommentPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,10 @@ export class CommentPlugin extends ConverterComponent {
hidden
.map((reflection) => reflection.parent!)
.filter((method) =>
method.kindOf(ReflectionKind.FunctionOrMethod)
method.kindOf(
ReflectionKind.FunctionOrMethod |
ReflectionKind.Constructor
)
) as DeclarationReflection[],
(method) => method.signatures?.length === 0
);
Expand Down
6 changes: 5 additions & 1 deletion src/lib/converter/symbols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,11 @@ function convertClassOrInterface(

constructMember.signatures = staticType
.getConstructSignatures()
.map((sig) => {
.map((sig, i) => {
// Modifiers are the same for all constructors
if (sig.declaration && i === 0) {
setModifiers(sig.declaration, constructMember);
}
const sigRef = createSignature(
constructContext,
ReflectionKind.ConstructorSignature,
Expand Down
3 changes: 3 additions & 0 deletions src/test/converter/class/access.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,7 @@ export class PrivateClass {
fakeProtectedMethod() {}

private privateArrow = () => {};

/** @hidden - should not show up */
constructor() {}
}
28 changes: 0 additions & 28 deletions src/test/converter/class/specs-with-lump-categories.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,6 @@
"shortText": "A class that is documented as being private."
},
"children": [
{
"id": 9,
"name": "constructor",
"kind": 512,
"kindString": "Constructor",
"flags": {},
"signatures": [
{
"id": 10,
"name": "new PrivateClass",
"kind": 16384,
"kindString": "Constructor signature",
"flags": {},
"type": {
"type": "reference",
"id": 8,
"name": "PrivateClass"
}
}
]
},
{
"id": 11,
"name": "fakePrivateProperty",
Expand Down Expand Up @@ -154,13 +133,6 @@
}
],
"groups": [
{
"title": "Constructors",
"kind": 512,
"children": [
9
]
},
{
"title": "Properties",
"kind": 1024,
Expand Down
28 changes: 0 additions & 28 deletions src/test/converter/class/specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,6 @@
"shortText": "A class that is documented as being private."
},
"children": [
{
"id": 9,
"name": "constructor",
"kind": 512,
"kindString": "Constructor",
"flags": {},
"signatures": [
{
"id": 10,
"name": "new PrivateClass",
"kind": 16384,
"kindString": "Constructor signature",
"flags": {},
"type": {
"type": "reference",
"id": 8,
"name": "PrivateClass"
}
}
]
},
{
"id": 11,
"name": "fakePrivateProperty",
Expand Down Expand Up @@ -154,13 +133,6 @@
}
],
"groups": [
{
"title": "Constructors",
"kind": 512,
"children": [
9
]
},
{
"title": "Properties",
"kind": 1024,
Expand Down

0 comments on commit d746d85

Please sign in to comment.