diff --git a/packages/ast-spec/src/ast-node-types.ts b/packages/ast-spec/src/ast-node-types.ts index 90a18ba8d9e..9a38d477acf 100644 --- a/packages/ast-spec/src/ast-node-types.ts +++ b/packages/ast-spec/src/ast-node-types.ts @@ -135,7 +135,6 @@ export enum AST_NODE_TYPES { TSObjectKeyword = 'TSObjectKeyword', TSOptionalType = 'TSOptionalType', TSParameterProperty = 'TSParameterProperty', - TSParenthesizedType = 'TSParenthesizedType', TSPrivateKeyword = 'TSPrivateKeyword', TSPropertySignature = 'TSPropertySignature', TSProtectedKeyword = 'TSProtectedKeyword', diff --git a/packages/ast-spec/src/type/TSParenthesizedType/spec.ts b/packages/ast-spec/src/type/TSParenthesizedType/spec.ts deleted file mode 100644 index 2d20d5d2f2b..00000000000 --- a/packages/ast-spec/src/type/TSParenthesizedType/spec.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { AST_NODE_TYPES } from '../../ast-node-types'; -import type { BaseNode } from '../../base/BaseNode'; -import type { TypeNode } from '../../unions/TypeNode'; - -export interface TSParenthesizedType extends BaseNode { - type: AST_NODE_TYPES.TSParenthesizedType; - typeAnnotation: TypeNode; -} diff --git a/packages/ast-spec/src/type/spec.ts b/packages/ast-spec/src/type/spec.ts index bbbea76cbd8..d6209d26067 100644 --- a/packages/ast-spec/src/type/spec.ts +++ b/packages/ast-spec/src/type/spec.ts @@ -17,7 +17,6 @@ export * from './TSNullKeyword/spec'; export * from './TSNumberKeyword/spec'; export * from './TSObjectKeyword/spec'; export * from './TSOptionalType/spec'; -export * from './TSParenthesizedType/spec'; export * from './TSQualifiedName/spec'; export * from './TSRestType/spec'; export * from './TSStringKeyword/spec'; diff --git a/packages/ast-spec/src/unions/Node.ts b/packages/ast-spec/src/unions/Node.ts index f0802b3b685..7fe5ced96df 100644 --- a/packages/ast-spec/src/unions/Node.ts +++ b/packages/ast-spec/src/unions/Node.ts @@ -142,7 +142,6 @@ import type { TSNullKeyword } from '../type/TSNullKeyword/spec'; import type { TSNumberKeyword } from '../type/TSNumberKeyword/spec'; import type { TSObjectKeyword } from '../type/TSObjectKeyword/spec'; import type { TSOptionalType } from '../type/TSOptionalType/spec'; -import type { TSParenthesizedType } from '../type/TSParenthesizedType/spec'; import type { TSQualifiedName } from '../type/TSQualifiedName/spec'; import type { TSRestType } from '../type/TSRestType/spec'; import type { TSStringKeyword } from '../type/TSStringKeyword/spec'; @@ -293,7 +292,6 @@ export type Node = | TSObjectKeyword | TSOptionalType | TSParameterProperty - | TSParenthesizedType | TSPrivateKeyword | TSPropertySignature | TSProtectedKeyword diff --git a/packages/ast-spec/src/unions/TypeNode.ts b/packages/ast-spec/src/unions/TypeNode.ts index c50630e6cd6..55436b7a44d 100644 --- a/packages/ast-spec/src/unions/TypeNode.ts +++ b/packages/ast-spec/src/unions/TypeNode.ts @@ -18,7 +18,6 @@ import type { TSNullKeyword } from '../type/TSNullKeyword/spec'; import type { TSNumberKeyword } from '../type/TSNumberKeyword/spec'; import type { TSObjectKeyword } from '../type/TSObjectKeyword/spec'; import type { TSOptionalType } from '../type/TSOptionalType/spec'; -import type { TSParenthesizedType } from '../type/TSParenthesizedType/spec'; import type { TSRestType } from '../type/TSRestType/spec'; import type { TSStringKeyword } from '../type/TSStringKeyword/spec'; import type { TSSymbolKeyword } from '../type/TSSymbolKeyword/spec'; @@ -56,7 +55,6 @@ export type TypeNode = | TSNumberKeyword | TSObjectKeyword | TSOptionalType - | TSParenthesizedType | TSRestType | TSStringKeyword | TSSymbolKeyword diff --git a/packages/eslint-plugin/src/rules/array-type.ts b/packages/eslint-plugin/src/rules/array-type.ts index 8c97729623a..44de45f19de 100644 --- a/packages/eslint-plugin/src/rules/array-type.ts +++ b/packages/eslint-plugin/src/rules/array-type.ts @@ -132,13 +132,8 @@ export default util.createRule({ * @param node the node to be evaluated. */ function getMessageType(node: TSESTree.Node): string { - if (node) { - if (node.type === AST_NODE_TYPES.TSParenthesizedType) { - return getMessageType(node.typeAnnotation); - } - if (isSimpleType(node)) { - return sourceCode.getText(node); - } + if (node && isSimpleType(node)) { + return sourceCode.getText(node); } return 'T'; } @@ -172,11 +167,7 @@ export default util.createRule({ type: getMessageType(node.elementType), }, fix(fixer) { - const typeNode = - node.elementType.type === AST_NODE_TYPES.TSParenthesizedType - ? node.elementType.typeAnnotation - : node.elementType; - + const typeNode = node.elementType; const arrayType = isReadonly ? 'ReadonlyArray' : 'Array'; return [ @@ -244,9 +235,12 @@ export default util.createRule({ } const type = typeParams[0]; - const typeParens = typeNeedsParentheses(type); + const typeParens = + !util.isParenthesized(type, sourceCode) && typeNeedsParentheses(type); const parentParens = - readonlyPrefix && node.parent?.type === AST_NODE_TYPES.TSArrayType; + readonlyPrefix && + node.parent?.type === AST_NODE_TYPES.TSArrayType && + !util.isParenthesized(node.parent.elementType, sourceCode); const start = `${parentParens ? '(' : ''}${readonlyPrefix}${ typeParens ? '(' : '' diff --git a/packages/eslint-plugin/src/rules/indent-new-do-not-use/index.ts b/packages/eslint-plugin/src/rules/indent-new-do-not-use/index.ts index 68edfe18dbb..57342313596 100644 --- a/packages/eslint-plugin/src/rules/indent-new-do-not-use/index.ts +++ b/packages/eslint-plugin/src/rules/indent-new-do-not-use/index.ts @@ -161,7 +161,6 @@ const KNOWN_NODES = new Set([ AST_NODE_TYPES.TSModuleDeclaration, AST_NODE_TYPES.TSNonNullExpression, AST_NODE_TYPES.TSParameterProperty, - AST_NODE_TYPES.TSParenthesizedType, 'TSPlusToken', AST_NODE_TYPES.TSPropertySignature, AST_NODE_TYPES.TSQualifiedName, diff --git a/packages/eslint-plugin/src/rules/indent.ts b/packages/eslint-plugin/src/rules/indent.ts index a87772dd1f6..42b00617701 100644 --- a/packages/eslint-plugin/src/rules/indent.ts +++ b/packages/eslint-plugin/src/rules/indent.ts @@ -67,7 +67,6 @@ const KNOWN_NODES = new Set([ AST_NODE_TYPES.TSModuleDeclaration, AST_NODE_TYPES.TSNonNullExpression, AST_NODE_TYPES.TSParameterProperty, - AST_NODE_TYPES.TSParenthesizedType, 'TSPlusToken', AST_NODE_TYPES.TSPropertySignature, AST_NODE_TYPES.TSQualifiedName, diff --git a/packages/eslint-plugin/src/rules/no-extra-parens.ts b/packages/eslint-plugin/src/rules/no-extra-parens.ts index 6aa540a9be5..0eeeedf2c2f 100644 --- a/packages/eslint-plugin/src/rules/no-extra-parens.ts +++ b/packages/eslint-plugin/src/rules/no-extra-parens.ts @@ -84,9 +84,7 @@ export default util.createRule({ if ( node.arguments.length === 1 && node.typeParameters?.params.some( - param => - param.type === AST_NODE_TYPES.TSParenthesizedType || - param.type === AST_NODE_TYPES.TSImportType, + param => param.type === AST_NODE_TYPES.TSImportType, ) ) { return rule({ diff --git a/packages/eslint-plugin/src/rules/no-type-alias.ts b/packages/eslint-plugin/src/rules/no-type-alias.ts index cf56745ca90..4e16216ea72 100644 --- a/packages/eslint-plugin/src/rules/no-type-alias.ts +++ b/packages/eslint-plugin/src/rules/no-type-alias.ts @@ -311,9 +311,6 @@ export default util.createRule({ return acc; }, []); } - if (node.type === AST_NODE_TYPES.TSParenthesizedType) { - return getTypes(node.typeAnnotation, compositionType); - } return [{ node, compositionType }]; } diff --git a/packages/eslint-plugin/src/rules/sort-type-union-intersection-members.ts b/packages/eslint-plugin/src/rules/sort-type-union-intersection-members.ts index cfcab2c0b2c..e7f042162b8 100644 --- a/packages/eslint-plugin/src/rules/sort-type-union-intersection-members.ts +++ b/packages/eslint-plugin/src/rules/sort-type-union-intersection-members.ts @@ -23,9 +23,6 @@ enum Group { function getGroup(node: TSESTree.TypeNode): Group { switch (node.type) { - case AST_NODE_TYPES.TSParenthesizedType: - return getGroup(node.typeAnnotation); - case AST_NODE_TYPES.TSConditionalType: return Group.conditional; @@ -91,6 +88,10 @@ function getGroup(node: TSESTree.TypeNode): Group { } } +function requiresParentheses(node: TSESTree.TypeNode): boolean { + return node.type === AST_NODE_TYPES.TSFunctionType; +} + export type Options = [ { checkIntersections?: boolean; @@ -212,7 +213,7 @@ export default util.createRule({ const fix: TSESLint.ReportFixFunction = fixer => { const sorted = expectedOrder - .map(t => t.text) + .map(t => (requiresParentheses(t.node) ? `(${t.text})` : t.text)) .join( node.type === AST_NODE_TYPES.TSIntersectionType ? ' & ' : ' | ', ); diff --git a/packages/eslint-plugin/tests/rules/indent/indent.test.ts b/packages/eslint-plugin/tests/rules/indent/indent.test.ts index 8296bf19520..f5c87316c17 100644 --- a/packages/eslint-plugin/tests/rules/indent/indent.test.ts +++ b/packages/eslint-plugin/tests/rules/indent/indent.test.ts @@ -451,29 +451,6 @@ class Foo { `, ], }, - { - node: AST_NODE_TYPES.TSParenthesizedType, - code: [ - ` -const x: Array<( - | { - __typename: "Foo", - } - | { - __typename: "Baz", - } - | ( - | { - __typename: "Baz", - } - | { - __typename: "Buzz", - } - ) -)>; - `, - ], - }, // TSPlusToken - tested in TSMappedType { node: AST_NODE_TYPES.TSPropertySignature, diff --git a/packages/eslint-plugin/tests/rules/no-extra-parens.test.ts b/packages/eslint-plugin/tests/rules/no-extra-parens.test.ts index d0868e8293d..5f5dc37896f 100644 --- a/packages/eslint-plugin/tests/rules/no-extra-parens.test.ts +++ b/packages/eslint-plugin/tests/rules/no-extra-parens.test.ts @@ -28,7 +28,7 @@ for (a in b, c); for (a in b); a(1); new a(1); -a<(A)>(1); +a(1); `, }), ...batchedSingleLineTests({ diff --git a/packages/eslint-plugin/tests/rules/sort-type-union-intersection-members.test.ts b/packages/eslint-plugin/tests/rules/sort-type-union-intersection-members.test.ts index 7dda416d6b3..a0cf2d71dd5 100644 --- a/packages/eslint-plugin/tests/rules/sort-type-union-intersection-members.test.ts +++ b/packages/eslint-plugin/tests/rules/sort-type-union-intersection-members.test.ts @@ -127,7 +127,7 @@ const invalid = ( }, { code: noFormat`type T = (B) ${operator} (A);`, - output: noFormat`type T = (A) ${operator} (B);`, + output: noFormat`type T = A ${operator} B;`, errors: [ { messageId: 'notSortedNamed', diff --git a/packages/experimental-utils/src/ts-eslint/Rule.ts b/packages/experimental-utils/src/ts-eslint/Rule.ts index 76e8deb2408..e17de9f6eba 100644 --- a/packages/experimental-utils/src/ts-eslint/Rule.ts +++ b/packages/experimental-utils/src/ts-eslint/Rule.ts @@ -399,7 +399,6 @@ interface RuleListener { TSObjectKeyword?: RuleFunction; TSOptionalType?: RuleFunction; TSParameterProperty?: RuleFunction; - TSParenthesizedType?: RuleFunction; TSPrivateKeyword?: RuleFunction; TSPropertySignature?: RuleFunction; TSProtectedKeyword?: RuleFunction; diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 86ade612d16..3f51f9af0d9 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -2698,10 +2698,7 @@ export class Converter { // TypeScript specific types case SyntaxKind.ParenthesizedType: { - return this.createNode(node, { - type: AST_NODE_TYPES.TSParenthesizedType, - typeAnnotation: this.convertType(node.type), - }); + return this.convertType(node.type); } case SyntaxKind.UnionType: { return this.createNode(node, { diff --git a/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts b/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts index d5daed09332..65951a856df 100644 --- a/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts +++ b/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts @@ -192,7 +192,6 @@ export interface EstreeToTsNodeTypes { [AST_NODE_TYPES.TSNonNullExpression]: ts.NonNullExpression; [AST_NODE_TYPES.TSOptionalType]: ts.OptionalTypeNode; [AST_NODE_TYPES.TSParameterProperty]: ts.ParameterDeclaration; - [AST_NODE_TYPES.TSParenthesizedType]: ts.ParenthesizedTypeNode; [AST_NODE_TYPES.TSPropertySignature]: ts.PropertySignature; [AST_NODE_TYPES.TSQualifiedName]: ts.QualifiedName; [AST_NODE_TYPES.TSRestType]: diff --git a/packages/typescript-estree/tests/ast-alignment/utils.ts b/packages/typescript-estree/tests/ast-alignment/utils.ts index 3cecac3f09f..d7dae6bcafe 100644 --- a/packages/typescript-estree/tests/ast-alignment/utils.ts +++ b/packages/typescript-estree/tests/ast-alignment/utils.ts @@ -250,6 +250,16 @@ export function preprocessBabylonAST(ast: BabelTypes.File): any { } } }, + /** + * Remove TSParenthesizedType from babel AST. Babel 8 will stop generating the TSParenthesizedType. + * Once we use babel 8, this can be removed. + * @see https://github.com/babel/babel/pull/12608 + */ + TSParenthesizedType(node: any) { + const { typeAnnotation } = node; + Object.keys(node).forEach(key => delete node[key]); + Object.assign(node, typeAnnotation); + }, }, ); } diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer-nested.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer-nested.src.ts.shot index 3c06676714f..50f8f0f7ff8 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer-nested.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer-nested.src.ts.shot @@ -78,38 +78,33 @@ Object { "elementType": Object { "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 2, }, "start": Object { - "column": 12, + "column": 13, "line": 2, }, }, "range": Array [ - 31, - 40, + 32, + 39, ], - "type": "TSParenthesizedType", - "typeAnnotation": Object { + "type": "TSInferType", + "typeParameter": Object { + "constraint": undefined, + "default": undefined, "loc": Object { "end": Object { "column": 20, "line": 2, }, "start": Object { - "column": 13, + "column": 19, "line": 2, }, }, - "range": Array [ - 32, - 39, - ], - "type": "TSInferType", - "typeParameter": Object { - "constraint": undefined, - "default": undefined, + "name": Object { "loc": Object { "end": Object { "column": 20, @@ -120,30 +115,18 @@ Object { "line": 2, }, }, - "name": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "name": "U", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - }, + "name": "U", "range": Array [ 38, 39, ], - "type": "TSTypeParameter", + "type": "Identifier", }, + "range": Array [ + 38, + 39, + ], + "type": "TSTypeParameter", }, }, "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer.src.ts.shot index 9054692bd03..d55b6ac728e 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer.src.ts.shot @@ -78,38 +78,33 @@ Object { "elementType": Object { "loc": Object { "end": Object { - "column": 37, + "column": 36, "line": 1, }, "start": Object { - "column": 28, + "column": 29, "line": 1, }, }, "range": Array [ - 28, - 37, + 29, + 36, ], - "type": "TSParenthesizedType", - "typeAnnotation": Object { + "type": "TSInferType", + "typeParameter": Object { + "constraint": undefined, + "default": undefined, "loc": Object { "end": Object { "column": 36, "line": 1, }, "start": Object { - "column": 29, + "column": 35, "line": 1, }, }, - "range": Array [ - 29, - 36, - ], - "type": "TSInferType", - "typeParameter": Object { - "constraint": undefined, - "default": undefined, + "name": Object { "loc": Object { "end": Object { "column": 36, @@ -120,30 +115,18 @@ Object { "line": 1, }, }, - "name": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, - "name": "U", - "range": Array [ - 35, - 36, - ], - "type": "Identifier", - }, + "name": "U", "range": Array [ 35, 36, ], - "type": "TSTypeParameter", + "type": "Identifier", }, + "range": Array [ + 35, + 36, + ], + "type": "TSTypeParameter", }, }, "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/parenthesized-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/parenthesized-type.src.ts.shot index 7aa5ec4571d..e029fb99516 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/parenthesized-type.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/parenthesized-type.src.ts.shot @@ -40,72 +40,55 @@ Object { "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 28, + "column": 27, "line": 1, }, "start": Object { - "column": 11, + "column": 12, "line": 1, }, }, "range": Array [ - 11, - 28, + 12, + 27, ], - "type": "TSParenthesizedType", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, }, + "range": Array [ + 12, + 18, + ], + "type": "TSStringKeyword", }, - "range": Array [ - 12, - 27, - ], - "type": "TSUnionType", - "types": Array [ - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, }, - "range": Array [ - 12, - 18, - ], - "type": "TSStringKeyword", - }, - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, + "start": Object { + "column": 21, + "line": 1, }, - "range": Array [ - 21, - 27, - ], - "type": "TSNumberKeyword", }, - ], - }, + "range": Array [ + 21, + 27, + ], + "type": "TSNumberKeyword", + }, + ], }, }, ], diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named-optional.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named-optional.src.ts.shot index f07915f0394..87f7351cba2 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named-optional.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named-optional.src.ts.shot @@ -151,72 +151,55 @@ Object { "elementType": Object { "loc": Object { "end": Object { - "column": 52, + "column": 51, "line": 1, }, "start": Object { - "column": 35, + "column": 36, "line": 1, }, }, "range": Array [ - 35, - 52, + 36, + 51, ], - "type": "TSParenthesizedType", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 51, - "line": 1, - }, - "start": Object { - "column": 36, - "line": 1, + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, }, + "range": Array [ + 36, + 42, + ], + "type": "TSStringKeyword", }, - "range": Array [ - 36, - 51, - ], - "type": "TSUnionType", - "types": Array [ - Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 36, - "line": 1, - }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 1, }, - "range": Array [ - 36, - 42, - ], - "type": "TSStringKeyword", - }, - Object { - "loc": Object { - "end": Object { - "column": 51, - "line": 1, - }, - "start": Object { - "column": 45, - "line": 1, - }, + "start": Object { + "column": 45, + "line": 1, }, - "range": Array [ - 45, - 51, - ], - "type": "TSNumberKeyword", }, - ], - }, + "range": Array [ + 45, + 51, + ], + "type": "TSNumberKeyword", + }, + ], }, "label": Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-optional.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-optional.src.ts.shot index 55be898e6a5..b359d09d889 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-optional.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-optional.src.ts.shot @@ -111,72 +111,55 @@ Object { "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 42, + "column": 41, "line": 1, }, "start": Object { - "column": 25, + "column": 26, "line": 1, }, }, "range": Array [ - 25, - 42, + 26, + 41, ], - "type": "TSParenthesizedType", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, }, + "range": Array [ + 26, + 32, + ], + "type": "TSStringKeyword", }, - "range": Array [ - 26, - 41, - ], - "type": "TSUnionType", - "types": Array [ - Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, }, - "range": Array [ - 26, - 32, - ], - "type": "TSStringKeyword", - }, - Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, + "start": Object { + "column": 35, + "line": 1, }, - "range": Array [ - 35, - 41, - ], - "type": "TSNumberKeyword", }, - ], - }, + "range": Array [ + 35, + 41, + ], + "type": "TSNumberKeyword", + }, + ], }, }, ], diff --git a/packages/visitor-keys/src/visitor-keys.ts b/packages/visitor-keys/src/visitor-keys.ts index efad2828a37..036bfe5763e 100644 --- a/packages/visitor-keys/src/visitor-keys.ts +++ b/packages/visitor-keys/src/visitor-keys.ts @@ -115,7 +115,6 @@ const additionalKeys: AdditionalKeys = { TSObjectKeyword: [], TSOptionalType: ['typeAnnotation'], TSParameterProperty: ['decorators', 'parameter'], - TSParenthesizedType: ['typeAnnotation'], TSPrivateKeyword: [], TSPropertySignature: ['typeAnnotation', 'key', 'initializer'], TSProtectedKeyword: [],