diff --git a/packages/babel-generator/src/generators/typescript.ts b/packages/babel-generator/src/generators/typescript.ts index 23ce5853561a..54da4a4e0f67 100644 --- a/packages/babel-generator/src/generators/typescript.ts +++ b/packages/babel-generator/src/generators/typescript.ts @@ -522,15 +522,24 @@ export function TSTypeAliasDeclaration( this.token(";"); } -export function TSAsExpression(this: Printer, node: t.TSAsExpression) { - const { expression, typeAnnotation } = node; - this.print(expression, node); +function TSTypeExpression( + this: Printer, + node: t.TSAsExpression | t.TSSatisfiesExpression, +) { + const { type, expression, typeAnnotation } = node; + const forceParens = !!expression.trailingComments?.length; + this.print(expression, node, true, undefined, forceParens); this.space(); - this.word("as"); + this.word(type === "TSAsExpression" ? "as" : "satisfies"); this.space(); this.print(typeAnnotation, node); } +export { + TSTypeExpression as TSAsExpression, + TSTypeExpression as TSSatisfiesExpression, +}; + export function TSTypeAssertion(this: Printer, node: t.TSTypeAssertion) { const { typeAnnotation, expression } = node; this.token("<"); diff --git a/packages/babel-generator/src/node/parentheses.ts b/packages/babel-generator/src/node/parentheses.ts index 4cf704caf481..2e269d8355a6 100644 --- a/packages/babel-generator/src/node/parentheses.ts +++ b/packages/babel-generator/src/node/parentheses.ts @@ -49,6 +49,7 @@ import { isVariableDeclarator, isWhileStatement, isYieldExpression, + isTSSatisfiesExpression, } from "@babel/types"; import type * as t from "@babel/types"; const PRECEDENCE = { @@ -225,9 +226,10 @@ export function TSAsExpression() { return true; } -export function TSTypeAssertion() { - return true; -} +export { + TSAsExpression as TSSatisfiesExpression, + TSAsExpression as TSTypeAssertion, +}; export function TSUnionType(node: t.TSUnionType, parent: t.Node): boolean { return ( @@ -368,7 +370,8 @@ export function ConditionalExpression( isConditionalExpression(parent, { test: node }) || isAwaitExpression(parent) || isTSTypeAssertion(parent) || - isTSAsExpression(parent) + isTSAsExpression(parent) || + isTSSatisfiesExpression(parent) ) { return true; } diff --git a/packages/babel-generator/src/printer.ts b/packages/babel-generator/src/printer.ts index 1d1c30c33712..28fda0b64867 100644 --- a/packages/babel-generator/src/printer.ts +++ b/packages/babel-generator/src/printer.ts @@ -579,6 +579,7 @@ class Printer { // trailingCommentsLineOffset also used to check if called from printJoin // it will be ignored if `noLineTerminator||this._noLineTerminator` trailingCommentsLineOffset?: number, + forceParens?: boolean, ) { if (!node) return; @@ -618,7 +619,9 @@ class Printer { this._maybeAddAuxComment(this._insideAux && !oldInAux); let shouldPrintParens = false; - if ( + if (forceParens) { + shouldPrintParens = true; + } else if ( format.retainFunctionParens && nodeType === "FunctionExpression" && node.extra && diff --git a/packages/babel-generator/test/fixtures/typescript/satisfies/input.js b/packages/babel-generator/test/fixtures/typescript/satisfies/input.js new file mode 100644 index 000000000000..12163aa5c175 --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/satisfies/input.js @@ -0,0 +1,11 @@ +x satisfies T; +x < y satisfies boolean; // (x < y) satisfies boolean; +x === 1 satisfies number; // x === (1 satisfies number); +x satisfies any satisfies T; + +( + // a + x + /* b */ +) satisfies T; +x /* c */ satisfies T; \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/typescript/satisfies/output.js b/packages/babel-generator/test/fixtures/typescript/satisfies/output.js new file mode 100644 index 000000000000..feb95bb9c941 --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/satisfies/output.js @@ -0,0 +1,9 @@ +(x satisfies T); +(x < y satisfies boolean); // (x < y) satisfies boolean; +x === (1 satisfies number); // x === (1 satisfies number); +((x satisfies any) satisfies T); +(( +// a +x +/* b */) satisfies T); +((x /* c */) satisfies T); \ No newline at end of file diff --git a/packages/babel-helper-skip-transparent-expression-wrappers/src/index.ts b/packages/babel-helper-skip-transparent-expression-wrappers/src/index.ts index b3066dcc4c72..1f27280616f7 100644 --- a/packages/babel-helper-skip-transparent-expression-wrappers/src/index.ts +++ b/packages/babel-helper-skip-transparent-expression-wrappers/src/index.ts @@ -2,6 +2,7 @@ import { isParenthesizedExpression, isTSAsExpression, isTSNonNullExpression, + isTSSatisfiesExpression, isTSTypeAssertion, isTypeCastExpression, } from "@babel/types"; @@ -11,6 +12,7 @@ import type { NodePath } from "@babel/traverse"; export type TransparentExprWrapper = | t.TSAsExpression + | t.TSSatisfiesExpression | t.TSTypeAssertion | t.TSNonNullExpression | t.TypeCastExpression @@ -26,6 +28,7 @@ export function isTransparentExprWrapper( ): node is TransparentExprWrapper { return ( isTSAsExpression(node) || + isTSSatisfiesExpression(node) || isTSTypeAssertion(node) || isTSNonNullExpression(node) || isTypeCastExpression(node) || diff --git a/packages/babel-parser/src/plugins/typescript/index.ts b/packages/babel-parser/src/plugins/typescript/index.ts index af522420fb6e..404f1f2969e0 100644 --- a/packages/babel-parser/src/plugins/typescript/index.ts +++ b/packages/babel-parser/src/plugins/typescript/index.ts @@ -93,7 +93,6 @@ const TSErrors = ParseErrorEnum`typescript`({ AccesorCannotDeclareThisParameter: "'get' and 'set' accessors cannot declare 'this' parameters.", AccesorCannotHaveTypeParameters: "An accessor cannot have type parameters.", - CannotFindName: ({ name }: { name: string }) => `Cannot find name '${name}'.`, ClassMethodHasDeclare: "Class methods cannot have the 'declare' modifier.", ClassMethodHasReadonly: "Class methods cannot have the 'readonly' modifier.", ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference: @@ -721,26 +720,6 @@ export default (superClass: ClassWithMixin) => return this.finishNode(node, "TSTypeParameterDeclaration"); } - tsTryNextParseConstantContext(): N.TsTypeReference | undefined | null { - if (this.lookahead().type !== tt._const) return null; - - this.next(); - const typeReference = this.tsParseTypeReference(); - - // If the type reference has type parameters, then you are using it as a - // type and not as a const signifier. We'll *never* be able to find this - // name, since const isn't allowed as a type name. So in this instance we - // get to pretend we're the type checker. - if (typeReference.typeParameters) { - this.raise(TSErrors.CannotFindName, { - at: typeReference.typeName, - name: "const", - }); - } - - return typeReference; - } - // Note: In TypeScript implementation we must provide `yieldContext` and `awaitContext`, // but here it's always false, because this is only used for types. tsFillSignature( @@ -1659,8 +1638,12 @@ export default (superClass: ClassWithMixin) => } const node = this.startNode(); - const _const = this.tsTryNextParseConstantContext(); - node.typeAnnotation = _const || this.tsNextThenParseType(); + node.typeAnnotation = this.tsInType(() => { + this.next(); // "<" + return this.match(tt._const) + ? this.tsParseTypeReference() + : this.tsParseType(); + }); this.expect(tt.gt); node.expression = this.parseMaybeUnary(); return this.finishNode(node, "TSTypeAssertion"); @@ -2556,20 +2539,35 @@ export default (superClass: ClassWithMixin) => leftStartLoc: Position, minPrec: number, ): N.Expression { + let isSatisfies: boolean; if ( tokenOperatorPrecedence(tt._in) > minPrec && !this.hasPrecedingLineBreak() && - this.isContextual(tt._as) + (this.isContextual(tt._as) || + (isSatisfies = this.isContextual(tt._satisfies))) ) { - const node = this.startNodeAt(leftStartLoc); + const node = this.startNodeAt< + N.TsAsExpression | N.TsSatisfiesExpression + >(leftStartLoc); node.expression = left; - const _const = this.tsTryNextParseConstantContext(); - if (_const) { - node.typeAnnotation = _const; - } else { - node.typeAnnotation = this.tsNextThenParseType(); - } - this.finishNode(node, "TSAsExpression"); + node.typeAnnotation = this.tsInType(() => { + this.next(); // "as" or "satisfies" + if (this.match(tt._const)) { + if (isSatisfies) { + this.raise(Errors.UnexpectedKeyword, { + at: this.state.startLoc, + keyword: "const", + }); + } + return this.tsParseTypeReference(); + } + + return this.tsParseType(); + }); + this.finishNode( + node, + isSatisfies ? "TSSatisfiesExpression" : "TSAsExpression", + ); // rescan `<`, `>` because they were scanned when this.state.inType was true this.reScan_lt_gt(); return this.parseExprOp( diff --git a/packages/babel-parser/src/tokenizer/types.ts b/packages/babel-parser/src/tokenizer/types.ts index 0eb638d2693e..ca7bdc071f27 100644 --- a/packages/babel-parser/src/tokenizer/types.ts +++ b/packages/babel-parser/src/tokenizer/types.ts @@ -308,6 +308,7 @@ export const tt: InternalTokenTypes = { _mixins: createKeywordLike("mixins", { startsExpr }), _proto: createKeywordLike("proto", { startsExpr }), _require: createKeywordLike("require", { startsExpr }), + _satisfies: createKeywordLike("satisfies", { startsExpr }), // start: isTSTypeOperator _keyof: createKeywordLike("keyof", { startsExpr }), _readonly: createKeywordLike("readonly", { startsExpr }), diff --git a/packages/babel-parser/src/types.d.ts b/packages/babel-parser/src/types.d.ts index a53d67316fba..6356bf8f6549 100644 --- a/packages/babel-parser/src/types.d.ts +++ b/packages/babel-parser/src/types.d.ts @@ -1639,6 +1639,10 @@ export interface TsTypeAssertion extends TsTypeAssertionLikeBase { type: "TSTypeAssertion"; } +export type TsSatisfiesExpression = TsTypeAssertionLikeBase & { + type: "TSSatisfiesExpression"; +}; + export interface TsNonNullExpression extends NodeBase { type: "TSNonNullExpression"; expression: Expression; diff --git a/packages/babel-parser/test/fixtures/typescript/cast/satisfies-const-error/input.ts b/packages/babel-parser/test/fixtures/typescript/cast/satisfies-const-error/input.ts new file mode 100644 index 000000000000..748f4bd89d74 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/satisfies-const-error/input.ts @@ -0,0 +1 @@ +x satisfies const \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/cast/satisfies-const-error/output.json b/packages/babel-parser/test/fixtures/typescript/cast/satisfies-const-error/output.json new file mode 100644 index 000000000000..172b9c9716b3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/satisfies-const-error/output.json @@ -0,0 +1,38 @@ +{ + "type": "File", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":17,"index":17}}, + "errors": [ + "SyntaxError: Unexpected keyword 'const'. (1:12)" + ], + "program": { + "type": "Program", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":17,"index":17}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":17,"index":17}}, + "expression": { + "type": "TSSatisfiesExpression", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":17,"index":17}}, + "expression": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":1,"index":1},"identifierName":"x"}, + "name": "x" + }, + "typeAnnotation": { + "type": "TSTypeReference", + "start":12,"end":17,"loc":{"start":{"line":1,"column":12,"index":12},"end":{"line":1,"column":17,"index":17}}, + "typeName": { + "type": "Identifier", + "start":12,"end":17,"loc":{"start":{"line":1,"column":12,"index":12},"end":{"line":1,"column":17,"index":17},"identifierName":"const"}, + "name": "const" + } + } + } + } + ], + "directives": [] + } +} diff --git a/packages/babel-parser/test/fixtures/typescript/cast/satisfies/input.ts b/packages/babel-parser/test/fixtures/typescript/cast/satisfies/input.ts new file mode 100644 index 000000000000..fe7ac9eea0aa --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/satisfies/input.ts @@ -0,0 +1,2 @@ +x satisfies T; +x < y satisfies boolean; // (x < y) satisfies boolean; diff --git a/packages/babel-parser/test/fixtures/typescript/cast/satisfies/output.json b/packages/babel-parser/test/fixtures/typescript/cast/satisfies/output.json new file mode 100644 index 000000000000..06cdecfe8f46 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/satisfies/output.json @@ -0,0 +1,76 @@ +{ + "type": "File", + "start":0,"end":69,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":2,"column":54,"index":69}}, + "program": { + "type": "Program", + "start":0,"end":69,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":2,"column":54,"index":69}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":14,"index":14}}, + "expression": { + "type": "TSSatisfiesExpression", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":13,"index":13}}, + "expression": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":1,"index":1},"identifierName":"x"}, + "name": "x" + }, + "typeAnnotation": { + "type": "TSTypeReference", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12,"index":12},"end":{"line":1,"column":13,"index":13}}, + "typeName": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12,"index":12},"end":{"line":1,"column":13,"index":13},"identifierName":"T"}, + "name": "T" + } + } + } + }, + { + "type": "ExpressionStatement", + "start":15,"end":39,"loc":{"start":{"line":2,"column":0,"index":15},"end":{"line":2,"column":24,"index":39}}, + "expression": { + "type": "TSSatisfiesExpression", + "start":15,"end":38,"loc":{"start":{"line":2,"column":0,"index":15},"end":{"line":2,"column":23,"index":38}}, + "expression": { + "type": "BinaryExpression", + "start":15,"end":20,"loc":{"start":{"line":2,"column":0,"index":15},"end":{"line":2,"column":5,"index":20}}, + "left": { + "type": "Identifier", + "start":15,"end":16,"loc":{"start":{"line":2,"column":0,"index":15},"end":{"line":2,"column":1,"index":16},"identifierName":"x"}, + "name": "x" + }, + "operator": "<", + "right": { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":2,"column":4,"index":19},"end":{"line":2,"column":5,"index":20},"identifierName":"y"}, + "name": "y" + } + }, + "typeAnnotation": { + "type": "TSBooleanKeyword", + "start":31,"end":38,"loc":{"start":{"line":2,"column":16,"index":31},"end":{"line":2,"column":23,"index":38}} + } + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " (x < y) satisfies boolean;", + "start":40,"end":69,"loc":{"start":{"line":2,"column":25,"index":40},"end":{"line":2,"column":54,"index":69}} + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " (x < y) satisfies boolean;", + "start":40,"end":69,"loc":{"start":{"line":2,"column":25,"index":40},"end":{"line":2,"column":54,"index":69}} + } + ] +} diff --git a/packages/babel-plugin-transform-typescript/src/index.ts b/packages/babel-plugin-transform-typescript/src/index.ts index 9b038429f018..e11a51b7c245 100644 --- a/packages/babel-plugin-transform-typescript/src/index.ts +++ b/packages/babel-plugin-transform-typescript/src/index.ts @@ -593,11 +593,14 @@ export default declare((api, opts: Options) => { path.replaceWith(path.node.expression); }, - TSAsExpression(path) { + [`TSAsExpression${ + // Added in Babel 7.20.0 + t.tsSatisfiesExpression ? "|TSSatisfiesExpression" : "" + }`](path: NodePath) { let { node }: { node: t.Expression } = path; do { node = node.expression; - } while (t.isTSAsExpression(node)); + } while (t.isTSAsExpression(node) || t.isTSSatisfiesExpression?.(node)); path.replaceWith(node); }, diff --git a/packages/babel-traverse/src/path/generated/asserts.d.ts b/packages/babel-traverse/src/path/generated/asserts.d.ts index 8f58d171740d..f2a0369b01be 100644 --- a/packages/babel-traverse/src/path/generated/asserts.d.ts +++ b/packages/babel-traverse/src/path/generated/asserts.d.ts @@ -577,6 +577,9 @@ export interface NodePathAssetions { opts?: object, ): asserts this is NodePath; assertTSRestType(opts?: object): asserts this is NodePath; + assertTSSatisfiesExpression( + opts?: object, + ): asserts this is NodePath; assertTSStringKeyword( opts?: object, ): asserts this is NodePath; diff --git a/packages/babel-traverse/src/path/generated/validators.d.ts b/packages/babel-traverse/src/path/generated/validators.d.ts index 908e5db8f355..7c3d14d4f2e4 100644 --- a/packages/babel-traverse/src/path/generated/validators.d.ts +++ b/packages/babel-traverse/src/path/generated/validators.d.ts @@ -995,6 +995,10 @@ interface BaseNodePathValidators { this: NodePath, opts?: object, ): this is NodePath; + isTSSatisfiesExpression( + this: NodePath, + opts?: object, + ): this is NodePath; isTSStringKeyword( this: NodePath, opts?: object, diff --git a/packages/babel-types/src/asserts/generated/index.ts b/packages/babel-types/src/asserts/generated/index.ts index b3cece7f340d..a643e8a14bfb 100644 --- a/packages/babel-types/src/asserts/generated/index.ts +++ b/packages/babel-types/src/asserts/generated/index.ts @@ -1412,6 +1412,12 @@ export function assertTSAsExpression( ): asserts node is t.TSAsExpression { assert("TSAsExpression", node, opts); } +export function assertTSSatisfiesExpression( + node: object | null | undefined, + opts?: object | null, +): asserts node is t.TSSatisfiesExpression { + assert("TSSatisfiesExpression", node, opts); +} export function assertTSTypeAssertion( node: object | null | undefined, opts?: object | null, diff --git a/packages/babel-types/src/ast-types/generated/index.ts b/packages/babel-types/src/ast-types/generated/index.ts index 9975a9536fb9..6beb4233a2ef 100644 --- a/packages/babel-types/src/ast-types/generated/index.ts +++ b/packages/babel-types/src/ast-types/generated/index.ts @@ -253,6 +253,7 @@ export type Node = | TSPropertySignature | TSQualifiedName | TSRestType + | TSSatisfiesExpression | TSStringKeyword | TSSymbolKeyword | TSThisType @@ -719,6 +720,7 @@ export interface AssignmentPattern extends BaseNode { | ArrayPattern | MemberExpression | TSAsExpression + | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression; right: Expression; @@ -1976,6 +1978,12 @@ export interface TSAsExpression extends BaseNode { typeAnnotation: TSType; } +export interface TSSatisfiesExpression extends BaseNode { + type: "TSSatisfiesExpression"; + expression: Expression; + typeAnnotation: TSType; +} + export interface TSTypeAssertion extends BaseNode { type: "TSTypeAssertion"; typeAnnotation: TSType; @@ -2206,6 +2214,7 @@ export type Expression = | PipelinePrimaryTopicReference | TSInstantiationExpression | TSAsExpression + | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression; export type Binary = BinaryExpression | LogicalExpression; @@ -2383,6 +2392,7 @@ export type PatternLike = | ArrayPattern | ObjectPattern | TSAsExpression + | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression; export type LVal = @@ -2394,6 +2404,7 @@ export type LVal = | ObjectPattern | TSParameterProperty | TSAsExpression + | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression; export type TSEntityName = Identifier | TSQualifiedName; @@ -2655,6 +2666,7 @@ export type TypeScript = | TSTypeAliasDeclaration | TSInstantiationExpression | TSAsExpression + | TSSatisfiesExpression | TSTypeAssertion | TSEnumDeclaration | TSEnumMember @@ -2865,6 +2877,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -2971,6 +2984,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -3034,6 +3048,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -3114,6 +3129,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -3178,6 +3194,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -3241,6 +3258,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -3304,6 +3322,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -3393,6 +3412,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -3520,6 +3540,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -3602,6 +3623,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -3679,6 +3701,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -3770,6 +3793,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -4029,6 +4053,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -4341,6 +4366,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -4514,6 +4540,7 @@ export interface ParentMaps { | TSParameterProperty | TSPropertySignature | TSQualifiedName + | TSSatisfiesExpression | TSTypeAliasDeclaration | TSTypeAssertion | TSTypePredicate @@ -4596,6 +4623,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -4795,6 +4823,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -4863,6 +4892,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -4962,6 +4992,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -5027,6 +5058,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -5090,6 +5122,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -5178,6 +5211,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -5241,6 +5275,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -5323,6 +5358,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -5489,6 +5525,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -5552,6 +5589,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -5701,6 +5739,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -5789,6 +5828,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -5852,6 +5892,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -5915,6 +5956,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -5978,6 +6020,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -6041,6 +6084,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -6119,6 +6163,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -6182,6 +6227,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -6283,6 +6329,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -6372,6 +6419,7 @@ export interface ParentMaps { | TSModuleDeclaration | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -6485,6 +6533,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -6548,6 +6597,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -6568,6 +6618,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -6630,6 +6681,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -6653,6 +6705,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -6673,6 +6726,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -6694,6 +6748,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -6715,6 +6770,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -6785,6 +6841,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -6806,6 +6863,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -6840,6 +6898,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -6862,6 +6921,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -6882,6 +6942,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -6942,6 +7003,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -6981,6 +7043,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -7001,6 +7064,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -7021,6 +7085,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -7041,6 +7106,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -7094,6 +7160,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -7156,6 +7223,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -7179,6 +7247,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -7199,6 +7268,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -7219,6 +7289,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -7239,6 +7310,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -7269,6 +7341,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -7297,6 +7370,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -7306,6 +7380,72 @@ export interface ParentMaps { | TSTypeParameterInstantiation | TSUnionType | TemplateLiteral; + TSSatisfiesExpression: + | ArrayExpression + | ArrayPattern + | ArrowFunctionExpression + | AssignmentExpression + | AssignmentPattern + | AwaitExpression + | BinaryExpression + | BindExpression + | CallExpression + | ClassAccessorProperty + | ClassDeclaration + | ClassExpression + | ClassMethod + | ClassPrivateProperty + | ClassProperty + | ConditionalExpression + | Decorator + | DoWhileStatement + | ExportDefaultDeclaration + | ExpressionStatement + | ForInStatement + | ForOfStatement + | ForStatement + | IfStatement + | JSXExpressionContainer + | JSXSpreadAttribute + | JSXSpreadChild + | LogicalExpression + | MemberExpression + | NewExpression + | ObjectMethod + | ObjectProperty + | OptionalCallExpression + | OptionalMemberExpression + | ParenthesizedExpression + | PipelineBareFunction + | PipelineTopicExpression + | RestElement + | ReturnStatement + | SequenceExpression + | SpreadElement + | SwitchCase + | SwitchStatement + | TSAsExpression + | TSDeclareMethod + | TSEnumDeclaration + | TSEnumMember + | TSExportAssignment + | TSInstantiationExpression + | TSMethodSignature + | TSNonNullExpression + | TSPropertySignature + | TSSatisfiesExpression + | TSTypeAssertion + | TaggedTemplateExpression + | TemplateLiteral + | ThrowStatement + | TupleExpression + | TypeCastExpression + | UnaryExpression + | UpdateExpression + | VariableDeclarator + | WhileStatement + | WithStatement + | YieldExpression; TSStringKeyword: | TSArrayType | TSAsExpression @@ -7317,6 +7457,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -7337,6 +7478,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -7357,6 +7499,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -7378,6 +7521,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -7480,6 +7624,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -7503,6 +7648,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -7523,6 +7669,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -7575,6 +7722,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -7595,6 +7743,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -7615,6 +7764,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -7635,6 +7785,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -7655,6 +7806,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -7675,6 +7827,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -7695,6 +7848,7 @@ export interface ParentMaps { | TSOptionalType | TSParenthesizedType | TSRestType + | TSSatisfiesExpression | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation @@ -7755,6 +7909,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -7820,6 +7975,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -7883,6 +8039,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -7985,6 +8142,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -8062,6 +8220,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -8189,6 +8348,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -8314,6 +8474,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -8402,6 +8563,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral @@ -8544,6 +8706,7 @@ export interface ParentMaps { | TSMethodSignature | TSNonNullExpression | TSPropertySignature + | TSSatisfiesExpression | TSTypeAssertion | TaggedTemplateExpression | TemplateLiteral diff --git a/packages/babel-types/src/builders/generated/index.ts b/packages/babel-types/src/builders/generated/index.ts index acfef5336e0b..a9d696d864e7 100644 --- a/packages/babel-types/src/builders/generated/index.ts +++ b/packages/babel-types/src/builders/generated/index.ts @@ -554,6 +554,7 @@ export function assignmentPattern( | t.ArrayPattern | t.MemberExpression | t.TSAsExpression + | t.TSSatisfiesExpression | t.TSTypeAssertion | t.TSNonNullExpression, right: t.Expression, @@ -2351,6 +2352,17 @@ export function tsAsExpression( }); } export { tsAsExpression as tSAsExpression }; +export function tsSatisfiesExpression( + expression: t.Expression, + typeAnnotation: t.TSType, +): t.TSSatisfiesExpression { + return validateNode({ + type: "TSSatisfiesExpression", + expression, + typeAnnotation, + }); +} +export { tsSatisfiesExpression as tSSatisfiesExpression }; export function tsTypeAssertion( typeAnnotation: t.TSType, expression: t.Expression, diff --git a/packages/babel-types/src/builders/generated/uppercase.js b/packages/babel-types/src/builders/generated/uppercase.js index 23952d0c3530..24bdea27f963 100644 --- a/packages/babel-types/src/builders/generated/uppercase.js +++ b/packages/babel-types/src/builders/generated/uppercase.js @@ -242,6 +242,7 @@ export { tsTypeAliasDeclaration as TSTypeAliasDeclaration, tsInstantiationExpression as TSInstantiationExpression, tsAsExpression as TSAsExpression, + tsSatisfiesExpression as TSSatisfiesExpression, tsTypeAssertion as TSTypeAssertion, tsEnumDeclaration as TSEnumDeclaration, tsEnumMember as TSEnumMember, diff --git a/packages/babel-types/src/definitions/core.ts b/packages/babel-types/src/definitions/core.ts index 2cc13e9ed197..c9c9b580dc68 100644 --- a/packages/babel-types/src/definitions/core.ts +++ b/packages/babel-types/src/definitions/core.ts @@ -70,6 +70,7 @@ defineType("AssignmentExpression", { "ArrayPattern", "ObjectPattern", "TSAsExpression", + "TSSatisfiesExpression", "TSTypeAssertion", "TSNonNullExpression", ), @@ -328,6 +329,7 @@ defineType("ForInStatement", { "ArrayPattern", "ObjectPattern", "TSAsExpression", + "TSSatisfiesExpression", "TSTypeAssertion", "TSNonNullExpression", ), @@ -930,6 +932,7 @@ defineType("ObjectProperty", { "Identifier", "Pattern", "TSAsExpression", + "TSSatisfiesExpression", "TSNonNullExpression", "TSTypeAssertion", ); @@ -960,6 +963,7 @@ defineType("RestElement", { "ObjectPattern", "MemberExpression", "TSAsExpression", + "TSSatisfiesExpression", "TSTypeAssertion", "TSNonNullExpression", ), @@ -1244,6 +1248,7 @@ defineType("AssignmentPattern", { "ArrayPattern", "MemberExpression", "TSAsExpression", + "TSSatisfiesExpression", "TSTypeAssertion", "TSNonNullExpression", ), @@ -1653,6 +1658,7 @@ defineType("ForOfStatement", { "ArrayPattern", "ObjectPattern", "TSAsExpression", + "TSSatisfiesExpression", "TSTypeAssertion", "TSNonNullExpression", ); diff --git a/packages/babel-types/src/definitions/typescript.ts b/packages/babel-types/src/definitions/typescript.ts index 98a5d3ba4bf5..9475c9dd6675 100644 --- a/packages/babel-types/src/definitions/typescript.ts +++ b/packages/babel-types/src/definitions/typescript.ts @@ -463,14 +463,17 @@ defineType("TSInstantiationExpression", { }, }); -defineType("TSAsExpression", { +const TSTypeExpression = { aliases: ["Expression", "LVal", "PatternLike"], visitor: ["expression", "typeAnnotation"], fields: { expression: validateType("Expression"), typeAnnotation: validateType("TSType"), }, -}); +}; + +defineType("TSAsExpression", TSTypeExpression); +defineType("TSSatisfiesExpression", TSTypeExpression); defineType("TSTypeAssertion", { aliases: ["Expression", "LVal", "PatternLike"], diff --git a/packages/babel-types/src/validators/generated/index.ts b/packages/babel-types/src/validators/generated/index.ts index c8eb203b3f6a..3d19ea5785c7 100644 --- a/packages/babel-types/src/validators/generated/index.ts +++ b/packages/babel-types/src/validators/generated/index.ts @@ -3966,6 +3966,23 @@ export function isTSAsExpression( return false; } +export function isTSSatisfiesExpression( + node: object | null | undefined, + opts?: object | null, +): node is t.TSSatisfiesExpression { + if (!node) return false; + + const nodeType = (node as t.Node).type; + if (nodeType === "TSSatisfiesExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} export function isTSTypeAssertion( node: object | null | undefined, opts?: object | null, @@ -4387,6 +4404,7 @@ export function isExpression( "PipelinePrimaryTopicReference" === nodeType || "TSInstantiationExpression" === nodeType || "TSAsExpression" === nodeType || + "TSSatisfiesExpression" === nodeType || "TSTypeAssertion" === nodeType || "TSNonNullExpression" === nodeType || (nodeType === "Placeholder" && @@ -4890,6 +4908,7 @@ export function isPatternLike( "ArrayPattern" === nodeType || "ObjectPattern" === nodeType || "TSAsExpression" === nodeType || + "TSSatisfiesExpression" === nodeType || "TSTypeAssertion" === nodeType || "TSNonNullExpression" === nodeType || (nodeType === "Placeholder" && @@ -4921,6 +4940,7 @@ export function isLVal( "ObjectPattern" === nodeType || "TSParameterProperty" === nodeType || "TSAsExpression" === nodeType || + "TSSatisfiesExpression" === nodeType || "TSTypeAssertion" === nodeType || "TSNonNullExpression" === nodeType || (nodeType === "Placeholder" && @@ -5627,6 +5647,7 @@ export function isTypeScript( "TSTypeAliasDeclaration" === nodeType || "TSInstantiationExpression" === nodeType || "TSAsExpression" === nodeType || + "TSSatisfiesExpression" === nodeType || "TSTypeAssertion" === nodeType || "TSEnumDeclaration" === nodeType || "TSEnumMember" === nodeType ||