@@ -62,7 +62,8 @@ typeParameterList
6262
6363typeParameter
6464 // Compatibility with old grammar: support both constraint and default type
65- : identifierName constraint? (' =' type_)?
65+ // TypeScript 5.0+: const type parameters <const T>
66+ : Const? (In | Out)? identifierName constraint? (' =' type_)?
6667 | typeParameters
6768 ;
6869
@@ -372,6 +373,7 @@ statement
372373 | generatorFunctionDeclaration
373374 | typeAliasDeclaration // ADDED
374375 | enumDeclaration // ADDED
376+ | usingStatement // TypeScript 5.2+ explicit resource management
375377 ;
376378
377379block
@@ -568,6 +570,11 @@ debuggerStatement
568570 : Debugger eos
569571 ;
570572
573+ // TypeScript 5.2+ explicit resource management
574+ usingStatement
575+ : Await? Using identifier typeAnnotation? ' =' singleExpression eos
576+ ;
577+
571578functionDeclaration
572579 : Async? Function_ ' *' ? identifierName callSignature ((' {' functionBody ' }' ) | SemiColon)
573580 ;
@@ -617,10 +624,13 @@ propertyMemberDeclaration
617624 | propertyMemberBase propertyName callSignature ((' {' functionBody ' }' ) | SemiColon) # MethodDeclarationExpression
618625 | propertyMemberBase (getAccessor | setAccessor) # GetterSetterDeclarationExpression
619626 | abstractDeclaration # AbstractMemberDeclaration
627+ // TypeScript 4.9+ auto-accessors
628+ | propertyMemberBase Accessor propertyName (' ?' | ' !' )? typeAnnotation? initializer? SemiColon # AutoAccessorDeclaration
620629 ;
621630
622631propertyMemberBase
623- : accessibilityModifier? Async? Static? ReadOnly?
632+ // TypeScript 4.3+ override modifier
633+ : accessibilityModifier? Override? Async? Static? ReadOnly?
624634 ;
625635
626636indexMemberDeclaration
@@ -807,6 +817,8 @@ singleExpression
807817 | singleExpression As asExpression # CastAsExpression
808818// TypeScript v2.0
809819 | singleExpression ' !' # NonNullAssertionExpression
820+ // TypeScript v4.9+
821+ | singleExpression Satisfies type_ # SatisfiesExpression
810822 ;
811823
812824asExpression
@@ -929,6 +941,16 @@ identifier
929941 | Constructor
930942 | Namespace
931943 | Abstract
944+ // TypeScript 4.9+ contextual keywords
945+ | Satisfies
946+ | Accessor
947+ | Override
948+ // TypeScript 5.0+ contextual keywords
949+ | Infer
950+ | Asserts
951+ | Out
952+ // TypeScript 5.2+ contextual keywords
953+ | Using
932954 ;
933955
934956identifierOrKeyWord
0 commit comments