mirror of
https://github.com/discordjs/discord.js.git
synced 2024-08-21 06:14:41 +12:00
fix: treat primitives as references instead of content (#9932)
* fix: treat primitives as references instead of content * chore: add typeof keyword * fix: add missing keywords
This commit is contained in:
parent
aad82f088b
commit
a87b267fba
1 changed files with 23 additions and 0 deletions
|
@ -135,6 +135,27 @@ export class ExcerptBuilder {
|
|||
return { startIndex: 0, endIndex: 0, typeParameters: [] };
|
||||
}
|
||||
|
||||
public static isPrimitiveKeyword(node: ts.Node): boolean {
|
||||
switch (node.kind) {
|
||||
case ts.SyntaxKind.AnyKeyword:
|
||||
case ts.SyntaxKind.BigIntKeyword:
|
||||
case ts.SyntaxKind.BooleanKeyword:
|
||||
case ts.SyntaxKind.NeverKeyword:
|
||||
case ts.SyntaxKind.NumberKeyword:
|
||||
case ts.SyntaxKind.ObjectKeyword:
|
||||
case ts.SyntaxKind.StringKeyword:
|
||||
case ts.SyntaxKind.SymbolKeyword:
|
||||
case ts.SyntaxKind.UnknownKeyword:
|
||||
case ts.SyntaxKind.VoidKeyword:
|
||||
case ts.SyntaxKind.TypeOfKeyword:
|
||||
case ts.SyntaxKind.UndefinedKeyword:
|
||||
case ts.SyntaxKind.NullKeyword:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static _buildSpan(excerptTokens: IExcerptToken[], span: Span, state: IBuildSpanState): boolean {
|
||||
if (span.kind === ts.SyntaxKind.JSDocComment) {
|
||||
// Discard any comments
|
||||
|
@ -162,6 +183,8 @@ export class ExcerptBuilder {
|
|||
|
||||
if (canonicalReference) {
|
||||
ExcerptBuilder._appendToken(excerptTokens, ExcerptTokenKind.Reference, span.prefix, canonicalReference);
|
||||
} else if (ExcerptBuilder.isPrimitiveKeyword(span.node)) {
|
||||
ExcerptBuilder._appendToken(excerptTokens, ExcerptTokenKind.Reference, span.prefix);
|
||||
} else {
|
||||
ExcerptBuilder._appendToken(excerptTokens, ExcerptTokenKind.Content, span.prefix);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue