Skip to content

Commit 15ba2dd

Browse files
authored
Merge pull request #2693 from waynemwashuma/master
Added support for `@abstract` tag
2 parents 0682459 + f4d7199 commit 15ba2dd

File tree

6 files changed

+41
-0
lines changed

6 files changed

+41
-0
lines changed

Diff for: CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Added `customJs` option to include a script tag in generated HTML output, #2650.
66
- Added `markdownLinkExternal` option to treat `http[s]://` links in markdown documents and comments as external to be opened in a new tab, #2679.
77
- Added `navigation.excludeReferences` option to prevent re-exports from appearing in the left hand navigation, #2685.
8+
- Added support for the `@abstract` tag, #2692.
89

910
### Bug Fixes
1011

@@ -17,6 +18,7 @@
1718
### Thanks!
1819

1920
- @Aryakoste
21+
- @waynemwashuma
2022

2123
## v0.26.6 (2024-08-18)
2224

Diff for: src/lib/converter/plugins/CommentPlugin.ts

+9
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,15 @@ export class CommentPlugin extends ConverterComponent {
192192
comment.removeModifier("@interface");
193193
}
194194

195+
if (comment.hasModifier("@abstract")) {
196+
if (reflection.kindOf(ReflectionKind.SomeSignature)) {
197+
reflection.parent!.setFlag(ReflectionFlag.Abstract);
198+
} else {
199+
reflection.setFlag(ReflectionFlag.Abstract);
200+
}
201+
comment.removeModifier("@abstract");
202+
}
203+
195204
if (comment.hasModifier("@private")) {
196205
reflection.setFlag(ReflectionFlag.Private);
197206
if (reflection.kindOf(ReflectionKind.CallSignature)) {

Diff for: src/lib/utils/options/tsdoc-defaults.ts

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export const tsdocModifierTags = [
6464

6565
export const modifierTags = [
6666
...tsdocModifierTags,
67+
"@abstract",
6768
"@class",
6869
"@enum",
6970
"@event",

Diff for: src/test/converter2/issues/gh2693.ts

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export abstract class Foo {
2+
abstract foo(): void;
3+
4+
abstract x: number;
5+
}
6+
7+
/** @abstract */
8+
export class Bar {
9+
/** @abstract */
10+
foo() {}
11+
12+
/** @abstract */
13+
x!: number;
14+
}

Diff for: src/test/issues.c2.test.ts

+11
Original file line numberDiff line numberDiff line change
@@ -1708,6 +1708,17 @@ describe("Issue Tests", () => {
17081708
equal(data2.comment, undefined);
17091709
});
17101710

1711+
it("#2693 handles the @abstract tag", () => {
1712+
const project = convert();
1713+
ok(query(project, "Foo.foo").flags.isAbstract);
1714+
ok(!querySig(project, "Foo.foo").flags.isAbstract);
1715+
ok(query(project, "Foo.x").flags.isAbstract);
1716+
1717+
ok(query(project, "Bar.foo").flags.isAbstract);
1718+
ok(!querySig(project, "Bar.foo").flags.isAbstract);
1719+
ok(query(project, "Bar.x").flags.isAbstract);
1720+
});
1721+
17111722
it("#2698 handles this parameters present in type but not node", () => {
17121723
const project = convert();
17131724
const animator = querySig(project, "animator");

Diff for: tsdoc.json

+4
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@
6767
"tagName": "@class",
6868
"syntaxKind": "modifier"
6969
},
70+
{
71+
"tagName": "@abstract",
72+
"syntaxKind": "modifier"
73+
},
7074
{
7175
"tagName": "@document",
7276
"syntaxKind": "block"

0 commit comments

Comments
 (0)