Skip to content

Commit c48f7dc

Browse files
authored
fix(visitor-keys): reorder TSSatisfiesExpression and TSTypeAssertion (typescript-eslint#10139)
* reorder * remove unnecessary comment
1 parent ef8642b commit c48f7dc

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

packages/visitor-keys/src/visitor-keys.ts

+4-9
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ const SharedVisitorKeys = (() => {
143143
return {
144144
AbstractPropertyDefinition: ['decorators', 'key', 'typeAnnotation'],
145145
AnonymousFunction,
146+
AsExpression: ['expression', 'typeAnnotation'],
146147
ClassDeclaration: [
147148
'decorators',
148149
'id',
@@ -155,7 +156,6 @@ const SharedVisitorKeys = (() => {
155156
Function: ['id', ...AnonymousFunction],
156157
FunctionType,
157158
PropertyDefinition: [...AbstractPropertyDefinition, 'value'],
158-
TypeAssertion: ['expression', 'typeAnnotation'],
159159
} as const;
160160
})();
161161

@@ -193,7 +193,7 @@ const additionalKeys: AdditionalKeys = {
193193
TSAbstractPropertyDefinition: SharedVisitorKeys.AbstractPropertyDefinition,
194194
TSAnyKeyword: [],
195195
TSArrayType: ['elementType'],
196-
TSAsExpression: SharedVisitorKeys.TypeAssertion,
196+
TSAsExpression: SharedVisitorKeys.AsExpression,
197197
TSAsyncKeyword: [],
198198
TSBigIntKeyword: [],
199199
TSBooleanKeyword: [],
@@ -244,12 +244,7 @@ const additionalKeys: AdditionalKeys = {
244244
TSQualifiedName: ['left', 'right'],
245245
TSReadonlyKeyword: [],
246246
TSRestType: ['typeAnnotation'],
247-
TSSatisfiesExpression: [
248-
// this is intentionally different to SharedVisitorKeys.TypeAssertion because
249-
// the type annotation comes first in the source code
250-
'typeAnnotation',
251-
'expression',
252-
],
247+
TSSatisfiesExpression: SharedVisitorKeys.AsExpression,
253248
TSStaticKeyword: [],
254249
TSStringKeyword: [],
255250
TSSymbolKeyword: [],
@@ -258,7 +253,7 @@ const additionalKeys: AdditionalKeys = {
258253
TSTupleType: ['elementTypes'],
259254
TSTypeAliasDeclaration: ['id', 'typeParameters', 'typeAnnotation'],
260255
TSTypeAnnotation: ['typeAnnotation'],
261-
TSTypeAssertion: SharedVisitorKeys.TypeAssertion,
256+
TSTypeAssertion: ['typeAnnotation', 'expression'],
262257
TSTypeLiteral: ['members'],
263258
TSTypeOperator: ['typeAnnotation'],
264259
TSTypeParameter: ['name', 'constraint', 'default'],

0 commit comments

Comments
 (0)