katex 0.16.32 → 0.16.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/README.md +3 -3
  2. package/contrib/auto-render/{auto-render.js → auto-render.ts} +41 -19
  3. package/contrib/auto-render/{splitAtDelimiters.js → splitAtDelimiters.ts} +18 -4
  4. package/contrib/auto-render/test/{auto-render-spec.js → auto-render-spec.ts} +10 -2
  5. package/contrib/copy-tex/README.md +2 -2
  6. package/contrib/copy-tex/{copy-tex.js → copy-tex.ts} +4 -6
  7. package/contrib/copy-tex/{katex2tex.js → katex2tex.ts} +2 -3
  8. package/contrib/mathtex-script-type/README.md +5 -5
  9. package/contrib/mhchem/README.md +1 -1
  10. package/contrib/render-a11y-string/{render-a11y-string.js → render-a11y-string.ts} +18 -33
  11. package/contrib/render-a11y-string/test/{render-a11y-string-spec.js → render-a11y-string-spec.ts} +0 -1
  12. package/dist/README.md +3 -3
  13. package/dist/contrib/auto-render.js +24 -57
  14. package/dist/contrib/auto-render.min.js +1 -1
  15. package/dist/contrib/auto-render.mjs +16586 -210
  16. package/dist/contrib/copy-tex.js +23 -37
  17. package/dist/contrib/copy-tex.min.js +1 -1
  18. package/dist/contrib/copy-tex.mjs +77 -95
  19. package/dist/contrib/mathtex-script-type.js +0 -3
  20. package/dist/contrib/mathtex-script-type.mjs +16427 -4
  21. package/dist/contrib/mhchem.js +55 -303
  22. package/dist/contrib/mhchem.mjs +12884 -723
  23. package/dist/contrib/render-a11y-string.js +13 -108
  24. package/dist/contrib/render-a11y-string.min.js +1 -1
  25. package/dist/contrib/render-a11y-string.mjs +17020 -760
  26. package/dist/katex-swap.css +2 -1
  27. package/dist/katex-swap.min.css +1 -1
  28. package/dist/katex.css +2 -1
  29. package/dist/katex.js +4547 -5680
  30. package/dist/katex.min.css +1 -1
  31. package/dist/katex.min.js +1 -1
  32. package/dist/katex.mjs +11854 -13828
  33. package/{katex.js → katex.ts} +8 -5
  34. package/package.json +34 -31
  35. package/src/{Lexer.js → Lexer.ts} +1 -2
  36. package/src/{MacroExpander.js → MacroExpander.ts} +11 -15
  37. package/src/{Namespace.js → Namespace.ts} +4 -6
  38. package/src/{Options.js → Options.ts} +7 -12
  39. package/src/{ParseError.js → ParseError.ts} +16 -26
  40. package/src/{Parser.js → Parser.ts} +68 -56
  41. package/src/{Settings.js → Settings.ts} +70 -70
  42. package/src/{SourceLocation.js → SourceLocation.ts} +6 -7
  43. package/src/{Style.js → Style.ts} +4 -5
  44. package/src/{Token.js → Token.ts} +8 -6
  45. package/src/{buildCommon.js → buildCommon.ts} +62 -55
  46. package/src/{buildHTML.js → buildHTML.ts} +29 -25
  47. package/src/{buildMathML.js → buildMathML.ts} +15 -13
  48. package/src/{buildTree.js → buildTree.ts} +1 -2
  49. package/src/{defineEnvironment.js → defineEnvironment.ts} +26 -27
  50. package/src/{defineFunction.js → defineFunction.ts} +54 -56
  51. package/src/{defineMacro.js → defineMacro.ts} +12 -13
  52. package/src/{delimiter.js → delimiter.ts} +19 -17
  53. package/src/{domTree.js → domTree.ts} +94 -103
  54. package/src/environments/{array.js → array.ts} +109 -99
  55. package/src/environments/{cd.js → cd.ts} +9 -11
  56. package/src/{environments.js → environments.ts} +0 -1
  57. package/src/{fontMetrics.js → fontMetrics.ts} +10 -12
  58. package/src/fontMetricsData.d.ts +3 -0
  59. package/src/functions/{accent.js → accent.ts} +1 -2
  60. package/src/functions/{accentunder.js → accentunder.ts} +0 -1
  61. package/src/functions/{arrow.js → arrow.ts} +4 -6
  62. package/src/functions/{char.js → char.ts} +0 -1
  63. package/src/functions/{color.js → color.ts} +5 -6
  64. package/src/functions/{cr.js → cr.ts} +0 -1
  65. package/src/functions/{def.js → def.ts} +9 -7
  66. package/src/functions/{delimsizing.js → delimsizing.ts} +11 -9
  67. package/src/functions/{enclose.js → enclose.ts} +3 -4
  68. package/src/functions/{environment.js → environment.ts} +2 -3
  69. package/src/functions/{font.js → font.ts} +4 -4
  70. package/src/functions/{genfrac.js → genfrac.ts} +14 -15
  71. package/src/functions/{hbox.js → hbox.ts} +0 -1
  72. package/src/functions/{horizBrace.js → horizBrace.ts} +4 -5
  73. package/src/functions/{href.js → href.ts} +4 -4
  74. package/src/functions/{html.js → html.ts} +3 -3
  75. package/src/functions/{htmlmathml.js → htmlmathml.ts} +0 -1
  76. package/src/functions/{includegraphics.js → includegraphics.ts} +0 -1
  77. package/src/functions/{kern.js → kern.ts} +0 -1
  78. package/src/functions/{lap.js → lap.ts} +0 -1
  79. package/src/functions/{math.js → math.ts} +0 -1
  80. package/src/functions/{mathchoice.js → mathchoice.ts} +2 -2
  81. package/src/functions/{mclass.js → mclass.ts} +5 -6
  82. package/src/functions/{op.js → op.ts} +9 -11
  83. package/src/functions/{operatorname.js → operatorname.ts} +4 -7
  84. package/src/functions/{ordgroup.js → ordgroup.ts} +0 -2
  85. package/src/functions/{overline.js → overline.ts} +0 -1
  86. package/src/functions/{phantom.js → phantom.ts} +0 -1
  87. package/src/functions/{pmb.js → pmb.ts} +0 -1
  88. package/src/functions/{raisebox.js → raisebox.ts} +0 -1
  89. package/src/functions/{relax.js → relax.ts} +0 -1
  90. package/src/functions/{rule.js → rule.ts} +0 -1
  91. package/src/functions/{sizing.js → sizing.ts} +0 -1
  92. package/src/functions/{smash.js → smash.ts} +2 -4
  93. package/src/functions/{sqrt.js → sqrt.ts} +0 -1
  94. package/src/functions/{styling.js → styling.ts} +3 -3
  95. package/src/functions/{supsub.js → supsub.ts} +6 -8
  96. package/src/functions/{symbolsOp.js → symbolsOp.ts} +0 -2
  97. package/src/functions/{symbolsOrd.js → symbolsOrd.ts} +1 -2
  98. package/src/functions/{symbolsSpacing.js → symbolsSpacing.ts} +2 -3
  99. package/src/functions/{tag.js → tag.ts} +0 -2
  100. package/src/functions/{text.js → text.ts} +7 -6
  101. package/src/functions/{underline.js → underline.ts} +0 -1
  102. package/src/functions/utils/{assembleSupSub.js → assembleSupSub.ts} +2 -3
  103. package/src/functions/{vcenter.js → vcenter.ts} +0 -2
  104. package/src/functions/{verb.js → verb.ts} +0 -1
  105. package/src/{functions.js → functions.ts} +0 -1
  106. package/src/{macros.js → macros.ts} +10 -8
  107. package/src/{mathMLTree.js → mathMLTree.ts} +5 -6
  108. package/src/parseNode.ts +522 -0
  109. package/src/{parseTree.js → parseTree.ts} +5 -3
  110. package/src/{spacingData.js → spacingData.ts} +11 -12
  111. package/src/{stretchy.js → stretchy.ts} +7 -7
  112. package/src/styles/katex-swap.scss +1 -4
  113. package/src/styles/katex.scss +9 -0
  114. package/src/{svgGeometry.js → svgGeometry.ts} +1 -2
  115. package/src/{symbols.js → symbols.ts} +6 -6
  116. package/src/{tree.js → tree.ts} +5 -7
  117. package/src/{types.js → types.ts} +1 -2
  118. package/src/unicodeAccents.js +4 -1
  119. package/src/{unicodeScripts.js → unicodeScripts.ts} +1 -3
  120. package/src/{unicodeSupOrSub.js → unicodeSupOrSub.ts} +1 -1
  121. package/src/unicodeSymbols.js +4 -3
  122. package/src/{units.js → units.ts} +2 -4
  123. package/src/{utils.js → utils.ts} +2 -3
  124. package/src/{wide-character.js → wide-character.ts} +8 -10
  125. package/types/katex.d.ts +13 -12
  126. package/src/parseNode.js +0 -523
package/src/parseNode.js DELETED
@@ -1,523 +0,0 @@
1
- // @flow
2
- import {NON_ATOMS} from "./symbols";
3
- import type SourceLocation from "./SourceLocation";
4
- import type {AlignSpec, ColSeparationType} from "./environments/array";
5
- import type {Atom} from "./symbols";
6
- import type {Mode, StyleStr} from "./types";
7
- import type {Token} from "./Token";
8
- import type {Measurement} from "./units";
9
-
10
- export type NodeType = $Keys<ParseNodeTypes>;
11
- export type ParseNode<TYPE: NodeType> = $ElementType<ParseNodeTypes, TYPE>;
12
-
13
- // ParseNode's corresponding to Symbol `Group`s in symbols.js.
14
- export type SymbolParseNode =
15
- ParseNode<"atom"> |
16
- ParseNode<"accent-token"> |
17
- ParseNode<"mathord"> |
18
- ParseNode<"op-token"> |
19
- ParseNode<"spacing"> |
20
- ParseNode<"textord">;
21
-
22
- // ParseNode from `Parser.formatUnsupportedCmd`
23
- export type UnsupportedCmdParseNode = ParseNode<"color">;
24
-
25
- // Union of all possible `ParseNode<>` types.
26
- export type AnyParseNode = $Values<ParseNodeTypes>;
27
-
28
- // Map from `NodeType` to the corresponding `ParseNode`.
29
- type ParseNodeTypes = {
30
- "array": {|
31
- type: "array",
32
- mode: Mode,
33
- loc?: ?SourceLocation,
34
- colSeparationType?: ColSeparationType,
35
- hskipBeforeAndAfter?: boolean,
36
- addJot?: boolean,
37
- cols?: AlignSpec[],
38
- arraystretch: number,
39
- body: AnyParseNode[][], // List of rows in the (2D) array.
40
- rowGaps: (?Measurement)[],
41
- hLinesBeforeRow: Array<boolean[]>,
42
- // Whether each row should be automatically numbered, or an explicit tag
43
- tags?: (boolean | AnyParseNode[])[],
44
- leqno?: boolean,
45
- isCD?: boolean,
46
- |},
47
- "cdlabel": {|
48
- type: "cdlabel",
49
- mode: Mode,
50
- loc?: ?SourceLocation,
51
- side: string,
52
- label: AnyParseNode,
53
- |},
54
- "cdlabelparent": {|
55
- type: "cdlabelparent",
56
- mode: Mode,
57
- loc?: ?SourceLocation,
58
- fragment: AnyParseNode,
59
- |},
60
- "color": {|
61
- type: "color",
62
- mode: Mode,
63
- loc?: ?SourceLocation,
64
- color: string,
65
- body: AnyParseNode[],
66
- |},
67
- "color-token": {|
68
- type: "color-token",
69
- mode: Mode,
70
- loc?: ?SourceLocation,
71
- color: string,
72
- |},
73
- // To avoid requiring run-time type assertions, this more carefully captures
74
- // the requirements on the fields per the op.js htmlBuilder logic:
75
- // - `body` and `value` are NEVER set simultaneously.
76
- // - When `symbol` is true, `body` is set.
77
- "op": {|
78
- type: "op",
79
- mode: Mode,
80
- loc?: ?SourceLocation,
81
- limits: boolean,
82
- alwaysHandleSupSub?: boolean,
83
- suppressBaseShift?: boolean,
84
- parentIsSupSub: boolean,
85
- symbol: boolean,
86
- name: string,
87
- body?: void,
88
- |} | {|
89
- type: "op",
90
- mode: Mode,
91
- loc?: ?SourceLocation,
92
- limits: boolean,
93
- alwaysHandleSupSub?: boolean,
94
- suppressBaseShift?: boolean,
95
- parentIsSupSub: boolean,
96
- symbol: false, // If 'symbol' is true, `body` *must* be set.
97
- name?: void,
98
- body: AnyParseNode[],
99
- |},
100
- "ordgroup": {|
101
- type: "ordgroup",
102
- mode: Mode,
103
- loc?: ?SourceLocation,
104
- body: AnyParseNode[],
105
- semisimple?: boolean,
106
- |},
107
- "raw": {|
108
- type: "raw",
109
- mode: Mode,
110
- loc?: ?SourceLocation,
111
- string: string,
112
- |},
113
- "size": {|
114
- type: "size",
115
- mode: Mode,
116
- loc?: ?SourceLocation,
117
- value: Measurement,
118
- isBlank: boolean,
119
- |},
120
- "styling": {|
121
- type: "styling",
122
- mode: Mode,
123
- loc?: ?SourceLocation,
124
- style: StyleStr,
125
- body: AnyParseNode[],
126
- |},
127
- "supsub": {|
128
- type: "supsub",
129
- mode: Mode,
130
- loc?: ?SourceLocation,
131
- base: ?AnyParseNode,
132
- sup?: ?AnyParseNode,
133
- sub?: ?AnyParseNode,
134
- |},
135
- "tag": {|
136
- type: "tag",
137
- mode: Mode,
138
- loc?: ?SourceLocation,
139
- body: AnyParseNode[],
140
- tag: AnyParseNode[],
141
- |},
142
- "text": {|
143
- type: "text",
144
- mode: Mode,
145
- loc?: ?SourceLocation,
146
- body: AnyParseNode[],
147
- font?: string,
148
- |},
149
- "url": {|
150
- type: "url",
151
- mode: Mode,
152
- loc?: ?SourceLocation,
153
- url: string,
154
- |},
155
- "verb": {|
156
- type: "verb",
157
- mode: Mode,
158
- loc?: ?SourceLocation,
159
- body: string,
160
- star: boolean,
161
- |},
162
- // From symbol groups, constructed in Parser.js via `symbols` lookup.
163
- // (Some of these have "-token" suffix to distinguish them from existing
164
- // `ParseNode` types.)
165
- "atom": {|
166
- type: "atom",
167
- family: Atom,
168
- mode: Mode,
169
- loc?: ?SourceLocation,
170
- text: string,
171
- |},
172
- "mathord": {|
173
- type: "mathord",
174
- mode: Mode,
175
- loc?: ?SourceLocation,
176
- text: string,
177
- |},
178
- "spacing": {|
179
- type: "spacing",
180
- mode: Mode,
181
- loc?: ?SourceLocation,
182
- text: string,
183
- |},
184
- "textord": {|
185
- type: "textord",
186
- mode: Mode,
187
- loc?: ?SourceLocation,
188
- text: string,
189
- |},
190
- // These "-token" types don't have corresponding HTML/MathML builders.
191
- "accent-token": {|
192
- type: "accent-token",
193
- mode: Mode,
194
- loc?: ?SourceLocation,
195
- text: string,
196
- |},
197
- "op-token": {|
198
- type: "op-token",
199
- mode: Mode,
200
- loc?: ?SourceLocation,
201
- text: string,
202
- |},
203
- // From functions.js and functions/*.js. See also "color", "op", "styling",
204
- // and "text" above.
205
- "accent": {|
206
- type: "accent",
207
- mode: Mode,
208
- loc?: ?SourceLocation,
209
- label: string,
210
- isStretchy?: boolean,
211
- isShifty?: boolean,
212
- base: AnyParseNode,
213
- |},
214
- "accentUnder": {|
215
- type: "accentUnder",
216
- mode: Mode,
217
- loc?: ?SourceLocation,
218
- label: string,
219
- isStretchy?: boolean,
220
- isShifty?: boolean,
221
- base: AnyParseNode,
222
- |},
223
- "cr": {|
224
- type: "cr",
225
- mode: Mode,
226
- loc?: ?SourceLocation,
227
- newLine: boolean,
228
- size: ?Measurement,
229
- |},
230
- "delimsizing": {|
231
- type: "delimsizing",
232
- mode: Mode,
233
- loc?: ?SourceLocation,
234
- size: 1 | 2 | 3 | 4,
235
- mclass: "mopen" | "mclose" | "mrel" | "mord",
236
- delim: string,
237
- |},
238
- "enclose": {|
239
- type: "enclose",
240
- mode: Mode,
241
- loc?: ?SourceLocation,
242
- label: string,
243
- backgroundColor?: string,
244
- borderColor?: string,
245
- body: AnyParseNode,
246
- |},
247
- "environment": {|
248
- type: "environment",
249
- mode: Mode,
250
- loc?: ?SourceLocation,
251
- name: string,
252
- nameGroup: AnyParseNode,
253
- |},
254
- "font": {|
255
- type: "font",
256
- mode: Mode,
257
- loc?: ?SourceLocation,
258
- font: string,
259
- body: AnyParseNode,
260
- |},
261
- "genfrac": {|
262
- type: "genfrac",
263
- mode: Mode,
264
- loc?: ?SourceLocation,
265
- continued: boolean,
266
- numer: AnyParseNode,
267
- denom: AnyParseNode,
268
- hasBarLine: boolean,
269
- leftDelim: ?string,
270
- rightDelim: ?string,
271
- barSize: Measurement | null,
272
- |},
273
- "hbox": {|
274
- type: "hbox",
275
- mode: Mode,
276
- loc?: ?SourceLocation,
277
- body: AnyParseNode[],
278
- |},
279
- "horizBrace": {|
280
- type: "horizBrace",
281
- mode: Mode,
282
- loc?: ?SourceLocation,
283
- label: string,
284
- isOver: boolean,
285
- base: AnyParseNode,
286
- |},
287
- "href": {|
288
- type: "href",
289
- mode: Mode,
290
- loc?: ?SourceLocation,
291
- href: string,
292
- body: AnyParseNode[],
293
- |},
294
- "html": {|
295
- type: "html",
296
- mode: Mode,
297
- loc?: ?SourceLocation,
298
- attributes: {[string]: string},
299
- body: AnyParseNode[],
300
- |},
301
- "htmlmathml": {|
302
- type: "htmlmathml",
303
- mode: Mode,
304
- loc?: ?SourceLocation,
305
- html: AnyParseNode[],
306
- mathml: AnyParseNode[],
307
- |},
308
- "includegraphics": {|
309
- type: "includegraphics",
310
- mode: Mode,
311
- loc?: ?SourceLocation,
312
- alt: string,
313
- width: Measurement,
314
- height: Measurement,
315
- totalheight: Measurement,
316
- src: string,
317
- |},
318
- "infix": {|
319
- type: "infix",
320
- mode: Mode,
321
- loc?: ?SourceLocation,
322
- replaceWith: string,
323
- size?: Measurement,
324
- token: ?Token,
325
- |},
326
- "internal": {|
327
- type: "internal",
328
- mode: Mode,
329
- loc?: ?SourceLocation,
330
- |},
331
- "kern": {|
332
- type: "kern",
333
- mode: Mode,
334
- loc?: ?SourceLocation,
335
- dimension: Measurement,
336
- |},
337
- "lap": {|
338
- type: "lap",
339
- mode: Mode,
340
- loc?: ?SourceLocation,
341
- alignment: string,
342
- body: AnyParseNode,
343
- |},
344
- "leftright": {|
345
- type: "leftright",
346
- mode: Mode,
347
- loc?: ?SourceLocation,
348
- body: AnyParseNode[],
349
- left: string,
350
- right: string,
351
- rightColor: ?string, // undefined means "inherit"
352
- |},
353
- "leftright-right": {|
354
- type: "leftright-right",
355
- mode: Mode,
356
- loc?: ?SourceLocation,
357
- delim: string,
358
- color: ?string, // undefined means "inherit"
359
- |},
360
- "mathchoice": {|
361
- type: "mathchoice",
362
- mode: Mode,
363
- loc?: ?SourceLocation,
364
- display: AnyParseNode[],
365
- text: AnyParseNode[],
366
- script: AnyParseNode[],
367
- scriptscript: AnyParseNode[],
368
- |},
369
- "middle": {|
370
- type: "middle",
371
- mode: Mode,
372
- loc?: ?SourceLocation,
373
- delim: string,
374
- |},
375
- "mclass": {|
376
- type: "mclass",
377
- mode: Mode,
378
- loc?: ?SourceLocation,
379
- mclass: string,
380
- body: AnyParseNode[],
381
- isCharacterBox: boolean,
382
- |},
383
- "operatorname": {|
384
- type: "operatorname",
385
- mode: Mode,
386
- loc?: ?SourceLocation,
387
- body: AnyParseNode[],
388
- alwaysHandleSupSub: boolean,
389
- limits: boolean,
390
- parentIsSupSub: boolean,
391
- |},
392
- "overline": {|
393
- type: "overline",
394
- mode: Mode,
395
- loc?: ?SourceLocation,
396
- body: AnyParseNode,
397
- |},
398
- "phantom": {|
399
- type: "phantom",
400
- mode: Mode,
401
- loc?: ?SourceLocation,
402
- body: AnyParseNode[],
403
- |},
404
- "hphantom": {|
405
- type: "hphantom",
406
- mode: Mode,
407
- loc?: ?SourceLocation,
408
- body: AnyParseNode,
409
- |},
410
- "vphantom": {|
411
- type: "vphantom",
412
- mode: Mode,
413
- loc?: ?SourceLocation,
414
- body: AnyParseNode,
415
- |},
416
- "pmb": {|
417
- type: "pmb",
418
- mode: Mode,
419
- loc?: ?SourceLocation,
420
- mclass: string,
421
- body: AnyParseNode[],
422
- |},
423
- "raisebox": {|
424
- type: "raisebox",
425
- mode: Mode,
426
- loc?: ?SourceLocation,
427
- dy: Measurement,
428
- body: AnyParseNode,
429
- |},
430
- "rule": {|
431
- type: "rule",
432
- mode: Mode,
433
- loc?: ?SourceLocation,
434
- shift: ?Measurement,
435
- width: Measurement,
436
- height: Measurement,
437
- |},
438
- "sizing": {|
439
- type: "sizing",
440
- mode: Mode,
441
- loc?: ?SourceLocation,
442
- size: number,
443
- body: AnyParseNode[],
444
- |},
445
- "smash": {|
446
- type: "smash",
447
- mode: Mode,
448
- loc?: ?SourceLocation,
449
- body: AnyParseNode,
450
- smashHeight: boolean,
451
- smashDepth: boolean,
452
- |},
453
- "sqrt": {|
454
- type: "sqrt",
455
- mode: Mode,
456
- loc?: ?SourceLocation,
457
- body: AnyParseNode,
458
- index: ?AnyParseNode,
459
- |},
460
- "underline": {|
461
- type: "underline",
462
- mode: Mode,
463
- loc?: ?SourceLocation,
464
- body: AnyParseNode,
465
- |},
466
- "vcenter": {|
467
- type: "vcenter",
468
- mode: Mode,
469
- loc?: ?SourceLocation,
470
- body: AnyParseNode,
471
- |},
472
- "xArrow": {|
473
- type: "xArrow",
474
- mode: Mode,
475
- loc?: ?SourceLocation,
476
- label: string,
477
- body: AnyParseNode,
478
- below: ?AnyParseNode,
479
- |},
480
- };
481
-
482
- /**
483
- * Asserts that the node is of the given type and returns it with stricter
484
- * typing. Throws if the node's type does not match.
485
- */
486
- export function assertNodeType<NODETYPE: NodeType>(
487
- node: ?AnyParseNode,
488
- type: NODETYPE,
489
- ): ParseNode<NODETYPE> {
490
- if (!node || node.type !== type) {
491
- throw new Error(
492
- `Expected node of type ${type}, but got ` +
493
- (node ? `node of type ${node.type}` : String(node)));
494
- }
495
- // $FlowFixMe, >=0.125
496
- return node;
497
- }
498
-
499
- /**
500
- * Returns the node more strictly typed iff it is of the given type. Otherwise,
501
- * returns null.
502
- */
503
- export function assertSymbolNodeType(node: ?AnyParseNode): SymbolParseNode {
504
- const typedNode = checkSymbolNodeType(node);
505
- if (!typedNode) {
506
- throw new Error(
507
- `Expected node of symbol group type, but got ` +
508
- (node ? `node of type ${node.type}` : String(node)));
509
- }
510
- return typedNode;
511
- }
512
-
513
- /**
514
- * Returns the node more strictly typed iff it is of the given type. Otherwise,
515
- * returns null.
516
- */
517
- export function checkSymbolNodeType(node: ?AnyParseNode): ?SymbolParseNode {
518
- if (node && (node.type === "atom" || NON_ATOMS.hasOwnProperty(node.type))) {
519
- // $FlowFixMe
520
- return node;
521
- }
522
- return null;
523
- }