Skip to content

Commit

Permalink
fix: Fixed navigation type error.
Browse files Browse the repository at this point in the history
  • Loading branch information
tgreyuk committed Apr 21, 2024
1 parent bdbec59 commit 1cb7f81
Show file tree
Hide file tree
Showing 14 changed files with 315 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/nervous-cherries-cry.md
@@ -0,0 +1,5 @@
---
"typedoc-plugin-markdown": patch
---

- Fixed navigation type error (#595)
4 changes: 1 addition & 3 deletions devtools/packages/fixtures/cli.ts
Expand Up @@ -115,13 +115,11 @@ export function writeHtml(key: string, entryPoints: string[]) {
'-options',
path.join(__dirname, 'typedoc.cjs'),
'-logLevel',
'None',
'Warn',
'-out',
fullPath,
'--readme',
'none',
'--entryPointStrategy',
'expand',
],
...toEntryPoints(entryPoints),
],
Expand Down
Expand Up @@ -268,7 +268,7 @@ export function buildNavigation(
let currentLevel = acc;
let currentItem: NavigationItem;
for (let i = 0; i < titleParts.length - 1; i++) {
currentItem = currentLevel.find(
currentItem = currentLevel?.find(
(item: NavigationItem) => item.title === titleParts[i],
) as NavigationItem;
if (!currentItem) {
Expand All @@ -279,7 +279,7 @@ export function buildNavigation(
currentLevel.push(currentItem);
}
if (currentItem) {
currentLevel = currentItem.children as NavigationItem[];
currentLevel = currentItem.children || [];
}
}

Expand Down
@@ -0,0 +1 @@

@@ -0,0 +1,4 @@
{
"name": "package-7",
"version": "1.0.0"
}
@@ -0,0 +1,2 @@
export class ClassA {}
export class ClassB {}
@@ -0,0 +1,2 @@
export class ClassA {}
export class ClassB {}
@@ -0,0 +1,2 @@
export class ClassA {}
export class ClassB {}
@@ -0,0 +1,2 @@
export class ClassA {}
export class ClassB {}
@@ -0,0 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node"
},
"include": ["**/*.ts"]
}
@@ -0,0 +1,5 @@
{
"entryPoints": ["./src/modules/module-1", "./src/modules/module-2"],
"entryPointStrategy": "expand",
"readme": "none"
}
Expand Up @@ -199,6 +199,111 @@ exports[`Navigation should get Navigation Json for packages: (Output File Strate
}
],
"path": "package-6.md"
},
{
"title": "package-7",
"kind": 2,
"children": [
{
"title": "module-1",
"kind": 2,
"path": "package-7/module-1/index.md",
"children": [
{
"title": "Classes",
"children": [
{
"title": "ClassA",
"kind": 128,
"path": "package-7/module-1/classes/ClassA.md"
},
{
"title": "ClassB",
"kind": 128,
"path": "package-7/module-1/classes/ClassB.md"
}
]
},
{
"title": "submodules",
"children": [
{
"title": "submodule-3-with-modules",
"children": [
{
"title": "nested-submodule-1",
"kind": 2,
"path": "package-7/module-1/submodules/submodule-3-with-modules/nested-submodule-1/index.md",
"children": [
{
"title": "Classes",
"children": [
{
"title": "ClassA",
"kind": 128,
"path": "package-7/module-1/submodules/submodule-3-with-modules/nested-submodule-1/classes/ClassA.md"
},
{
"title": "ClassB",
"kind": 128,
"path": "package-7/module-1/submodules/submodule-3-with-modules/nested-submodule-1/classes/ClassB.md"
}
]
}
]
},
{
"title": "nested-submodule-2",
"kind": 2,
"path": "package-7/module-1/submodules/submodule-3-with-modules/nested-submodule-2/index.md",
"children": [
{
"title": "Classes",
"children": [
{
"title": "ClassA",
"kind": 128,
"path": "package-7/module-1/submodules/submodule-3-with-modules/nested-submodule-2/classes/ClassA.md"
},
{
"title": "ClassB",
"kind": 128,
"path": "package-7/module-1/submodules/submodule-3-with-modules/nested-submodule-2/classes/ClassB.md"
}
]
}
]
}
]
}
]
}
]
},
{
"title": "module-2",
"kind": 2,
"path": "package-7/module-2/index.md",
"children": [
{
"title": "Classes",
"children": [
{
"title": "ClassA",
"kind": 128,
"path": "package-7/module-2/classes/ClassA.md"
},
{
"title": "ClassB",
"kind": 128,
"path": "package-7/module-2/classes/ClassB.md"
}
]
}
]
}
],
"path": "package-7/index.md"
}
]"
`;
Expand Down Expand Up @@ -402,6 +507,111 @@ exports[`Navigation should get Navigation Json for packages: (Output File Strate
}
],
"path": "package-6.md"
},
{
"title": "package-7",
"kind": 2,
"children": [
{
"title": "module-1",
"kind": 2,
"path": "package-7/module-1/README.md",
"children": [
{
"title": "Classes",
"children": [
{
"title": "ClassA",
"kind": 128,
"path": "package-7/module-1/classes/ClassA.md"
},
{
"title": "ClassB",
"kind": 128,
"path": "package-7/module-1/classes/ClassB.md"
}
]
},
{
"title": "submodules",
"children": [
{
"title": "submodule-3-with-modules",
"children": [
{
"title": "nested-submodule-1",
"kind": 2,
"path": "package-7/module-1/submodules/submodule-3-with-modules/nested-submodule-1/README.md",
"children": [
{
"title": "Classes",
"children": [
{
"title": "ClassA",
"kind": 128,
"path": "package-7/module-1/submodules/submodule-3-with-modules/nested-submodule-1/classes/ClassA.md"
},
{
"title": "ClassB",
"kind": 128,
"path": "package-7/module-1/submodules/submodule-3-with-modules/nested-submodule-1/classes/ClassB.md"
}
]
}
]
},
{
"title": "nested-submodule-2",
"kind": 2,
"path": "package-7/module-1/submodules/submodule-3-with-modules/nested-submodule-2/README.md",
"children": [
{
"title": "Classes",
"children": [
{
"title": "ClassA",
"kind": 128,
"path": "package-7/module-1/submodules/submodule-3-with-modules/nested-submodule-2/classes/ClassA.md"
},
{
"title": "ClassB",
"kind": 128,
"path": "package-7/module-1/submodules/submodule-3-with-modules/nested-submodule-2/classes/ClassB.md"
}
]
}
]
}
]
}
]
}
]
},
{
"title": "module-2",
"kind": 2,
"path": "package-7/module-2/README.md",
"children": [
{
"title": "Classes",
"children": [
{
"title": "ClassA",
"kind": 128,
"path": "package-7/module-2/classes/ClassA.md"
},
{
"title": "ClassB",
"kind": 128,
"path": "package-7/module-2/classes/ClassB.md"
}
]
}
]
}
],
"path": "package-7/README.md"
}
]"
`;
Expand Down Expand Up @@ -541,6 +751,23 @@ exports[`Navigation should get Navigation Json for packages: (Output File Strate
}
],
"path": "package-6.md"
},
{
"title": "package-7",
"kind": 2,
"children": [
{
"title": "module-1",
"kind": 2,
"path": "package-7/module-1.md"
},
{
"title": "module-2",
"kind": 2,
"path": "package-7/module-2.md"
}
],
"path": "package-7/index.md"
}
]"
`;
Expand Down Expand Up @@ -674,6 +901,23 @@ exports[`Navigation should get Navigation Json for packages: (Output File Strate
}
],
"path": "package-6.md"
},
{
"title": "package-7",
"kind": 2,
"children": [
{
"title": "module-1",
"kind": 2,
"path": "package-7/module-1.md"
},
{
"title": "module-2",
"kind": 2,
"path": "package-7/module-2.md"
}
],
"path": "package-7/README.md"
}
]"
`;
Expand Down
Expand Up @@ -27,6 +27,7 @@ exports[`Packages should compile index page for packages: (Output File Strategy
- [package-4](package-4/index.md)
- [package-5](package-5/package-5.md)
- [package-6](package-6.md)
- [package-7](package-7/index.md)
"
`;

Expand Down Expand Up @@ -183,6 +184,7 @@ Some text.
| [package-4](package-4/README.md) | - | - |
| [package-5](package-5/package-5.md) | - | - |
| [package-6](package-6.md) | - | - |
| [package-7](package-7/README.md) | - | - |
"
`;

Expand Down

0 comments on commit 1cb7f81

Please sign in to comment.