@@ -270,3 +270,32 @@ project "My lib docs"
270270 to the first signature of the ` baz ` method: ` {@link @my/lib!Foo.baz:0} ` , but the ` Bam ` function
271271 is also merged with a type alias, so ` {@link @my/lib!Bam:0} ` could link to either the type alias
272272 or the first signature of the function.
273+
274+ ## Resolution Failures
275+
276+ When TypeDoc fails to resolve a link (and the
277+ [ validation.invalidLink option] ( options/validation.md#validation ) is set), TypeDoc will print
278+ a warning like the following:
279+
280+ > [ warning] Failed to resolve link to "Foo" in comment for @me/lib2 .Bop
281+
282+ With the resolution strategy in mind, we can now manually apply TypeDoc's link resolution algorithm
283+ to determine where the resolution went wrong.
284+
285+ 1 . The link doesn't contain ` ! ` , so it will be resolved as a local link, starting from the function ` @me/lib2.Bop `
286+ 2 . ` @my/lib2.Bop ` doesn't have any children named ` Foo `
287+ 3 . ` @my/lib2 ` doesn't have any children named ` Foo `
288+ 4 . The project doesn't directly have any children named ` Foo `
289+
290+ Given that we wanted to link to the ` Foo ` class in ` @my/lib ` , we have a couple options:
291+
292+ 1 . Change the link to ` {@link @my/lib!Foo} `
293+
294+ This is the recommended change as it means TypeDoc doesn't need to walk up multiple scopes
295+ to find the link, it can start at the project root, then go directly to the module and then
296+ the class.
297+
298+ 2 . Change the link to ` {@link "@my/lib".Foo} `
299+
300+ With this change, TypeDoc would resolve the link, but still has to check ` @my/lib2.Bop ` and ` @my/lib2 `
301+ for a child named ` @my/lib ` before reaching the root project.
0 commit comments