Skip to content

Commit 2faf005

Browse files
Add support for 'unique symbol' type
1 parent 51c4c9e commit 2faf005

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

common/corpus/types.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,40 @@ let x: new < T1, T2 > ( p1, p2 ) => R;
272272
(type_identifier))))))
273273

274274

275+
=======================================
276+
Symbol types
277+
=======================================
278+
279+
const symFoo: unique symbol = Symbol("foo");
280+
const symBar: symbol = Symbol.for("bar");
281+
282+
---
283+
284+
(program
285+
(lexical_declaration
286+
(variable_declarator
287+
(identifier)
288+
(type_annotation
289+
(predefined_type))
290+
(call_expression
291+
(identifier)
292+
(arguments
293+
(string
294+
(string_fragment))))))
295+
(lexical_declaration
296+
(variable_declarator
297+
(identifier)
298+
(type_annotation
299+
(predefined_type))
300+
(call_expression
301+
(member_expression
302+
(identifier)
303+
(property_identifier))
304+
(arguments
305+
(string
306+
(string_fragment)))))))
307+
308+
275309
=======================================
276310
Type annotations in parenthesized expressions
277311
=======================================

common/define-grammar.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,7 @@ module.exports = function defineGrammar(dialect) {
834834
'boolean',
835835
'string',
836836
'symbol',
837+
alias(seq('unique', 'symbol'), 'unique symbol'),
837838
'void',
838839
'unknown',
839840
'string',

0 commit comments

Comments
 (0)