mirror of
https://github.com/SrIzan10/starlight-typedoc.git
synced 2026-05-01 11:05:15 +00:00
fix: link tag comment with no url (#94)
This commit is contained in:
5
.changeset/puny-pets-refuse.md
Normal file
5
.changeset/puny-pets-refuse.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'starlight-typedoc': patch
|
||||
---
|
||||
|
||||
Fixes a potential error when rendering link tags in comments that reference reflections without URLs.
|
||||
@@ -11,3 +11,11 @@ export interface Thing {
|
||||
}
|
||||
|
||||
export type Things = Thing[]
|
||||
|
||||
export type ThingWithBazAndQuux = Thing & {
|
||||
baz: string
|
||||
/**
|
||||
* @see {@link ThingWithBazAndQuux.baz}
|
||||
*/
|
||||
quux: number[]
|
||||
}
|
||||
|
||||
@@ -91,6 +91,11 @@ class StarlightTypeDocThemeRenderContext extends MarkdownThemeContext {
|
||||
(part.tag === '@link' || part.tag === '@linkcode' || part.tag === '@linkplain') &&
|
||||
part.target instanceof Reflection
|
||||
) {
|
||||
if (!this.router.hasUrl(part.target)) {
|
||||
const { target, ...rest } = part
|
||||
return rest
|
||||
}
|
||||
|
||||
return {
|
||||
...part,
|
||||
target: this.urlTo(part.target),
|
||||
|
||||
@@ -58,7 +58,7 @@ test('should generate the proper items for for a single entry point', async ({ d
|
||||
},
|
||||
{
|
||||
label: 'Type Aliases',
|
||||
items: [{ name: 'Things' }],
|
||||
items: [{ name: 'Things' }, { name: 'ThingWithBazAndQuux' }],
|
||||
collapsed: true,
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user