From 37dd8283a81fd5fcfa742115850a909aa1b2f52f Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Tue, 16 Nov 2021 20:36:45 +0200 Subject: [PATCH] feat(7481): add explicit type compatibility check with 'satisfies' expression --- src/compiler/checker.ts | 18 + src/compiler/diagnosticMessages.json | 8 + src/compiler/emitter.ts | 12 + src/compiler/factory/nodeFactory.ts | 24 + src/compiler/factory/nodeTests.ts | 4 + src/compiler/factory/utilities.ts | 2 + src/compiler/parser.ts | 13 +- src/compiler/program.ts | 3 + src/compiler/scanner.ts | 1 + src/compiler/transformers/ts.ts | 8 + src/compiler/types.ts | 15 +- src/compiler/utilities.ts | 8 +- src/compiler/utilitiesPublic.ts | 1 + src/compiler/visitorPublic.ts | 6 + src/harness/fourslashInterfaceImpl.ts | 4 + src/services/callHierarchy.ts | 4 + src/services/classifier.ts | 1 + src/services/completions.ts | 4 + src/services/formatting/rules.ts | 1 + .../reference/api/tsserverlibrary.d.ts | 449 +++++++++--------- tests/baselines/reference/api/typescript.d.ts | 449 +++++++++--------- .../completionsCommentsClass.baseline | 12 + .../completionsCommentsClassMembers.baseline | 240 ++++++++++ ...completionsCommentsCommentParsing.baseline | 84 ++++ ...etionsCommentsFunctionDeclaration.baseline | 36 ++ ...letionsCommentsFunctionExpression.baseline | 48 ++ ...FileCompilationTypeSatisfaction.errors.txt | 8 + .../jsFileCompilationTypeSatisfaction.js | 6 + .../jsFileCompilationTypeSatisfaction.symbols | 5 + .../jsFileCompilationTypeSatisfaction.types | 6 + .../reference/typeSatisfaction.errors.txt | 17 + tests/baselines/reference/typeSatisfaction.js | 14 + .../reference/typeSatisfaction.symbols | 23 + .../reference/typeSatisfaction.types | 27 ++ .../jsFileCompilationTypeSatisfaction.ts | 5 + .../typeSatisfaction/typeSatisfaction.ts | 7 + .../fourslash/completionSatisfiesKeyword.ts | 11 + .../fourslash/satisfiesOperatorCompletion.ts | 7 + 38 files changed, 1149 insertions(+), 442 deletions(-) create mode 100644 tests/baselines/reference/jsFileCompilationTypeSatisfaction.errors.txt create mode 100644 tests/baselines/reference/jsFileCompilationTypeSatisfaction.js create mode 100644 tests/baselines/reference/jsFileCompilationTypeSatisfaction.symbols create mode 100644 tests/baselines/reference/jsFileCompilationTypeSatisfaction.types create mode 100644 tests/baselines/reference/typeSatisfaction.errors.txt create mode 100644 tests/baselines/reference/typeSatisfaction.js create mode 100644 tests/baselines/reference/typeSatisfaction.symbols create mode 100644 tests/baselines/reference/typeSatisfaction.types create mode 100644 tests/cases/compiler/jsFileCompilationTypeSatisfaction.ts create mode 100644 tests/cases/conformance/expressions/typeSatisfaction/typeSatisfaction.ts create mode 100644 tests/cases/fourslash/completionSatisfiesKeyword.ts create mode 100644 tests/cases/fourslash/satisfiesOperatorCompletion.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0dd0d1d6b4f3e..a633b08b0aa9e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -31313,6 +31313,22 @@ namespace ts { getNonNullableType(checkExpression(node.expression)); } + function checkSatisfiesExpression(node: SatisfiesExpression) { + checkSourceElement(node.type); + + const targetType = getTypeFromTypeNode(node.type); + if (isErrorType(targetType)) { + return targetType; + } + + const exprType = getWidenedType(checkExpression(node.expression)); + if (!isTypeIdenticalTo(targetType, exprType)) { + error(node.type, Diagnostics._0_is_not_satisfied_1, typeToString(targetType), typeToString(exprType)); + } + + return targetType; + } + function checkMetaProperty(node: MetaProperty): Type { checkGrammarMetaProperty(node); @@ -34065,6 +34081,8 @@ namespace ts { return checkAssertion(node as AssertionExpression); case SyntaxKind.NonNullExpression: return checkNonNullAssertion(node as NonNullExpression); + case SyntaxKind.SatisfiesExpression: + return checkSatisfiesExpression(node as SatisfiesExpression); case SyntaxKind.MetaProperty: return checkMetaProperty(node as MetaProperty); case SyntaxKind.DeleteExpression: diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 606dc1a2acb49..8e95d46455bf0 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1060,6 +1060,10 @@ "category": "Error", "code": 1359 }, + "'{0}' is not satisfied '{1}'": { + "category": "Error", + "code": 1360 + }, "'{0}' cannot be used as a value because it was imported using 'import type'.": { "category": "Error", "code": 1361 @@ -6151,6 +6155,10 @@ "category": "Error", "code": 8034 }, + "Type satisfaction expressions can only be used in TypeScript files.": { + "category": "Error", + "code": 8035 + }, "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit.": { "category": "Error", "code": 9005 diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index d4eff1e0ace5e..1cbbfc15c106f 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1727,6 +1727,8 @@ namespace ts { return emitAsExpression(node as AsExpression); case SyntaxKind.NonNullExpression: return emitNonNullExpression(node as NonNullExpression); + case SyntaxKind.SatisfiesExpression: + return emitSatisfiesExpression(node as SatisfiesExpression); case SyntaxKind.MetaProperty: return emitMetaProperty(node as MetaProperty); case SyntaxKind.SyntheticExpression: @@ -2799,6 +2801,16 @@ namespace ts { writeOperator("!"); } + function emitSatisfiesExpression(node: SatisfiesExpression) { + emitExpression(node.expression, /*parenthesizerRules*/ undefined); + if (node.type) { + writeSpace(); + writeKeyword("satisfies"); + writeSpace(); + emit(node.type); + } + } + function emitMetaProperty(node: MetaProperty) { writeToken(node.keywordToken, node.pos, writePunctuation); writePunctuation("."); diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index 963ce75441f6e..4db4c76aa6039 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -218,6 +218,8 @@ namespace ts { updateAsExpression, createNonNullExpression, updateNonNullExpression, + createSatisfiesExpression, + updateSatisfiesExpression, createNonNullChain, updateNonNullChain, createMetaProperty, @@ -3099,6 +3101,26 @@ namespace ts { : node; } + // @api + function createSatisfiesExpression(expression: Expression, type: TypeNode) { + const node = createBaseExpression(SyntaxKind.SatisfiesExpression); + node.expression = expression; + node.type = type; + node.transformFlags |= + propagateChildFlags(node.expression) | + propagateChildFlags(node.type) | + TransformFlags.ContainsTypeScript; + return node; + } + + // @api + function updateSatisfiesExpression(node: SatisfiesExpression, expression: Expression, type: TypeNode) { + return node.expression !== expression + || node.type !== type + ? update(createSatisfiesExpression(expression, type), node) + : node; + } + // @api function createNonNullChain(expression: Expression) { const node = createBaseExpression(SyntaxKind.NonNullExpression); @@ -5590,6 +5612,7 @@ namespace ts { case SyntaxKind.ParenthesizedExpression: return updateParenthesizedExpression(outerExpression, expression); case SyntaxKind.TypeAssertionExpression: return updateTypeAssertion(outerExpression, outerExpression.type, expression); case SyntaxKind.AsExpression: return updateAsExpression(outerExpression, expression, outerExpression.type); + case SyntaxKind.SatisfiesExpression: return updateSatisfiesExpression(outerExpression, expression, outerExpression.type); case SyntaxKind.NonNullExpression: return updateNonNullExpression(outerExpression, expression); case SyntaxKind.PartiallyEmittedExpression: return updatePartiallyEmittedExpression(outerExpression, expression); } @@ -6320,6 +6343,7 @@ namespace ts { case SyntaxKind.ArrayBindingPattern: return TransformFlags.BindingPatternExcludes; case SyntaxKind.TypeAssertionExpression: + case SyntaxKind.SatisfiesExpression: case SyntaxKind.AsExpression: case SyntaxKind.PartiallyEmittedExpression: case SyntaxKind.ParenthesizedExpression: diff --git a/src/compiler/factory/nodeTests.ts b/src/compiler/factory/nodeTests.ts index 274ade1886dfc..f9e3423ecbd22 100644 --- a/src/compiler/factory/nodeTests.ts +++ b/src/compiler/factory/nodeTests.ts @@ -433,6 +433,10 @@ namespace ts { return node.kind === SyntaxKind.AsExpression; } + export function isSatisfiesExpression(node: Node): node is SatisfiesExpression { + return node.kind === SyntaxKind.SatisfiesExpression; + } + export function isNonNullExpression(node: Node): node is NonNullExpression { return node.kind === SyntaxKind.NonNullExpression; } diff --git a/src/compiler/factory/utilities.ts b/src/compiler/factory/utilities.ts index 7daa31c522732..8c0425588d77d 100644 --- a/src/compiler/factory/utilities.ts +++ b/src/compiler/factory/utilities.ts @@ -442,6 +442,8 @@ namespace ts { return (kinds & OuterExpressionKinds.NonNullAssertions) !== 0; case SyntaxKind.PartiallyEmittedExpression: return (kinds & OuterExpressionKinds.PartiallyEmittedExpressions) !== 0; + case SyntaxKind.SatisfiesExpression: + return (kinds & OuterExpressionKinds.SatisfiesExpression) !== 0; } return false; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 6bb5d0aec31b9..a3125e9a8e1ed 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -276,6 +276,9 @@ namespace ts { visitNode(cbNode, (node as AsExpression).type); case SyntaxKind.NonNullExpression: return visitNode(cbNode, (node as NonNullExpression).expression); + case SyntaxKind.SatisfiesExpression: + return visitNode(cbNode, (node as SatisfiesExpression).expression) || + visitNode(cbNode, (node as SatisfiesExpression).type); case SyntaxKind.MetaProperty: return visitNode(cbNode, (node as MetaProperty).name); case SyntaxKind.ConditionalExpression: @@ -4670,7 +4673,7 @@ namespace ts { break; } - if (token() === SyntaxKind.AsKeyword) { + if (token() === SyntaxKind.AsKeyword || token() === SyntaxKind.SatisfiesKeyword) { // Make sure we *do* perform ASI for constructs like this: // var x = foo // as (Bar) @@ -4680,8 +4683,10 @@ namespace ts { break; } else { + const keywordKind = token(); nextToken(); - leftOperand = makeAsExpression(leftOperand, parseType()); + leftOperand = keywordKind === SyntaxKind.SatisfiesKeyword ? makeSatisfiesExpression(leftOperand, parseType()) : + makeAsExpression(leftOperand, parseType()); } } else { @@ -4700,6 +4705,10 @@ namespace ts { return getBinaryOperatorPrecedence(token()) > 0; } + function makeSatisfiesExpression(left: Expression, right: TypeNode): SatisfiesExpression { + return finishNode(factory.createSatisfiesExpression(left, right), left.pos); + } + function makeBinaryExpression(left: Expression, operatorToken: BinaryOperatorToken, right: Expression, pos: number): BinaryExpression { return finishNode(factory.createBinaryExpression(left, operatorToken, right), pos); } diff --git a/src/compiler/program.ts b/src/compiler/program.ts index c29876ce619f5..73ce3efb618be 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2168,6 +2168,9 @@ namespace ts { case SyntaxKind.AsExpression: diagnostics.push(createDiagnosticForNode((node as AsExpression).type, Diagnostics.Type_assertion_expressions_can_only_be_used_in_TypeScript_files)); return "skip"; + case SyntaxKind.SatisfiesExpression: + diagnostics.push(createDiagnosticForNode((node as SatisfiesExpression).type, Diagnostics.Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files)); + return "skip"; case SyntaxKind.TypeAssertionExpression: Debug.fail(); // Won't parse these in a JS file anyway, as they are interpreted as JSX. } diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 6cac0cb1936d1..07cfe1cb0407f 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -135,6 +135,7 @@ namespace ts { require: SyntaxKind.RequireKeyword, global: SyntaxKind.GlobalKeyword, return: SyntaxKind.ReturnKeyword, + satisfies: SyntaxKind.SatisfiesKeyword, set: SyntaxKind.SetKeyword, static: SyntaxKind.StaticKeyword, string: SyntaxKind.StringKeyword, diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 8561db1c633ef..29bec50446e52 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -513,6 +513,9 @@ namespace ts { // TypeScript type assertions are removed, but their subtrees are preserved. return visitAssertionExpression(node as AssertionExpression); + case SyntaxKind.SatisfiesExpression: + return visitSatisfiesExpression(node as SatisfiesExpression); + case SyntaxKind.CallExpression: return visitCallExpression(node as CallExpression); @@ -2258,6 +2261,11 @@ namespace ts { return factory.createPartiallyEmittedExpression(expression, node); } + function visitSatisfiesExpression(node: SatisfiesExpression): Expression { + const expression = visitNode(node.expression, visitor, isExpression); + return factory.createPartiallyEmittedExpression(expression, node); + } + function visitCallExpression(node: CallExpression) { return factory.updateCallExpression( node, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index b75a5ac9439aa..a761688504ec6 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -180,6 +180,7 @@ namespace ts { RequireKeyword, NumberKeyword, ObjectKeyword, + SatisfiesKeyword, SetKeyword, StringKeyword, SymbolKeyword, @@ -273,6 +274,7 @@ namespace ts { NonNullExpression, MetaProperty, SyntheticExpression, + SatisfiesExpression, // Misc TemplateSpan, @@ -602,6 +604,7 @@ namespace ts { | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword + | SyntaxKind.SatisfiesKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword @@ -2485,6 +2488,12 @@ namespace ts { readonly expression: UnaryExpression; } + export interface SatisfiesExpression extends Expression { + readonly kind: SyntaxKind.SatisfiesExpression; + readonly expression: Expression; + readonly type: TypeNode; + } + export type AssertionExpression = | TypeAssertion | AsExpression @@ -7023,17 +7032,19 @@ namespace ts { TypeAssertions = 1 << 1, NonNullAssertions = 1 << 2, PartiallyEmittedExpressions = 1 << 3, + SatisfiesExpression = 1 << 4, Assertions = TypeAssertions | NonNullAssertions, All = Parentheses | Assertions | PartiallyEmittedExpressions, - ExcludeJSDocTypeAssertion = 1 << 4, + ExcludeJSDocTypeAssertion = 1 << 5, } /* @internal */ export type OuterExpression = | ParenthesizedExpression | TypeAssertion + | SatisfiesExpression | AsExpression | NonNullExpression | PartiallyEmittedExpression; @@ -7363,6 +7374,8 @@ namespace ts { updateNonNullChain(node: NonNullChain, expression: Expression): NonNullChain; createMetaProperty(keywordToken: MetaProperty["keywordToken"], name: Identifier): MetaProperty; updateMetaProperty(node: MetaProperty, name: Identifier): MetaProperty; + createSatisfiesExpression(expression: Expression, type: TypeNode): SatisfiesExpression; + updateSatisfiesExpression(node: SatisfiesExpression, expression: Expression, type: TypeNode): SatisfiesExpression; // // Misc diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 9c706c6f61814..043a068468795 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1936,6 +1936,7 @@ namespace ts { case SyntaxKind.TaggedTemplateExpression: case SyntaxKind.AsExpression: case SyntaxKind.TypeAssertionExpression: + case SyntaxKind.SatisfiesExpression: case SyntaxKind.NonNullExpression: case SyntaxKind.ParenthesizedExpression: case SyntaxKind.FunctionExpression: @@ -2034,6 +2035,8 @@ namespace ts { return (parent as ExpressionWithTypeArguments).expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent); case SyntaxKind.ShorthandPropertyAssignment: return (parent as ShorthandPropertyAssignment).objectAssignmentInitializer === node; + case SyntaxKind.SatisfiesExpression: + return node === (parent as SatisfiesExpression).expression; default: return isExpressionNode(parent); } @@ -3722,6 +3725,7 @@ namespace ts { return OperatorPrecedence.Member; case SyntaxKind.AsExpression: + case SyntaxKind.SatisfiesExpression: return OperatorPrecedence.Relational; case SyntaxKind.ThisKeyword: @@ -3780,6 +3784,7 @@ namespace ts { case SyntaxKind.InstanceOfKeyword: case SyntaxKind.InKeyword: case SyntaxKind.AsKeyword: + case SyntaxKind.SatisfiesKeyword: return OperatorPrecedence.Relational; case SyntaxKind.LessThanLessThanToken: case SyntaxKind.GreaterThanGreaterThanToken: @@ -5787,7 +5792,8 @@ namespace ts { case SyntaxKind.PropertyAccessExpression: case SyntaxKind.NonNullExpression: case SyntaxKind.PartiallyEmittedExpression: - node = (node as CallExpression | PropertyAccessExpression | ElementAccessExpression | AsExpression | NonNullExpression | PartiallyEmittedExpression).expression; + case SyntaxKind.SatisfiesExpression: + node = (node as CallExpression | PropertyAccessExpression | ElementAccessExpression | AsExpression | NonNullExpression | PartiallyEmittedExpression | SatisfiesExpression).expression; continue; } diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index 8f834e5e45971..7a94335d5d1cc 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -1592,6 +1592,7 @@ namespace ts { case SyntaxKind.OmittedExpression: case SyntaxKind.CommaListExpression: case SyntaxKind.PartiallyEmittedExpression: + case SyntaxKind.SatisfiesExpression: return true; default: return isUnaryExpressionKind(kind); diff --git a/src/compiler/visitorPublic.ts b/src/compiler/visitorPublic.ts index 5651ac043d325..f4c358738709f 100644 --- a/src/compiler/visitorPublic.ts +++ b/src/compiler/visitorPublic.ts @@ -851,6 +851,12 @@ namespace ts { nodeVisitor(node.expression, visitor, isExpression), nodeVisitor(node.type, visitor, isTypeNode)); + case SyntaxKind.SatisfiesExpression: + Debug.type(node); + return factory.updateSatisfiesExpression(node, + nodeVisitor(node.expression, visitor, isExpression), + nodeVisitor(node.type, visitor, isTypeNode)); + case SyntaxKind.NonNullExpression: if (node.flags & NodeFlags.OptionalChain) { Debug.type(node); diff --git a/src/harness/fourslashInterfaceImpl.ts b/src/harness/fourslashInterfaceImpl.ts index 69f9679add0f6..e6f33e1aaa505 100644 --- a/src/harness/fourslashInterfaceImpl.ts +++ b/src/harness/fourslashInterfaceImpl.ts @@ -1299,6 +1299,7 @@ namespace FourSlashInterface { "readonly", "number", "object", + "satisfies", "string", "symbol", "type", @@ -1415,6 +1416,7 @@ namespace FourSlashInterface { "as", "async", "await", + "satisfies", ].map(keywordEntry); export const undefinedVarEntry: ExpectedCompletionEntryObject = { @@ -1503,6 +1505,7 @@ namespace FourSlashInterface { "readonly", "number", "object", + "satisfies", "string", "symbol", "type", @@ -1558,6 +1561,7 @@ namespace FourSlashInterface { "as", "async", "await", + "satisfies", ].map(keywordEntry); export const insideMethodInJsKeywords = getInJsKeywords(insideMethodKeywords); diff --git a/src/services/callHierarchy.ts b/src/services/callHierarchy.ts index bfb533b0160b2..57f6d5af275e8 100644 --- a/src/services/callHierarchy.ts +++ b/src/services/callHierarchy.ts @@ -449,6 +449,10 @@ namespace ts.CallHierarchy { recordCallSite(node as AccessExpression); forEachChild(node, collect); break; + case SyntaxKind.SatisfiesExpression: + // do not descend into the type side of an assertion + collect((node as SatisfiesExpression).expression); + return; } if (isPartOfTypeNode(node)) { diff --git a/src/services/classifier.ts b/src/services/classifier.ts index 764f22ab92faf..a8af6885be242 100644 --- a/src/services/classifier.ts +++ b/src/services/classifier.ts @@ -369,6 +369,7 @@ namespace ts { case SyntaxKind.InstanceOfKeyword: case SyntaxKind.InKeyword: case SyntaxKind.AsKeyword: + case SyntaxKind.SatisfiesKeyword: case SyntaxKind.EqualsEqualsToken: case SyntaxKind.ExclamationEqualsToken: case SyntaxKind.EqualsEqualsEqualsToken: diff --git a/src/services/completions.ts b/src/services/completions.ts index d40e2dbd05452..af0f639480b9d 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -2334,6 +2334,9 @@ namespace ts.Completions { case SyntaxKind.ExtendsKeyword: return parentKind === SyntaxKind.TypeParameter; + + case SyntaxKind.SatisfiesKeyword: + return parentKind === SyntaxKind.SatisfiesExpression; } } return false; @@ -3496,6 +3499,7 @@ namespace ts.Completions { return kind === SyntaxKind.AsyncKeyword || kind === SyntaxKind.AwaitKeyword || kind === SyntaxKind.AsKeyword + || kind === SyntaxKind.SatisfiesKeyword || !isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind); } diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 76a0d34853153..974bc208fbd9e 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -449,6 +449,7 @@ namespace ts.formatting { case SyntaxKind.TypePredicate: case SyntaxKind.UnionType: case SyntaxKind.IntersectionType: + case SyntaxKind.SatisfiesExpression: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 2ea26a94f1bc6..2b934da5dc228 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -253,212 +253,214 @@ declare namespace ts { RequireKeyword = 145, NumberKeyword = 146, ObjectKeyword = 147, - SetKeyword = 148, - StringKeyword = 149, - SymbolKeyword = 150, - TypeKeyword = 151, - UndefinedKeyword = 152, - UniqueKeyword = 153, - UnknownKeyword = 154, - FromKeyword = 155, - GlobalKeyword = 156, - BigIntKeyword = 157, - OverrideKeyword = 158, - OfKeyword = 159, - QualifiedName = 160, - ComputedPropertyName = 161, - TypeParameter = 162, - Parameter = 163, - Decorator = 164, - PropertySignature = 165, - PropertyDeclaration = 166, - MethodSignature = 167, - MethodDeclaration = 168, - ClassStaticBlockDeclaration = 169, - Constructor = 170, - GetAccessor = 171, - SetAccessor = 172, - CallSignature = 173, - ConstructSignature = 174, - IndexSignature = 175, - TypePredicate = 176, - TypeReference = 177, - FunctionType = 178, - ConstructorType = 179, - TypeQuery = 180, - TypeLiteral = 181, - ArrayType = 182, - TupleType = 183, - OptionalType = 184, - RestType = 185, - UnionType = 186, - IntersectionType = 187, - ConditionalType = 188, - InferType = 189, - ParenthesizedType = 190, - ThisType = 191, - TypeOperator = 192, - IndexedAccessType = 193, - MappedType = 194, - LiteralType = 195, - NamedTupleMember = 196, - TemplateLiteralType = 197, - TemplateLiteralTypeSpan = 198, - ImportType = 199, - ObjectBindingPattern = 200, - ArrayBindingPattern = 201, - BindingElement = 202, - ArrayLiteralExpression = 203, - ObjectLiteralExpression = 204, - PropertyAccessExpression = 205, - ElementAccessExpression = 206, - CallExpression = 207, - NewExpression = 208, - TaggedTemplateExpression = 209, - TypeAssertionExpression = 210, - ParenthesizedExpression = 211, - FunctionExpression = 212, - ArrowFunction = 213, - DeleteExpression = 214, - TypeOfExpression = 215, - VoidExpression = 216, - AwaitExpression = 217, - PrefixUnaryExpression = 218, - PostfixUnaryExpression = 219, - BinaryExpression = 220, - ConditionalExpression = 221, - TemplateExpression = 222, - YieldExpression = 223, - SpreadElement = 224, - ClassExpression = 225, - OmittedExpression = 226, - ExpressionWithTypeArguments = 227, - AsExpression = 228, - NonNullExpression = 229, - MetaProperty = 230, - SyntheticExpression = 231, - TemplateSpan = 232, - SemicolonClassElement = 233, - Block = 234, - EmptyStatement = 235, - VariableStatement = 236, - ExpressionStatement = 237, - IfStatement = 238, - DoStatement = 239, - WhileStatement = 240, - ForStatement = 241, - ForInStatement = 242, - ForOfStatement = 243, - ContinueStatement = 244, - BreakStatement = 245, - ReturnStatement = 246, - WithStatement = 247, - SwitchStatement = 248, - LabeledStatement = 249, - ThrowStatement = 250, - TryStatement = 251, - DebuggerStatement = 252, - VariableDeclaration = 253, - VariableDeclarationList = 254, - FunctionDeclaration = 255, - ClassDeclaration = 256, - InterfaceDeclaration = 257, - TypeAliasDeclaration = 258, - EnumDeclaration = 259, - ModuleDeclaration = 260, - ModuleBlock = 261, - CaseBlock = 262, - NamespaceExportDeclaration = 263, - ImportEqualsDeclaration = 264, - ImportDeclaration = 265, - ImportClause = 266, - NamespaceImport = 267, - NamedImports = 268, - ImportSpecifier = 269, - ExportAssignment = 270, - ExportDeclaration = 271, - NamedExports = 272, - NamespaceExport = 273, - ExportSpecifier = 274, - MissingDeclaration = 275, - ExternalModuleReference = 276, - JsxElement = 277, - JsxSelfClosingElement = 278, - JsxOpeningElement = 279, - JsxClosingElement = 280, - JsxFragment = 281, - JsxOpeningFragment = 282, - JsxClosingFragment = 283, - JsxAttribute = 284, - JsxAttributes = 285, - JsxSpreadAttribute = 286, - JsxExpression = 287, - CaseClause = 288, - DefaultClause = 289, - HeritageClause = 290, - CatchClause = 291, - AssertClause = 292, - AssertEntry = 293, - PropertyAssignment = 294, - ShorthandPropertyAssignment = 295, - SpreadAssignment = 296, - EnumMember = 297, - UnparsedPrologue = 298, - UnparsedPrepend = 299, - UnparsedText = 300, - UnparsedInternalText = 301, - UnparsedSyntheticReference = 302, - SourceFile = 303, - Bundle = 304, - UnparsedSource = 305, - InputFiles = 306, - JSDocTypeExpression = 307, - JSDocNameReference = 308, - JSDocMemberName = 309, - JSDocAllType = 310, - JSDocUnknownType = 311, - JSDocNullableType = 312, - JSDocNonNullableType = 313, - JSDocOptionalType = 314, - JSDocFunctionType = 315, - JSDocVariadicType = 316, - JSDocNamepathType = 317, - JSDocComment = 318, - JSDocText = 319, - JSDocTypeLiteral = 320, - JSDocSignature = 321, - JSDocLink = 322, - JSDocLinkCode = 323, - JSDocLinkPlain = 324, - JSDocTag = 325, - JSDocAugmentsTag = 326, - JSDocImplementsTag = 327, - JSDocAuthorTag = 328, - JSDocDeprecatedTag = 329, - JSDocClassTag = 330, - JSDocPublicTag = 331, - JSDocPrivateTag = 332, - JSDocProtectedTag = 333, - JSDocReadonlyTag = 334, - JSDocOverrideTag = 335, - JSDocCallbackTag = 336, - JSDocEnumTag = 337, - JSDocParameterTag = 338, - JSDocReturnTag = 339, - JSDocThisTag = 340, - JSDocTypeTag = 341, - JSDocTemplateTag = 342, - JSDocTypedefTag = 343, - JSDocSeeTag = 344, - JSDocPropertyTag = 345, - SyntaxList = 346, - NotEmittedStatement = 347, - PartiallyEmittedExpression = 348, - CommaListExpression = 349, - MergeDeclarationMarker = 350, - EndOfDeclarationMarker = 351, - SyntheticReferenceExpression = 352, - Count = 353, + SatisfiesKeyword = 148, + SetKeyword = 149, + StringKeyword = 150, + SymbolKeyword = 151, + TypeKeyword = 152, + UndefinedKeyword = 153, + UniqueKeyword = 154, + UnknownKeyword = 155, + FromKeyword = 156, + GlobalKeyword = 157, + BigIntKeyword = 158, + OverrideKeyword = 159, + OfKeyword = 160, + QualifiedName = 161, + ComputedPropertyName = 162, + TypeParameter = 163, + Parameter = 164, + Decorator = 165, + PropertySignature = 166, + PropertyDeclaration = 167, + MethodSignature = 168, + MethodDeclaration = 169, + ClassStaticBlockDeclaration = 170, + Constructor = 171, + GetAccessor = 172, + SetAccessor = 173, + CallSignature = 174, + ConstructSignature = 175, + IndexSignature = 176, + TypePredicate = 177, + TypeReference = 178, + FunctionType = 179, + ConstructorType = 180, + TypeQuery = 181, + TypeLiteral = 182, + ArrayType = 183, + TupleType = 184, + OptionalType = 185, + RestType = 186, + UnionType = 187, + IntersectionType = 188, + ConditionalType = 189, + InferType = 190, + ParenthesizedType = 191, + ThisType = 192, + TypeOperator = 193, + IndexedAccessType = 194, + MappedType = 195, + LiteralType = 196, + NamedTupleMember = 197, + TemplateLiteralType = 198, + TemplateLiteralTypeSpan = 199, + ImportType = 200, + ObjectBindingPattern = 201, + ArrayBindingPattern = 202, + BindingElement = 203, + ArrayLiteralExpression = 204, + ObjectLiteralExpression = 205, + PropertyAccessExpression = 206, + ElementAccessExpression = 207, + CallExpression = 208, + NewExpression = 209, + TaggedTemplateExpression = 210, + TypeAssertionExpression = 211, + ParenthesizedExpression = 212, + FunctionExpression = 213, + ArrowFunction = 214, + DeleteExpression = 215, + TypeOfExpression = 216, + VoidExpression = 217, + AwaitExpression = 218, + PrefixUnaryExpression = 219, + PostfixUnaryExpression = 220, + BinaryExpression = 221, + ConditionalExpression = 222, + TemplateExpression = 223, + YieldExpression = 224, + SpreadElement = 225, + ClassExpression = 226, + OmittedExpression = 227, + ExpressionWithTypeArguments = 228, + AsExpression = 229, + NonNullExpression = 230, + MetaProperty = 231, + SyntheticExpression = 232, + SatisfiesExpression = 233, + TemplateSpan = 234, + SemicolonClassElement = 235, + Block = 236, + EmptyStatement = 237, + VariableStatement = 238, + ExpressionStatement = 239, + IfStatement = 240, + DoStatement = 241, + WhileStatement = 242, + ForStatement = 243, + ForInStatement = 244, + ForOfStatement = 245, + ContinueStatement = 246, + BreakStatement = 247, + ReturnStatement = 248, + WithStatement = 249, + SwitchStatement = 250, + LabeledStatement = 251, + ThrowStatement = 252, + TryStatement = 253, + DebuggerStatement = 254, + VariableDeclaration = 255, + VariableDeclarationList = 256, + FunctionDeclaration = 257, + ClassDeclaration = 258, + InterfaceDeclaration = 259, + TypeAliasDeclaration = 260, + EnumDeclaration = 261, + ModuleDeclaration = 262, + ModuleBlock = 263, + CaseBlock = 264, + NamespaceExportDeclaration = 265, + ImportEqualsDeclaration = 266, + ImportDeclaration = 267, + ImportClause = 268, + NamespaceImport = 269, + NamedImports = 270, + ImportSpecifier = 271, + ExportAssignment = 272, + ExportDeclaration = 273, + NamedExports = 274, + NamespaceExport = 275, + ExportSpecifier = 276, + MissingDeclaration = 277, + ExternalModuleReference = 278, + JsxElement = 279, + JsxSelfClosingElement = 280, + JsxOpeningElement = 281, + JsxClosingElement = 282, + JsxFragment = 283, + JsxOpeningFragment = 284, + JsxClosingFragment = 285, + JsxAttribute = 286, + JsxAttributes = 287, + JsxSpreadAttribute = 288, + JsxExpression = 289, + CaseClause = 290, + DefaultClause = 291, + HeritageClause = 292, + CatchClause = 293, + AssertClause = 294, + AssertEntry = 295, + PropertyAssignment = 296, + ShorthandPropertyAssignment = 297, + SpreadAssignment = 298, + EnumMember = 299, + UnparsedPrologue = 300, + UnparsedPrepend = 301, + UnparsedText = 302, + UnparsedInternalText = 303, + UnparsedSyntheticReference = 304, + SourceFile = 305, + Bundle = 306, + UnparsedSource = 307, + InputFiles = 308, + JSDocTypeExpression = 309, + JSDocNameReference = 310, + JSDocMemberName = 311, + JSDocAllType = 312, + JSDocUnknownType = 313, + JSDocNullableType = 314, + JSDocNonNullableType = 315, + JSDocOptionalType = 316, + JSDocFunctionType = 317, + JSDocVariadicType = 318, + JSDocNamepathType = 319, + JSDocComment = 320, + JSDocText = 321, + JSDocTypeLiteral = 322, + JSDocSignature = 323, + JSDocLink = 324, + JSDocLinkCode = 325, + JSDocLinkPlain = 326, + JSDocTag = 327, + JSDocAugmentsTag = 328, + JSDocImplementsTag = 329, + JSDocAuthorTag = 330, + JSDocDeprecatedTag = 331, + JSDocClassTag = 332, + JSDocPublicTag = 333, + JSDocPrivateTag = 334, + JSDocProtectedTag = 335, + JSDocReadonlyTag = 336, + JSDocOverrideTag = 337, + JSDocCallbackTag = 338, + JSDocEnumTag = 339, + JSDocParameterTag = 340, + JSDocReturnTag = 341, + JSDocThisTag = 342, + JSDocTypeTag = 343, + JSDocTemplateTag = 344, + JSDocTypedefTag = 345, + JSDocSeeTag = 346, + JSDocPropertyTag = 347, + SyntaxList = 348, + NotEmittedStatement = 349, + PartiallyEmittedExpression = 350, + CommaListExpression = 351, + MergeDeclarationMarker = 352, + EndOfDeclarationMarker = 353, + SyntheticReferenceExpression = 354, + Count = 355, FirstAssignment = 63, LastAssignment = 78, FirstCompoundAssignment = 64, @@ -466,15 +468,15 @@ declare namespace ts { FirstReservedWord = 81, LastReservedWord = 116, FirstKeyword = 81, - LastKeyword = 159, + LastKeyword = 160, FirstFutureReservedWord = 117, LastFutureReservedWord = 125, - FirstTypeNode = 176, - LastTypeNode = 199, + FirstTypeNode = 177, + LastTypeNode = 200, FirstPunctuation = 18, LastPunctuation = 78, FirstToken = 0, - LastToken = 159, + LastToken = 160, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -483,19 +485,19 @@ declare namespace ts { LastTemplateToken = 17, FirstBinaryOperator = 29, LastBinaryOperator = 78, - FirstStatement = 236, - LastStatement = 252, - FirstNode = 160, - FirstJSDocNode = 307, - LastJSDocNode = 345, - FirstJSDocTagNode = 325, - LastJSDocTagNode = 345, + FirstStatement = 238, + LastStatement = 254, + FirstNode = 161, + FirstJSDocNode = 309, + LastJSDocNode = 347, + FirstJSDocTagNode = 327, + LastJSDocTagNode = 347, } export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; export type PseudoLiteralSyntaxKind = SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail; export type PunctuationSyntaxKind = SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.QuestionDotToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionQuestionToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.BacktickToken | SyntaxKind.HashToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken; - export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; + export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SatisfiesKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword; export type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword; export type TokenSyntaxKind = SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | TriviaSyntaxKind | LiteralSyntaxKind | PseudoLiteralSyntaxKind | PunctuationSyntaxKind | SyntaxKind.Identifier | KeywordSyntaxKind; @@ -1313,6 +1315,11 @@ declare namespace ts { readonly type: TypeNode; readonly expression: UnaryExpression; } + export interface SatisfiesExpression extends Expression { + readonly kind: SyntaxKind.SatisfiesExpression; + readonly expression: Expression; + readonly type: TypeNode; + } export type AssertionExpression = TypeAssertion | AsExpression; export interface NonNullExpression extends LeftHandSideExpression { readonly kind: SyntaxKind.NonNullExpression; @@ -3293,9 +3300,10 @@ declare namespace ts { TypeAssertions = 2, NonNullAssertions = 4, PartiallyEmittedExpressions = 8, + SatisfiesExpression = 16, Assertions = 6, All = 15, - ExcludeJSDocTypeAssertion = 16 + ExcludeJSDocTypeAssertion = 32 } export type TypeOfTag = "undefined" | "number" | "bigint" | "boolean" | "string" | "symbol" | "object" | "function"; export interface NodeFactory { @@ -3507,6 +3515,8 @@ declare namespace ts { updateNonNullChain(node: NonNullChain, expression: Expression): NonNullChain; createMetaProperty(keywordToken: MetaProperty["keywordToken"], name: Identifier): MetaProperty; updateMetaProperty(node: MetaProperty, name: Identifier): MetaProperty; + createSatisfiesExpression(expression: Expression, type: TypeNode): SatisfiesExpression; + updateSatisfiesExpression(node: SatisfiesExpression, expression: Expression, type: TypeNode): SatisfiesExpression; createTemplateSpan(expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; updateTemplateSpan(node: TemplateSpan, expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; createSemicolonClassElement(): SemicolonClassElement; @@ -4611,6 +4621,7 @@ declare namespace ts { function isOmittedExpression(node: Node): node is OmittedExpression; function isExpressionWithTypeArguments(node: Node): node is ExpressionWithTypeArguments; function isAsExpression(node: Node): node is AsExpression; + function isSatisfiesExpression(node: Node): node is SatisfiesExpression; function isNonNullExpression(node: Node): node is NonNullExpression; function isMetaProperty(node: Node): node is MetaProperty; function isSyntheticExpression(node: Node): node is SyntheticExpression; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 022504652a940..8cd9820e7457c 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -253,212 +253,214 @@ declare namespace ts { RequireKeyword = 145, NumberKeyword = 146, ObjectKeyword = 147, - SetKeyword = 148, - StringKeyword = 149, - SymbolKeyword = 150, - TypeKeyword = 151, - UndefinedKeyword = 152, - UniqueKeyword = 153, - UnknownKeyword = 154, - FromKeyword = 155, - GlobalKeyword = 156, - BigIntKeyword = 157, - OverrideKeyword = 158, - OfKeyword = 159, - QualifiedName = 160, - ComputedPropertyName = 161, - TypeParameter = 162, - Parameter = 163, - Decorator = 164, - PropertySignature = 165, - PropertyDeclaration = 166, - MethodSignature = 167, - MethodDeclaration = 168, - ClassStaticBlockDeclaration = 169, - Constructor = 170, - GetAccessor = 171, - SetAccessor = 172, - CallSignature = 173, - ConstructSignature = 174, - IndexSignature = 175, - TypePredicate = 176, - TypeReference = 177, - FunctionType = 178, - ConstructorType = 179, - TypeQuery = 180, - TypeLiteral = 181, - ArrayType = 182, - TupleType = 183, - OptionalType = 184, - RestType = 185, - UnionType = 186, - IntersectionType = 187, - ConditionalType = 188, - InferType = 189, - ParenthesizedType = 190, - ThisType = 191, - TypeOperator = 192, - IndexedAccessType = 193, - MappedType = 194, - LiteralType = 195, - NamedTupleMember = 196, - TemplateLiteralType = 197, - TemplateLiteralTypeSpan = 198, - ImportType = 199, - ObjectBindingPattern = 200, - ArrayBindingPattern = 201, - BindingElement = 202, - ArrayLiteralExpression = 203, - ObjectLiteralExpression = 204, - PropertyAccessExpression = 205, - ElementAccessExpression = 206, - CallExpression = 207, - NewExpression = 208, - TaggedTemplateExpression = 209, - TypeAssertionExpression = 210, - ParenthesizedExpression = 211, - FunctionExpression = 212, - ArrowFunction = 213, - DeleteExpression = 214, - TypeOfExpression = 215, - VoidExpression = 216, - AwaitExpression = 217, - PrefixUnaryExpression = 218, - PostfixUnaryExpression = 219, - BinaryExpression = 220, - ConditionalExpression = 221, - TemplateExpression = 222, - YieldExpression = 223, - SpreadElement = 224, - ClassExpression = 225, - OmittedExpression = 226, - ExpressionWithTypeArguments = 227, - AsExpression = 228, - NonNullExpression = 229, - MetaProperty = 230, - SyntheticExpression = 231, - TemplateSpan = 232, - SemicolonClassElement = 233, - Block = 234, - EmptyStatement = 235, - VariableStatement = 236, - ExpressionStatement = 237, - IfStatement = 238, - DoStatement = 239, - WhileStatement = 240, - ForStatement = 241, - ForInStatement = 242, - ForOfStatement = 243, - ContinueStatement = 244, - BreakStatement = 245, - ReturnStatement = 246, - WithStatement = 247, - SwitchStatement = 248, - LabeledStatement = 249, - ThrowStatement = 250, - TryStatement = 251, - DebuggerStatement = 252, - VariableDeclaration = 253, - VariableDeclarationList = 254, - FunctionDeclaration = 255, - ClassDeclaration = 256, - InterfaceDeclaration = 257, - TypeAliasDeclaration = 258, - EnumDeclaration = 259, - ModuleDeclaration = 260, - ModuleBlock = 261, - CaseBlock = 262, - NamespaceExportDeclaration = 263, - ImportEqualsDeclaration = 264, - ImportDeclaration = 265, - ImportClause = 266, - NamespaceImport = 267, - NamedImports = 268, - ImportSpecifier = 269, - ExportAssignment = 270, - ExportDeclaration = 271, - NamedExports = 272, - NamespaceExport = 273, - ExportSpecifier = 274, - MissingDeclaration = 275, - ExternalModuleReference = 276, - JsxElement = 277, - JsxSelfClosingElement = 278, - JsxOpeningElement = 279, - JsxClosingElement = 280, - JsxFragment = 281, - JsxOpeningFragment = 282, - JsxClosingFragment = 283, - JsxAttribute = 284, - JsxAttributes = 285, - JsxSpreadAttribute = 286, - JsxExpression = 287, - CaseClause = 288, - DefaultClause = 289, - HeritageClause = 290, - CatchClause = 291, - AssertClause = 292, - AssertEntry = 293, - PropertyAssignment = 294, - ShorthandPropertyAssignment = 295, - SpreadAssignment = 296, - EnumMember = 297, - UnparsedPrologue = 298, - UnparsedPrepend = 299, - UnparsedText = 300, - UnparsedInternalText = 301, - UnparsedSyntheticReference = 302, - SourceFile = 303, - Bundle = 304, - UnparsedSource = 305, - InputFiles = 306, - JSDocTypeExpression = 307, - JSDocNameReference = 308, - JSDocMemberName = 309, - JSDocAllType = 310, - JSDocUnknownType = 311, - JSDocNullableType = 312, - JSDocNonNullableType = 313, - JSDocOptionalType = 314, - JSDocFunctionType = 315, - JSDocVariadicType = 316, - JSDocNamepathType = 317, - JSDocComment = 318, - JSDocText = 319, - JSDocTypeLiteral = 320, - JSDocSignature = 321, - JSDocLink = 322, - JSDocLinkCode = 323, - JSDocLinkPlain = 324, - JSDocTag = 325, - JSDocAugmentsTag = 326, - JSDocImplementsTag = 327, - JSDocAuthorTag = 328, - JSDocDeprecatedTag = 329, - JSDocClassTag = 330, - JSDocPublicTag = 331, - JSDocPrivateTag = 332, - JSDocProtectedTag = 333, - JSDocReadonlyTag = 334, - JSDocOverrideTag = 335, - JSDocCallbackTag = 336, - JSDocEnumTag = 337, - JSDocParameterTag = 338, - JSDocReturnTag = 339, - JSDocThisTag = 340, - JSDocTypeTag = 341, - JSDocTemplateTag = 342, - JSDocTypedefTag = 343, - JSDocSeeTag = 344, - JSDocPropertyTag = 345, - SyntaxList = 346, - NotEmittedStatement = 347, - PartiallyEmittedExpression = 348, - CommaListExpression = 349, - MergeDeclarationMarker = 350, - EndOfDeclarationMarker = 351, - SyntheticReferenceExpression = 352, - Count = 353, + SatisfiesKeyword = 148, + SetKeyword = 149, + StringKeyword = 150, + SymbolKeyword = 151, + TypeKeyword = 152, + UndefinedKeyword = 153, + UniqueKeyword = 154, + UnknownKeyword = 155, + FromKeyword = 156, + GlobalKeyword = 157, + BigIntKeyword = 158, + OverrideKeyword = 159, + OfKeyword = 160, + QualifiedName = 161, + ComputedPropertyName = 162, + TypeParameter = 163, + Parameter = 164, + Decorator = 165, + PropertySignature = 166, + PropertyDeclaration = 167, + MethodSignature = 168, + MethodDeclaration = 169, + ClassStaticBlockDeclaration = 170, + Constructor = 171, + GetAccessor = 172, + SetAccessor = 173, + CallSignature = 174, + ConstructSignature = 175, + IndexSignature = 176, + TypePredicate = 177, + TypeReference = 178, + FunctionType = 179, + ConstructorType = 180, + TypeQuery = 181, + TypeLiteral = 182, + ArrayType = 183, + TupleType = 184, + OptionalType = 185, + RestType = 186, + UnionType = 187, + IntersectionType = 188, + ConditionalType = 189, + InferType = 190, + ParenthesizedType = 191, + ThisType = 192, + TypeOperator = 193, + IndexedAccessType = 194, + MappedType = 195, + LiteralType = 196, + NamedTupleMember = 197, + TemplateLiteralType = 198, + TemplateLiteralTypeSpan = 199, + ImportType = 200, + ObjectBindingPattern = 201, + ArrayBindingPattern = 202, + BindingElement = 203, + ArrayLiteralExpression = 204, + ObjectLiteralExpression = 205, + PropertyAccessExpression = 206, + ElementAccessExpression = 207, + CallExpression = 208, + NewExpression = 209, + TaggedTemplateExpression = 210, + TypeAssertionExpression = 211, + ParenthesizedExpression = 212, + FunctionExpression = 213, + ArrowFunction = 214, + DeleteExpression = 215, + TypeOfExpression = 216, + VoidExpression = 217, + AwaitExpression = 218, + PrefixUnaryExpression = 219, + PostfixUnaryExpression = 220, + BinaryExpression = 221, + ConditionalExpression = 222, + TemplateExpression = 223, + YieldExpression = 224, + SpreadElement = 225, + ClassExpression = 226, + OmittedExpression = 227, + ExpressionWithTypeArguments = 228, + AsExpression = 229, + NonNullExpression = 230, + MetaProperty = 231, + SyntheticExpression = 232, + SatisfiesExpression = 233, + TemplateSpan = 234, + SemicolonClassElement = 235, + Block = 236, + EmptyStatement = 237, + VariableStatement = 238, + ExpressionStatement = 239, + IfStatement = 240, + DoStatement = 241, + WhileStatement = 242, + ForStatement = 243, + ForInStatement = 244, + ForOfStatement = 245, + ContinueStatement = 246, + BreakStatement = 247, + ReturnStatement = 248, + WithStatement = 249, + SwitchStatement = 250, + LabeledStatement = 251, + ThrowStatement = 252, + TryStatement = 253, + DebuggerStatement = 254, + VariableDeclaration = 255, + VariableDeclarationList = 256, + FunctionDeclaration = 257, + ClassDeclaration = 258, + InterfaceDeclaration = 259, + TypeAliasDeclaration = 260, + EnumDeclaration = 261, + ModuleDeclaration = 262, + ModuleBlock = 263, + CaseBlock = 264, + NamespaceExportDeclaration = 265, + ImportEqualsDeclaration = 266, + ImportDeclaration = 267, + ImportClause = 268, + NamespaceImport = 269, + NamedImports = 270, + ImportSpecifier = 271, + ExportAssignment = 272, + ExportDeclaration = 273, + NamedExports = 274, + NamespaceExport = 275, + ExportSpecifier = 276, + MissingDeclaration = 277, + ExternalModuleReference = 278, + JsxElement = 279, + JsxSelfClosingElement = 280, + JsxOpeningElement = 281, + JsxClosingElement = 282, + JsxFragment = 283, + JsxOpeningFragment = 284, + JsxClosingFragment = 285, + JsxAttribute = 286, + JsxAttributes = 287, + JsxSpreadAttribute = 288, + JsxExpression = 289, + CaseClause = 290, + DefaultClause = 291, + HeritageClause = 292, + CatchClause = 293, + AssertClause = 294, + AssertEntry = 295, + PropertyAssignment = 296, + ShorthandPropertyAssignment = 297, + SpreadAssignment = 298, + EnumMember = 299, + UnparsedPrologue = 300, + UnparsedPrepend = 301, + UnparsedText = 302, + UnparsedInternalText = 303, + UnparsedSyntheticReference = 304, + SourceFile = 305, + Bundle = 306, + UnparsedSource = 307, + InputFiles = 308, + JSDocTypeExpression = 309, + JSDocNameReference = 310, + JSDocMemberName = 311, + JSDocAllType = 312, + JSDocUnknownType = 313, + JSDocNullableType = 314, + JSDocNonNullableType = 315, + JSDocOptionalType = 316, + JSDocFunctionType = 317, + JSDocVariadicType = 318, + JSDocNamepathType = 319, + JSDocComment = 320, + JSDocText = 321, + JSDocTypeLiteral = 322, + JSDocSignature = 323, + JSDocLink = 324, + JSDocLinkCode = 325, + JSDocLinkPlain = 326, + JSDocTag = 327, + JSDocAugmentsTag = 328, + JSDocImplementsTag = 329, + JSDocAuthorTag = 330, + JSDocDeprecatedTag = 331, + JSDocClassTag = 332, + JSDocPublicTag = 333, + JSDocPrivateTag = 334, + JSDocProtectedTag = 335, + JSDocReadonlyTag = 336, + JSDocOverrideTag = 337, + JSDocCallbackTag = 338, + JSDocEnumTag = 339, + JSDocParameterTag = 340, + JSDocReturnTag = 341, + JSDocThisTag = 342, + JSDocTypeTag = 343, + JSDocTemplateTag = 344, + JSDocTypedefTag = 345, + JSDocSeeTag = 346, + JSDocPropertyTag = 347, + SyntaxList = 348, + NotEmittedStatement = 349, + PartiallyEmittedExpression = 350, + CommaListExpression = 351, + MergeDeclarationMarker = 352, + EndOfDeclarationMarker = 353, + SyntheticReferenceExpression = 354, + Count = 355, FirstAssignment = 63, LastAssignment = 78, FirstCompoundAssignment = 64, @@ -466,15 +468,15 @@ declare namespace ts { FirstReservedWord = 81, LastReservedWord = 116, FirstKeyword = 81, - LastKeyword = 159, + LastKeyword = 160, FirstFutureReservedWord = 117, LastFutureReservedWord = 125, - FirstTypeNode = 176, - LastTypeNode = 199, + FirstTypeNode = 177, + LastTypeNode = 200, FirstPunctuation = 18, LastPunctuation = 78, FirstToken = 0, - LastToken = 159, + LastToken = 160, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -483,19 +485,19 @@ declare namespace ts { LastTemplateToken = 17, FirstBinaryOperator = 29, LastBinaryOperator = 78, - FirstStatement = 236, - LastStatement = 252, - FirstNode = 160, - FirstJSDocNode = 307, - LastJSDocNode = 345, - FirstJSDocTagNode = 325, - LastJSDocTagNode = 345, + FirstStatement = 238, + LastStatement = 254, + FirstNode = 161, + FirstJSDocNode = 309, + LastJSDocNode = 347, + FirstJSDocTagNode = 327, + LastJSDocTagNode = 347, } export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; export type PseudoLiteralSyntaxKind = SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail; export type PunctuationSyntaxKind = SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.QuestionDotToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionQuestionToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.BacktickToken | SyntaxKind.HashToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken; - export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; + export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SatisfiesKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword; export type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword; export type TokenSyntaxKind = SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | TriviaSyntaxKind | LiteralSyntaxKind | PseudoLiteralSyntaxKind | PunctuationSyntaxKind | SyntaxKind.Identifier | KeywordSyntaxKind; @@ -1313,6 +1315,11 @@ declare namespace ts { readonly type: TypeNode; readonly expression: UnaryExpression; } + export interface SatisfiesExpression extends Expression { + readonly kind: SyntaxKind.SatisfiesExpression; + readonly expression: Expression; + readonly type: TypeNode; + } export type AssertionExpression = TypeAssertion | AsExpression; export interface NonNullExpression extends LeftHandSideExpression { readonly kind: SyntaxKind.NonNullExpression; @@ -3293,9 +3300,10 @@ declare namespace ts { TypeAssertions = 2, NonNullAssertions = 4, PartiallyEmittedExpressions = 8, + SatisfiesExpression = 16, Assertions = 6, All = 15, - ExcludeJSDocTypeAssertion = 16 + ExcludeJSDocTypeAssertion = 32 } export type TypeOfTag = "undefined" | "number" | "bigint" | "boolean" | "string" | "symbol" | "object" | "function"; export interface NodeFactory { @@ -3507,6 +3515,8 @@ declare namespace ts { updateNonNullChain(node: NonNullChain, expression: Expression): NonNullChain; createMetaProperty(keywordToken: MetaProperty["keywordToken"], name: Identifier): MetaProperty; updateMetaProperty(node: MetaProperty, name: Identifier): MetaProperty; + createSatisfiesExpression(expression: Expression, type: TypeNode): SatisfiesExpression; + updateSatisfiesExpression(node: SatisfiesExpression, expression: Expression, type: TypeNode): SatisfiesExpression; createTemplateSpan(expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; updateTemplateSpan(node: TemplateSpan, expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; createSemicolonClassElement(): SemicolonClassElement; @@ -4611,6 +4621,7 @@ declare namespace ts { function isOmittedExpression(node: Node): node is OmittedExpression; function isExpressionWithTypeArguments(node: Node): node is ExpressionWithTypeArguments; function isAsExpression(node: Node): node is AsExpression; + function isSatisfiesExpression(node: Node): node is SatisfiesExpression; function isNonNullExpression(node: Node): node is NonNullExpression; function isMetaProperty(node: Node): node is MetaProperty; function isSyntheticExpression(node: Node): node is SyntheticExpression; diff --git a/tests/baselines/reference/completionsCommentsClass.baseline b/tests/baselines/reference/completionsCommentsClass.baseline index f6625952f041c..0c1d9fccb1dae 100644 --- a/tests/baselines/reference/completionsCommentsClass.baseline +++ b/tests/baselines/reference/completionsCommentsClass.baseline @@ -3864,6 +3864,18 @@ } ] }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] + }, { "name": "string", "kind": "keyword", diff --git a/tests/baselines/reference/completionsCommentsClassMembers.baseline b/tests/baselines/reference/completionsCommentsClassMembers.baseline index b3fd787cd6b58..406dcb460dbd4 100644 --- a/tests/baselines/reference/completionsCommentsClassMembers.baseline +++ b/tests/baselines/reference/completionsCommentsClassMembers.baseline @@ -4807,6 +4807,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } @@ -11863,6 +11875,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } @@ -16675,6 +16699,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } @@ -23731,6 +23767,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } @@ -27795,6 +27843,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } @@ -33014,6 +33074,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } @@ -37032,6 +37104,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } @@ -42205,6 +42289,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } @@ -47424,6 +47520,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } @@ -52643,6 +52751,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } @@ -57862,6 +57982,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } @@ -61921,6 +62053,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } @@ -65980,6 +66124,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } @@ -70039,6 +70195,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } @@ -74098,6 +74266,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } @@ -78157,6 +78337,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } @@ -82216,6 +82408,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } @@ -86700,6 +86904,18 @@ } ] }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] + }, { "name": "string", "kind": "keyword", @@ -92056,6 +92272,18 @@ } ] }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] + }, { "name": "string", "kind": "keyword", @@ -96582,6 +96810,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } diff --git a/tests/baselines/reference/completionsCommentsCommentParsing.baseline b/tests/baselines/reference/completionsCommentsCommentParsing.baseline index 6da2d73bc7fbe..a0a77ab361087 100644 --- a/tests/baselines/reference/completionsCommentsCommentParsing.baseline +++ b/tests/baselines/reference/completionsCommentsCommentParsing.baseline @@ -5642,6 +5642,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } @@ -12085,6 +12097,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } @@ -17708,6 +17732,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } @@ -23337,6 +23373,18 @@ } ] }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] + }, { "name": "string", "kind": "keyword", @@ -29150,6 +29198,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } @@ -35593,6 +35653,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } @@ -41222,6 +41294,18 @@ } ] }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] + }, { "name": "string", "kind": "keyword", diff --git a/tests/baselines/reference/completionsCommentsFunctionDeclaration.baseline b/tests/baselines/reference/completionsCommentsFunctionDeclaration.baseline index 87283cb4e0c3e..7f37fd834f99c 100644 --- a/tests/baselines/reference/completionsCommentsFunctionDeclaration.baseline +++ b/tests/baselines/reference/completionsCommentsFunctionDeclaration.baseline @@ -4305,6 +4305,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } @@ -7781,6 +7793,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } @@ -12091,6 +12115,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } diff --git a/tests/baselines/reference/completionsCommentsFunctionExpression.baseline b/tests/baselines/reference/completionsCommentsFunctionExpression.baseline index 52b00c2a5d86a..aefb05ef2873e 100644 --- a/tests/baselines/reference/completionsCommentsFunctionExpression.baseline +++ b/tests/baselines/reference/completionsCommentsFunctionExpression.baseline @@ -3771,6 +3771,18 @@ } ] }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] + }, { "name": "string", "kind": "keyword", @@ -8493,6 +8505,18 @@ } ] }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] + }, { "name": "string", "kind": "keyword", @@ -12230,6 +12254,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } @@ -16724,6 +16760,18 @@ "kind": "keyword" } ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] } ] } diff --git a/tests/baselines/reference/jsFileCompilationTypeSatisfaction.errors.txt b/tests/baselines/reference/jsFileCompilationTypeSatisfaction.errors.txt new file mode 100644 index 0000000000000..f8f9369db84ee --- /dev/null +++ b/tests/baselines/reference/jsFileCompilationTypeSatisfaction.errors.txt @@ -0,0 +1,8 @@ +/src/a.js(1,29): error TS8035: Type satisfaction expressions can only be used in TypeScript files. + + +==== /src/a.js (1 errors) ==== + var v = undefined satisfies 1; + ~ +!!! error TS8035: Type satisfaction expressions can only be used in TypeScript files. + \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationTypeSatisfaction.js b/tests/baselines/reference/jsFileCompilationTypeSatisfaction.js new file mode 100644 index 0000000000000..3d28ea0e2675d --- /dev/null +++ b/tests/baselines/reference/jsFileCompilationTypeSatisfaction.js @@ -0,0 +1,6 @@ +//// [a.js] +var v = undefined satisfies 1; + + +//// [a.js] +var v = undefined; diff --git a/tests/baselines/reference/jsFileCompilationTypeSatisfaction.symbols b/tests/baselines/reference/jsFileCompilationTypeSatisfaction.symbols new file mode 100644 index 0000000000000..e5424113f5b8b --- /dev/null +++ b/tests/baselines/reference/jsFileCompilationTypeSatisfaction.symbols @@ -0,0 +1,5 @@ +=== /src/a.js === +var v = undefined satisfies 1; +>v : Symbol(v, Decl(a.js, 0, 3)) +>undefined : Symbol(undefined) + diff --git a/tests/baselines/reference/jsFileCompilationTypeSatisfaction.types b/tests/baselines/reference/jsFileCompilationTypeSatisfaction.types new file mode 100644 index 0000000000000..75a6ce78fbd6e --- /dev/null +++ b/tests/baselines/reference/jsFileCompilationTypeSatisfaction.types @@ -0,0 +1,6 @@ +=== /src/a.js === +var v = undefined satisfies 1; +>v : 1 +>undefined satisfies 1 : 1 +>undefined : undefined + diff --git a/tests/baselines/reference/typeSatisfaction.errors.txt b/tests/baselines/reference/typeSatisfaction.errors.txt new file mode 100644 index 0000000000000..0e129125802b1 --- /dev/null +++ b/tests/baselines/reference/typeSatisfaction.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/expressions/typeSatisfaction/typeSatisfaction.ts(6,37): error TS1360: 'I' is not satisfied '{ a: number; b: number; }' +tests/cases/conformance/expressions/typeSatisfaction/typeSatisfaction.ts(7,26): error TS1360: 'I' is not satisfied '{}' + + +==== tests/cases/conformance/expressions/typeSatisfaction/typeSatisfaction.ts (2 errors) ==== + interface I { + a: number; + } + + const a1 = { a: 1 } satisfies I; // Ok + const a2 = { a: 1, b: 1 } satisfies I; // Error + ~ +!!! error TS1360: 'I' is not satisfied '{ a: number; b: number; }' + const a3 = { } satisfies I; // Error + ~ +!!! error TS1360: 'I' is not satisfied '{}' + \ No newline at end of file diff --git a/tests/baselines/reference/typeSatisfaction.js b/tests/baselines/reference/typeSatisfaction.js new file mode 100644 index 0000000000000..57b84d0b2e34e --- /dev/null +++ b/tests/baselines/reference/typeSatisfaction.js @@ -0,0 +1,14 @@ +//// [typeSatisfaction.ts] +interface I { + a: number; +} + +const a1 = { a: 1 } satisfies I; // Ok +const a2 = { a: 1, b: 1 } satisfies I; // Error +const a3 = { } satisfies I; // Error + + +//// [typeSatisfaction.js] +var a1 = { a: 1 }; // Ok +var a2 = { a: 1, b: 1 }; // Error +var a3 = {}; // Error diff --git a/tests/baselines/reference/typeSatisfaction.symbols b/tests/baselines/reference/typeSatisfaction.symbols new file mode 100644 index 0000000000000..1506c57c68e8d --- /dev/null +++ b/tests/baselines/reference/typeSatisfaction.symbols @@ -0,0 +1,23 @@ +=== tests/cases/conformance/expressions/typeSatisfaction/typeSatisfaction.ts === +interface I { +>I : Symbol(I, Decl(typeSatisfaction.ts, 0, 0)) + + a: number; +>a : Symbol(I.a, Decl(typeSatisfaction.ts, 0, 13)) +} + +const a1 = { a: 1 } satisfies I; // Ok +>a1 : Symbol(a1, Decl(typeSatisfaction.ts, 4, 5)) +>a : Symbol(a, Decl(typeSatisfaction.ts, 4, 12)) +>I : Symbol(I, Decl(typeSatisfaction.ts, 0, 0)) + +const a2 = { a: 1, b: 1 } satisfies I; // Error +>a2 : Symbol(a2, Decl(typeSatisfaction.ts, 5, 5)) +>a : Symbol(a, Decl(typeSatisfaction.ts, 5, 12)) +>b : Symbol(b, Decl(typeSatisfaction.ts, 5, 18)) +>I : Symbol(I, Decl(typeSatisfaction.ts, 0, 0)) + +const a3 = { } satisfies I; // Error +>a3 : Symbol(a3, Decl(typeSatisfaction.ts, 6, 5)) +>I : Symbol(I, Decl(typeSatisfaction.ts, 0, 0)) + diff --git a/tests/baselines/reference/typeSatisfaction.types b/tests/baselines/reference/typeSatisfaction.types new file mode 100644 index 0000000000000..77f850a56c7f9 --- /dev/null +++ b/tests/baselines/reference/typeSatisfaction.types @@ -0,0 +1,27 @@ +=== tests/cases/conformance/expressions/typeSatisfaction/typeSatisfaction.ts === +interface I { + a: number; +>a : number +} + +const a1 = { a: 1 } satisfies I; // Ok +>a1 : I +>{ a: 1 } satisfies I : I +>{ a: 1 } : { a: number; } +>a : number +>1 : 1 + +const a2 = { a: 1, b: 1 } satisfies I; // Error +>a2 : I +>{ a: 1, b: 1 } satisfies I : I +>{ a: 1, b: 1 } : { a: number; b: number; } +>a : number +>1 : 1 +>b : number +>1 : 1 + +const a3 = { } satisfies I; // Error +>a3 : I +>{ } satisfies I : I +>{ } : {} + diff --git a/tests/cases/compiler/jsFileCompilationTypeSatisfaction.ts b/tests/cases/compiler/jsFileCompilationTypeSatisfaction.ts new file mode 100644 index 0000000000000..ba4701687bc08 --- /dev/null +++ b/tests/cases/compiler/jsFileCompilationTypeSatisfaction.ts @@ -0,0 +1,5 @@ +// @allowJs: true +// @filename: /src/a.js +// @out: /lib/a.js + +var v = undefined satisfies 1; diff --git a/tests/cases/conformance/expressions/typeSatisfaction/typeSatisfaction.ts b/tests/cases/conformance/expressions/typeSatisfaction/typeSatisfaction.ts new file mode 100644 index 0000000000000..29739f8501883 --- /dev/null +++ b/tests/cases/conformance/expressions/typeSatisfaction/typeSatisfaction.ts @@ -0,0 +1,7 @@ +interface I { + a: number; +} + +const a1 = { a: 1 } satisfies I; // Ok +const a2 = { a: 1, b: 1 } satisfies I; // Error +const a3 = { } satisfies I; // Error diff --git a/tests/cases/fourslash/completionSatisfiesKeyword.ts b/tests/cases/fourslash/completionSatisfiesKeyword.ts new file mode 100644 index 0000000000000..c44ca016c3f6f --- /dev/null +++ b/tests/cases/fourslash/completionSatisfiesKeyword.ts @@ -0,0 +1,11 @@ +/// + +////const x = { a: 1 } /*1*/ +////function foo() { +//// const x = { a: 1 } /*2*/ +////} + +verify.completions({ + marker: ["1", "2"], + includes: [{ name: "satisfies", sortText: completion.SortText.GlobalsOrKeywords }] +}); diff --git a/tests/cases/fourslash/satisfiesOperatorCompletion.ts b/tests/cases/fourslash/satisfiesOperatorCompletion.ts new file mode 100644 index 0000000000000..94b07db40da32 --- /dev/null +++ b/tests/cases/fourslash/satisfiesOperatorCompletion.ts @@ -0,0 +1,7 @@ +/// + +//// type T = number; +//// var x; +//// var y = x satisfies /**/ + +verify.completions({ marker: "", includes: "T" });