File tree Expand file tree Collapse file tree 1 file changed +73
-1
lines changed Expand file tree Collapse file tree 1 file changed +73
-1
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,78 @@ import type { DeclarationUrlFn } from "./declaration-url";
3
3
import { domPurify } from "./dom-purify" ;
4
4
import { highlighter } from "./highlighter" ;
5
5
6
+ const reservedKeywords = new Set ( [
7
+ "any" ,
8
+ "as" ,
9
+ "async" ,
10
+ "await" ,
11
+ "bigint" ,
12
+ "boolean" ,
13
+ "break" ,
14
+ "case" ,
15
+ "catch" ,
16
+ "class" ,
17
+ "const" ,
18
+ "constructor" ,
19
+ "continue" ,
20
+ "debugger" ,
21
+ "declare" ,
22
+ "default" ,
23
+ "delete" ,
24
+ "do" ,
25
+ "else" ,
26
+ "enum" ,
27
+ "export" ,
28
+ "extends" ,
29
+ "false" ,
30
+ "finally" ,
31
+ "for" ,
32
+ "from" ,
33
+ "function" ,
34
+ "get" ,
35
+ "if" ,
36
+ "implements" ,
37
+ "import" ,
38
+ "in" ,
39
+ "instanceof" ,
40
+ "interface" ,
41
+ "let" ,
42
+ "module" ,
43
+ "namespace" ,
44
+ "never" ,
45
+ "new" ,
46
+ "null" ,
47
+ "number" ,
48
+ "object" ,
49
+ "of" ,
50
+ "package" ,
51
+ "private" ,
52
+ "protected" ,
53
+ "public" ,
54
+ "readonly" ,
55
+ "require" ,
56
+ "return" ,
57
+ "set" ,
58
+ "static" ,
59
+ "string" ,
60
+ "super" ,
61
+ "switch" ,
62
+ "symbol" ,
63
+ "this" ,
64
+ "throw" ,
65
+ "true" ,
66
+ "try" ,
67
+ "type" ,
68
+ "typeof" ,
69
+ "undefined" ,
70
+ "unknown" ,
71
+ "var" ,
72
+ "void" ,
73
+ "while" ,
74
+ "with" ,
75
+ "yield" ,
76
+ ] ) ;
77
+
6
78
export const declarationSignatureHtml = (
7
79
declaration : AllExtractedDeclaration ,
8
80
declarationUrl : DeclarationUrlFn ,
@@ -21,7 +93,7 @@ export const declarationSignatureHtml = (
21
93
}
22
94
const text = firstChild . value ;
23
95
const url = declarationUrl ( text ) ;
24
- if ( text === declaration . name || ! url ) {
96
+ if ( text === declaration . name || ! url || reservedKeywords . has ( text ) ) {
25
97
return ;
26
98
}
27
99
if ( node . properties [ "style" ] === "color:#E36209;--shiki-dark:#FFAB70" ) {
You can’t perform that action at this time.
0 commit comments