11# Third Party Symbols
22
33TypeDoc 0.22 added support for linking to third party sites by associating a symbol name with npm packages.
4- Plugins can add support for linking to third party sites by calling ` app.renderer.addUnknownSymbolResolver ` .
4+
5+ Since TypeDoc 0.23.13, some mappings can be defined without a plugin by setting ` externalSymbolLinkMappings ` .
6+ This should be set to an object whose keys are package names, and values are the ` . ` joined qualified name
7+ of the third party symbol. If the link was defined with a user created declaration reference, it may also
8+ have a ` :meaning ` at the end. TypeDoc will _ not_ attempt to perform fuzzy matching to remove the meaning from
9+ keys if not specified, so if meanings may be used, a url must be listed multiple times.
10+
11+ Global external symbols are supported, but may have surprising behavior. TypeDoc assumes that if a symbol was
12+ referenced from a package, it was exported from that package. This will be true for most native TypeScript packages,
13+ but packages which rely on ` @types ` will be linked according to that ` @types ` package for that package name.
14+
15+ Furthermore, types which are defined in the TypeScript lib files (including ` Array ` , ` Promise ` , ...) will be
16+ detected as belonging to the ` typescript ` package rather than the ` global ` package. In order to support both
17+ ` {@link !Promise} ` and references to the type within source code, both ` global ` and ` typescript ` need to be set.
18+
19+ ``` jsonc
20+ // typedoc.json
21+ {
22+ " externalSymbolLinkMappings" : {
23+ " global" : {
24+ // Handle {@link !Promise}
25+ " Promise" : " https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"
26+ },
27+ " typescript" : {
28+ // Handle type X = Promise<number>
29+ " Promise" : " https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"
30+ }
31+ }
32+ }
33+ ```
34+
35+ Plugins can add support for linking to third party sites by calling ` app.converter.addUnknownSymbolResolver ` .
536
637If the given symbol is unknown, or does not appear in the documentation site, the resolver may return ` undefined `
738and no link will be rendered unless provided by another resolver.
@@ -19,7 +50,9 @@ const knownSymbols = {
1950export function load(app : Application ) {
2051 app .converter .addUnknownSymbolResolver ((ref : DeclarationReference ) => {
2152 if (
53+ // TS defined symbols
2254 ref .moduleSource !== " @types/react" &&
55+ // User {@link} tags
2356 ref .moduleSource !== " react"
2457 ) {
2558 return ;
0 commit comments