diff --git a/packages/ast-spec/src/token/PunctuatorToken/PunctuatorTokenToText.ts b/packages/ast-spec/src/token/PunctuatorToken/PunctuatorTokenToText.ts index a3ab12ee856..174e98e6c6b 100644 --- a/packages/ast-spec/src/token/PunctuatorToken/PunctuatorTokenToText.ts +++ b/packages/ast-spec/src/token/PunctuatorToken/PunctuatorTokenToText.ts @@ -44,6 +44,8 @@ export interface PunctuatorTokenToText { [SyntaxKind.ColonToken]: ':'; [SyntaxKind.AtToken]: '@'; [SyntaxKind.QuestionQuestionToken]: '??'; + [SyntaxKind.BacktickToken]: '`'; + // [SyntaxKind.HashToken]: '#'; // new in PunctuationSyntaxKind in TS 4.4 [SyntaxKind.EqualsToken]: '='; [SyntaxKind.PlusEqualsToken]: '+='; [SyntaxKind.MinusEqualsToken]: '-='; @@ -56,8 +58,8 @@ export interface PunctuatorTokenToText { [SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken]: '>>>='; [SyntaxKind.AmpersandEqualsToken]: '&='; [SyntaxKind.BarEqualsToken]: '|='; - [SyntaxKind.BarBarEqualsToken]: '||='; - [SyntaxKind.AmpersandAmpersandEqualsToken]: '&&='; - [SyntaxKind.QuestionQuestionEqualsToken]: '??='; + [SyntaxKind.BarBarEqualsToken]: '||='; // included in PunctuationSyntaxKind in TS 4.4 + [SyntaxKind.AmpersandAmpersandEqualsToken]: '&&='; // included in PunctuationSyntaxKind in TS 4.4 + [SyntaxKind.QuestionQuestionEqualsToken]: '??='; // included in PunctuationSyntaxKind in TS 4.4 [SyntaxKind.CaretEqualsToken]: '^='; } diff --git a/packages/ast-spec/tests/PunctuatorTokenToText.test.ts b/packages/ast-spec/tests/PunctuatorTokenToText.test.ts new file mode 100644 index 00000000000..32deee0bea9 --- /dev/null +++ b/packages/ast-spec/tests/PunctuatorTokenToText.test.ts @@ -0,0 +1,11 @@ +import type { PunctuationSyntaxKind } from 'typescript'; + +import type { PunctuatorTokenToText } from '../src'; + +// @ts-expect-error: purposely unused +type _Test = { + readonly [T in PunctuationSyntaxKind]: PunctuatorTokenToText[T]; + // If there are any PunctuationSyntaxKind members that don't have a + // corresponding PunctuatorTokenToText, then this line will error with + // "Type 'T' cannot be used to index type 'PunctuatorTokenToText'." +};