Skip to content

Commit 815fe20

Browse files
committed
fix(core): remove some incorrect type assertions
1 parent 7951585 commit 815fe20

File tree

5 files changed

+14
-15
lines changed

5 files changed

+14
-15
lines changed

packages/typedoc-plugin-markdown/src/theme/context/partials/container.body.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export function body(
5454
} else {
5555
md.push(
5656
this.partials.members(
57-
group.children as DeclarationReflection[],
57+
group.children.filter(child => child.isDeclaration()),
5858
{
5959
headingLevel: options.headingLevel,
6060
},
@@ -83,9 +83,9 @@ export function body(
8383
children: model.children,
8484
} as ReflectionGroup),
8585
);
86-
} else {
86+
} else if (model.children) {
8787
md.push(
88-
this.partials.members(model.children as DeclarationReflection[], {
88+
this.partials.members(model.children, {
8989
headingLevel: options.headingLevel,
9090
}),
9191
);

packages/typedoc-plugin-markdown/src/theme/context/partials/container.categories.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
sortNoneSectionFirst,
66
} from '@plugin/theme/lib/index.js';
77
import {
8-
DeclarationReflection,
98
ReflectionCategory,
109
ReflectionKind,
1110
} from 'typedoc';
@@ -26,9 +25,9 @@ export function categories(
2625
}
2726
md.push(this.partials.groupIndex(category));
2827
} else {
29-
const categoryChildren = category.children?.filter(
28+
const categoryChildren = category.children.filter(
3029
(child) => child.kind !== ReflectionKind.Constructor,
31-
);
30+
).filter(child => child.isDeclaration());
3231
if (categoryChildren.length) {
3332
if (!isNoneSection(category)) {
3433
md.push(heading(options.headingLevel, category.title));
@@ -37,7 +36,7 @@ export function categories(
3736
md.push(this.helpers.getCommentParts(category.description));
3837
}
3938
md.push(
40-
this.partials.members(categoryChildren as DeclarationReflection[], {
39+
this.partials.members(categoryChildren, {
4140
headingLevel: isNoneSection(category)
4241
? options.headingLevel
4342
: options.headingLevel + 1,

packages/typedoc-plugin-markdown/src/theme/context/partials/container.groups.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export function groups(
9797
) {
9898
md.push(
9999
this.partials.propertiesTable(
100-
group.children as DeclarationReflection[],
100+
group.children.filter(child => child.isDeclaration()),
101101
{
102102
isEventProps,
103103
kind: options.kind,
@@ -107,13 +107,13 @@ export function groups(
107107
} else if (isEnumGroup && this.helpers.useTableFormat('enums')) {
108108
md.push(
109109
this.partials.enumMembersTable(
110-
group.children as DeclarationReflection[],
110+
group.children.filter(child => child.isDeclaration()),
111111
),
112112
);
113113
} else {
114114
if (group.children) {
115115
md.push(
116-
this.partials.members(group.children as DeclarationReflection[], {
116+
this.partials.members(group.children.filter(child => child.isDeclaration()), {
117117
headingLevel: isNoneSection(group)
118118
? options.headingLevel
119119
: options.headingLevel + 1,

packages/typedoc-plugin-markdown/src/theme/context/partials/container.members.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ export function members(
1414
}
1515
return true;
1616
};
17-
const items = model?.filter((item) => !this.router.hasOwnDocument(item));
18-
items?.forEach((item, index) => {
17+
const items = model.filter((item) => !this.router.hasOwnDocument(item));
18+
items.forEach((item, index) => {
1919
md.push(
2020
this.partials.memberContainer(item, {
2121
headingLevel: options.headingLevel,

packages/typedoc-plugin-markdown/src/theme/context/partials/member.groupIndex.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ export function groupIndex(group: ReflectionGroup | ReflectionCategory) {
1919
if (this.options.getValue('indexFormat').toLowerCase().includes('table')) {
2020
return getGroupIndexTable(
2121
this,
22-
group.children as DeclarationReflection[] | DocumentReflection[],
22+
group.children,
2323
);
2424
}
2525
return getGroupIndexList(
2626
this,
27-
group.children as DeclarationReflection[] | DocumentReflection[],
27+
group.children,
2828
);
2929
}
3030

3131
export function getGroupIndexList(
3232
context: MarkdownThemeContext,
33-
children: DeclarationReflection[] | DocumentReflection[],
33+
children: (DeclarationReflection | DocumentReflection)[],
3434
) {
3535
const filteredChildren =
3636
children

0 commit comments

Comments
 (0)