@@ -10,6 +10,8 @@ import type {
10
10
ApiParameterListMixin ,
11
11
ApiEvent ,
12
12
} from '@discordjs/api-extractor-model' ;
13
+ import type { DocDeclarationReference } from '@microsoft/tsdoc' ;
14
+ import { SelectorKind } from '@microsoft/tsdoc' ;
13
15
import type { DeclarationReference } from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference' ;
14
16
import { METHOD_SEPARATOR , OVERLOAD_SEPARATOR } from '~/util/constants' ;
15
17
import { resolveMembers } from '~/util/members' ;
@@ -26,7 +28,7 @@ export type ApiItemLike = {
26
28
27
29
interface ResolvedCanonicalReference {
28
30
item : ApiItemLike ;
29
- package : string ;
31
+ package : string | undefined ;
30
32
}
31
33
32
34
export function hasProperties ( item : ApiItemContainerMixin ) {
@@ -51,8 +53,11 @@ export function resolveItemURI(item: ApiItemLike): string {
51
53
: `${ item . parent . displayName } ${ OVERLOAD_SEPARATOR } ${ item . parent . kind } ${ METHOD_SEPARATOR } ${ item . displayName } ` ;
52
54
}
53
55
54
- export function resolveCanonicalReference ( canonicalReference : DeclarationReference ) : ResolvedCanonicalReference | null {
56
+ export function resolveCanonicalReference (
57
+ canonicalReference : DeclarationReference | DocDeclarationReference ,
58
+ ) : ResolvedCanonicalReference | null {
55
59
if (
60
+ 'source' in canonicalReference &&
56
61
canonicalReference . source &&
57
62
'packageName' in canonicalReference . source &&
58
63
canonicalReference . symbol ?. componentPath &&
@@ -68,6 +73,23 @@ export function resolveCanonicalReference(canonicalReference: DeclarationReferen
68
73
} |${ canonicalReference . symbol . componentPath . component . toString ( ) } `,
69
74
} ,
70
75
} ;
76
+ else if (
77
+ 'memberReferences' in canonicalReference &&
78
+ canonicalReference . memberReferences . length &&
79
+ canonicalReference . memberReferences [ 0 ] ?. memberIdentifier &&
80
+ canonicalReference . memberReferences [ 0 ] ?. selector ?. selectorKind === SelectorKind . System
81
+ ) {
82
+ const member = canonicalReference . memberReferences [ 0 ] ! ;
83
+ return {
84
+ package : canonicalReference . packageName ?. replace ( '@discordjs/' , '' ) ,
85
+ item : {
86
+ kind : member . selector ! . selector as ApiItemKind ,
87
+ displayName : member . memberIdentifier ! . identifier ,
88
+ containerKey : `|${ member . selector ! . selector } |${ member . memberIdentifier ! . identifier } ` ,
89
+ } ,
90
+ } ;
91
+ }
92
+
71
93
return null ;
72
94
}
73
95
0 commit comments