diff --git a/lib/tsc.js b/lib/tsc.js index 3698d06d1a471..12bb4e68b5b08 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -65,7 +65,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) { var ts; (function (ts) { ts.versionMajorMinor = "4.3"; - ts.version = "4.3.1-rc"; + ts.version = "4.3.2"; var NativeCollections; (function (NativeCollections) { function tryGetNativeMap() { @@ -1384,7 +1384,8 @@ var ts; return a === b ? 0 : a === undefined ? -1 : b === undefined ? 1 : - a < b ? -1 : 1; + a < b ? -1 : + 1; } function compareValues(a, b) { return compareComparableValues(a, b); @@ -4969,7 +4970,8 @@ var ts; if (ts.sys && ts.sys.getEnvironmentVariable) { setCustomPollingValues(ts.sys); ts.Debug.setAssertionLevel(/^development$/i.test(ts.sys.getEnvironmentVariable("NODE_ENV")) - ? 1 : 0); + ? 1 + : 0); } if (ts.sys && ts.sys.debugMode) { ts.Debug.isDebugging = true; @@ -4985,7 +4987,7 @@ var ts; Identifier_expected: diag(1003, ts.DiagnosticCategory.Error, "Identifier_expected_1003", "Identifier expected."), _0_expected: diag(1005, ts.DiagnosticCategory.Error, "_0_expected_1005", "'{0}' expected."), A_file_cannot_have_a_reference_to_itself: diag(1006, ts.DiagnosticCategory.Error, "A_file_cannot_have_a_reference_to_itself_1006", "A file cannot have a reference to itself."), - The_parser_expected_to_find_a_1_to_match_the_0_token_here: diag(1007, ts.DiagnosticCategory.Error, "The_parser_expected_to_find_a_1_to_match_the_0_token_here_1007", "The parser expected to find a '{1}' to match the '{0}' token here."), + The_parser_expected_to_find_a_to_match_the_token_here: diag(1007, ts.DiagnosticCategory.Error, "The_parser_expected_to_find_a_to_match_the_token_here_1007", "The parser expected to find a '}' to match the '{' token here."), Trailing_comma_not_allowed: diag(1009, ts.DiagnosticCategory.Error, "Trailing_comma_not_allowed_1009", "Trailing comma not allowed."), Asterisk_Slash_expected: diag(1010, ts.DiagnosticCategory.Error, "Asterisk_Slash_expected_1010", "'*/' expected."), An_element_access_expression_should_take_an_argument: diag(1011, ts.DiagnosticCategory.Error, "An_element_access_expression_should_take_an_argument_1011", "An element access expression should take an argument."), @@ -12517,7 +12519,8 @@ var ts; case 217: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? - binaryOperator === 62 || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 : 2 : 0; + binaryOperator === 62 || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 : 2 : + 0; case 215: case 216: var unaryOperator = parent.operator; @@ -14521,7 +14524,8 @@ var ts; if (getCheckFlags(s) & 6) { var checkFlags = s.checkFlags; var accessModifier = checkFlags & 1024 ? 8 : - checkFlags & 256 ? 4 : 16; + checkFlags & 256 ? 4 : + 16; var staticModifier = checkFlags & 2048 ? 32 : 0; return accessModifier | staticModifier; } @@ -15020,7 +15024,8 @@ var ts; } function compareDiagnostics(d1, d2) { return compareDiagnosticsSkipRelatedInformation(d1, d2) || - compareRelatedInformation(d1, d2) || 0; + compareRelatedInformation(d1, d2) || + 0; } ts.compareDiagnostics = compareDiagnostics; function compareDiagnosticsSkipRelatedInformation(d1, d2) { @@ -15028,7 +15033,8 @@ var ts; ts.compareValues(d1.start, d2.start) || ts.compareValues(d1.length, d2.length) || ts.compareValues(d1.code, d2.code) || - compareMessageText(d1.messageText, d2.messageText) || 0; + compareMessageText(d1.messageText, d2.messageText) || + 0; } ts.compareDiagnosticsSkipRelatedInformation = compareDiagnosticsSkipRelatedInformation; function compareRelatedInformation(d1, d2) { @@ -17209,7 +17215,8 @@ var ts; switch (token) { case 129: transformFlags = - 128 | 64; + 128 | + 64; break; case 122: case 120: @@ -17322,7 +17329,9 @@ var ts; var node = createBaseNode(159); node.expression = parenthesizerRules().parenthesizeExpressionOfComputedPropertyName(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 512 | 65536; + propagateChildFlags(node.expression) | + 512 | + 65536; return node; } function updateComputedPropertyName(node, expression) { @@ -17379,7 +17388,9 @@ var ts; var node = createBaseNode(162); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 1 | 4096; + propagateChildFlags(node.expression) | + 1 | + 4096; return node; } function updateDecorator(node, expression) { @@ -17408,7 +17419,8 @@ var ts; node.exclamationToken = questionOrExclamationToken && ts.isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.transformFlags |= propagateChildFlags(node.questionToken) | - propagateChildFlags(node.exclamationToken) | 8388608; + propagateChildFlags(node.exclamationToken) | + 8388608; if (ts.isComputedPropertyName(node.name) || (ts.hasStaticModifier(node) && node.initializer)) { node.transformFlags |= 4096; } @@ -17450,7 +17462,8 @@ var ts; node.questionToken = questionToken; node.transformFlags |= propagateChildFlags(node.asteriskToken) | - propagateChildFlags(node.questionToken) | 512; + propagateChildFlags(node.questionToken) | + 512; if (questionToken) { node.transformFlags |= 1; } @@ -17889,10 +17902,13 @@ var ts; var node = createBaseNode(197); node.elements = createNodeArray(elements); node.transformFlags |= - propagateChildrenFlags(node.elements) | 512 | 262144; + propagateChildrenFlags(node.elements) | + 512 | + 262144; if (node.transformFlags & 16384) { node.transformFlags |= - 64 | 32768; + 64 | + 32768; } return node; } @@ -17905,7 +17921,9 @@ var ts; var node = createBaseNode(198); node.elements = createNodeArray(elements); node.transformFlags |= - propagateChildrenFlags(node.elements) | 512 | 262144; + propagateChildrenFlags(node.elements) | + 512 | + 262144; return node; } function updateArrayBindingPattern(node, elements) { @@ -17918,7 +17936,8 @@ var ts; node.propertyName = asName(propertyName); node.dotDotDotToken = dotDotDotToken; node.transformFlags |= - propagateChildFlags(node.dotDotDotToken) | 512; + propagateChildFlags(node.dotDotDotToken) | + 512; if (node.propertyName) { node.transformFlags |= ts.isIdentifier(node.propertyName) ? propagateIdentifierNameFlags(node.propertyName) : @@ -17975,7 +17994,8 @@ var ts; propagateChildFlags(node.name)); if (ts.isSuperKeyword(expression)) { node.transformFlags |= - 128 | 64; + 128 | + 64; } return node; } @@ -18020,7 +18040,8 @@ var ts; propagateChildFlags(node.argumentExpression); if (ts.isSuperKeyword(expression)) { node.transformFlags |= - 128 | 64; + 128 | + 64; } return node; } @@ -18042,7 +18063,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.questionDotToken) | - propagateChildFlags(node.argumentExpression) | 16; + propagateChildFlags(node.argumentExpression) | + 16; return node; } function updateElementAccessChain(node, expression, questionDotToken, argumentExpression) { @@ -18094,7 +18116,8 @@ var ts; propagateChildFlags(node.expression) | propagateChildFlags(node.questionDotToken) | propagateChildrenFlags(node.typeArguments) | - propagateChildrenFlags(node.arguments) | 16; + propagateChildrenFlags(node.arguments) | + 16; if (node.typeArguments) { node.transformFlags |= 1; } @@ -18120,7 +18143,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.expression) | propagateChildrenFlags(node.typeArguments) | - propagateChildrenFlags(node.arguments) | 16; + propagateChildrenFlags(node.arguments) | + 16; if (node.typeArguments) { node.transformFlags |= 1; } @@ -18141,7 +18165,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.tag) | propagateChildrenFlags(node.typeArguments) | - propagateChildFlags(node.template) | 512; + propagateChildFlags(node.template) | + 512; if (node.typeArguments) { node.transformFlags |= 1; } @@ -18163,7 +18188,8 @@ var ts; node.type = type; node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildFlags(node.type) | 1; + propagateChildFlags(node.type) | + 1; return node; } function updateTypeAssertion(node, type, expression) { @@ -18218,7 +18244,8 @@ var ts; var node = createBaseFunctionLikeDeclaration(210, undefined, modifiers, undefined, typeParameters, parameters, type, parenthesizerRules().parenthesizeConciseBodyOfArrowFunction(body)); node.equalsGreaterThanToken = equalsGreaterThanToken !== null && equalsGreaterThanToken !== void 0 ? equalsGreaterThanToken : createToken(38); node.transformFlags |= - propagateChildFlags(node.equalsGreaterThanToken) | 512; + propagateChildFlags(node.equalsGreaterThanToken) | + 512; if (ts.modifiersToFlags(node.modifiers) & 256) { node.transformFlags |= 128; } @@ -18271,7 +18298,10 @@ var ts; var node = createBaseExpression(214); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 128 | 64 | 1048576; + propagateChildFlags(node.expression) | + 128 | + 64 | + 1048576; return node; } function updateAwaitExpression(node, expression) { @@ -18320,12 +18350,15 @@ var ts; else if (operatorKind === 62) { if (ts.isObjectLiteralExpression(node.left)) { node.transformFlags |= - 512 | 64 | 2048 | + 512 | + 64 | + 2048 | propagateAssignmentPatternFlags(node.left); } else if (ts.isArrayLiteralExpression(node.left)) { node.transformFlags |= - 512 | 2048 | + 512 | + 2048 | propagateAssignmentPatternFlags(node.left); } } @@ -18395,7 +18428,8 @@ var ts; node.templateSpans = createNodeArray(templateSpans); node.transformFlags |= propagateChildFlags(node.head) | - propagateChildrenFlags(node.templateSpans) | 512; + propagateChildrenFlags(node.templateSpans) | + 512; return node; } function updateTemplateExpression(node, head, templateSpans) { @@ -18455,7 +18489,10 @@ var ts; node.asteriskToken = asteriskToken; node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildFlags(node.asteriskToken) | 512 | 64 | 524288; + propagateChildFlags(node.asteriskToken) | + 512 | + 64 | + 524288; return node; } function updateYieldExpression(node, asteriskToken, expression) { @@ -18468,7 +18505,9 @@ var ts; var node = createBaseExpression(221); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 512 | 16384; + propagateChildFlags(node.expression) | + 512 | + 16384; return node; } function updateSpreadElement(node, expression) { @@ -18500,7 +18539,8 @@ var ts; node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildrenFlags(node.typeArguments) | 512; + propagateChildrenFlags(node.typeArguments) | + 512; return node; } function updateExpressionWithTypeArguments(node, expression, typeArguments) { @@ -18515,7 +18555,8 @@ var ts; node.type = type; node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildFlags(node.type) | 1; + propagateChildFlags(node.type) | + 1; return node; } function updateAsExpression(node, expression, type) { @@ -18528,7 +18569,8 @@ var ts; var node = createBaseExpression(226); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 1; + propagateChildFlags(node.expression) | + 1; return node; } function updateNonNullExpression(node, expression) { @@ -18544,7 +18586,8 @@ var ts; node.flags |= 32; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 1; + propagateChildFlags(node.expression) | + 1; return node; } function updateNonNullChain(node, expression) { @@ -18581,7 +18624,8 @@ var ts; node.literal = literal; node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildFlags(node.literal) | 512; + propagateChildFlags(node.literal) | + 512; return node; } function updateTemplateSpan(node, expression, literal) { @@ -18734,7 +18778,8 @@ var ts; propagateChildFlags(node.awaitModifier) | propagateChildFlags(node.initializer) | propagateChildFlags(node.expression) | - propagateChildFlags(node.statement) | 512; + propagateChildFlags(node.statement) | + 512; if (awaitModifier) node.transformFlags |= 64; return node; @@ -18751,7 +18796,8 @@ var ts; var node = createBaseNode(241); node.label = asName(label); node.transformFlags |= - propagateChildFlags(node.label) | 2097152; + propagateChildFlags(node.label) | + 2097152; return node; } function updateContinueStatement(node, label) { @@ -18763,7 +18809,8 @@ var ts; var node = createBaseNode(242); node.label = asName(label); node.transformFlags |= - propagateChildFlags(node.label) | 2097152; + propagateChildFlags(node.label) | + 2097152; return node; } function updateBreakStatement(node, label) { @@ -18775,7 +18822,9 @@ var ts; var node = createBaseNode(243); node.expression = expression; node.transformFlags |= - propagateChildFlags(node.expression) | 64 | 2097152; + propagateChildFlags(node.expression) | + 64 | + 2097152; return node; } function updateReturnStatement(node, expression) { @@ -18883,10 +18932,12 @@ var ts; node.flags |= flags & 3; node.declarations = createNodeArray(declarations); node.transformFlags |= - propagateChildrenFlags(node.declarations) | 2097152; + propagateChildrenFlags(node.declarations) | + 2097152; if (flags & 3) { node.transformFlags |= - 512 | 131072; + 512 | + 131072; } return node; } @@ -18903,7 +18954,8 @@ var ts; } else { node.transformFlags |= - propagateChildFlags(node.asteriskToken) | 2097152; + propagateChildFlags(node.asteriskToken) | + 2097152; if (ts.modifiersToFlags(node.modifiers) & 256) { if (node.asteriskToken) { node.transformFlags |= 64; @@ -18988,7 +19040,8 @@ var ts; var node = createBaseNamedDeclaration(256, decorators, modifiers, name); node.members = createNodeArray(members); node.transformFlags |= - propagateChildrenFlags(node.members) | 1; + propagateChildrenFlags(node.members) | + 1; node.transformFlags &= ~16777216; return node; } @@ -19012,7 +19065,8 @@ var ts; else { node.transformFlags |= propagateChildFlags(node.name) | - propagateChildFlags(node.body) | 1; + propagateChildFlags(node.body) | + 1; } node.transformFlags &= ~16777216; return node; @@ -19131,7 +19185,8 @@ var ts; var node = createBaseNode(270); node.name = name; node.transformFlags |= - propagateChildFlags(node.name) | 4; + propagateChildFlags(node.name) | + 4; node.transformFlags &= ~16777216; return node; } @@ -19529,7 +19584,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.openingElement) | propagateChildrenFlags(node.children) | - propagateChildFlags(node.closingElement) | 2; + propagateChildFlags(node.closingElement) | + 2; return node; } function updateJsxElement(node, openingElement, children, closingElement) { @@ -19547,7 +19603,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.tagName) | propagateChildrenFlags(node.typeArguments) | - propagateChildFlags(node.attributes) | 2; + propagateChildFlags(node.attributes) | + 2; if (node.typeArguments) { node.transformFlags |= 1; } @@ -19568,7 +19625,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.tagName) | propagateChildrenFlags(node.typeArguments) | - propagateChildFlags(node.attributes) | 2; + propagateChildFlags(node.attributes) | + 2; if (typeArguments) { node.transformFlags |= 1; } @@ -19585,7 +19643,8 @@ var ts; var node = createBaseNode(277); node.tagName = tagName; node.transformFlags |= - propagateChildFlags(node.tagName) | 2; + propagateChildFlags(node.tagName) | + 2; return node; } function updateJsxClosingElement(node, tagName) { @@ -19601,7 +19660,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.openingFragment) | propagateChildrenFlags(node.children) | - propagateChildFlags(node.closingFragment) | 2; + propagateChildFlags(node.closingFragment) | + 2; return node; } function updateJsxFragment(node, openingFragment, children, closingFragment) { @@ -19640,7 +19700,8 @@ var ts; node.initializer = initializer; node.transformFlags |= propagateChildFlags(node.name) | - propagateChildFlags(node.initializer) | 2; + propagateChildFlags(node.initializer) | + 2; return node; } function updateJsxAttribute(node, name, initializer) { @@ -19653,7 +19714,8 @@ var ts; var node = createBaseNode(282); node.properties = createNodeArray(properties); node.transformFlags |= - propagateChildrenFlags(node.properties) | 2; + propagateChildrenFlags(node.properties) | + 2; return node; } function updateJsxAttributes(node, properties) { @@ -19665,7 +19727,8 @@ var ts; var node = createBaseNode(283); node.expression = expression; node.transformFlags |= - propagateChildFlags(node.expression) | 2; + propagateChildFlags(node.expression) | + 2; return node; } function updateJsxSpreadAttribute(node, expression) { @@ -19679,7 +19742,8 @@ var ts; node.expression = expression; node.transformFlags |= propagateChildFlags(node.dotDotDotToken) | - propagateChildFlags(node.expression) | 2; + propagateChildFlags(node.expression) | + 2; return node; } function updateJsxExpression(node, expression) { @@ -19782,7 +19846,8 @@ var ts; var node = createBaseNamedDeclaration(290, undefined, undefined, name); node.objectAssignmentInitializer = objectAssignmentInitializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(objectAssignmentInitializer); node.transformFlags |= - propagateChildFlags(node.objectAssignmentInitializer) | 512; + propagateChildFlags(node.objectAssignmentInitializer) | + 512; return node; } function finishUpdateShorthandPropertyAssignment(updated, original) { @@ -19808,7 +19873,9 @@ var ts; var node = createBaseNode(291); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 64 | 32768; + propagateChildFlags(node.expression) | + 64 | + 32768; return node; } function updateSpreadAssignment(node, expression) { @@ -19822,7 +19889,8 @@ var ts; node.initializer = initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= propagateChildFlags(node.name) | - propagateChildFlags(node.initializer) | 1; + propagateChildFlags(node.initializer) | + 1; return node; } function updateEnumMember(node, name, initializer) { @@ -19961,7 +20029,8 @@ var ts; node.expression = expression; node.original = original; node.transformFlags |= - propagateChildFlags(node.expression) | 1; + propagateChildFlags(node.expression) | + 1; ts.setTextRange(node, original); return node; } @@ -24140,20 +24209,17 @@ var ts; return inContext(32768); } function parseErrorAtCurrentToken(message, arg0) { - return parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0); + parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0); } function parseErrorAtPosition(start, length, message, arg0) { var lastError = ts.lastOrUndefined(parseDiagnostics); - var result; if (!lastError || start !== lastError.start) { - result = ts.createDetachedDiagnostic(fileName, start, length, message, arg0); - parseDiagnostics.push(result); + parseDiagnostics.push(ts.createDetachedDiagnostic(fileName, start, length, message, arg0)); } parseErrorBeforeNextFinishedNode = true; - return result; } function parseErrorAt(start, end, message, arg0) { - return parseErrorAtPosition(start, end - start, message, arg0); + parseErrorAtPosition(start, end - start, message, arg0); } function parseErrorAtRange(range, message, arg0) { parseErrorAt(range.pos, range.end, message, arg0); @@ -24276,16 +24342,6 @@ var ts; parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind)); return false; } - function parseExpectedMatchingBrackets(openKind, closeKind, openPosition) { - if (token() === closeKind) { - nextToken(); - return; - } - var lastError = parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(closeKind)); - if (lastError) { - ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openPosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, ts.tokenToString(openKind), ts.tokenToString(closeKind))); - } - } function parseOptional(t) { if (token() === t) { nextToken(); @@ -26907,11 +26963,10 @@ var ts; } function parseArrayLiteralExpression() { var pos = getNodePos(); - var openBracketPosition = scanner.getTokenPos(); parseExpected(22); var multiLine = scanner.hasPrecedingLineBreak(); var elements = parseDelimitedList(15, parseArgumentOrArrayLiteralElement); - parseExpectedMatchingBrackets(22, 23, openBracketPosition); + parseExpected(23); return finishNode(factory.createArrayLiteralExpression(elements, multiLine), pos); } function parseObjectLiteralElement() { @@ -26962,7 +27017,12 @@ var ts; parseExpected(18); var multiLine = scanner.hasPrecedingLineBreak(); var properties = parseDelimitedList(12, parseObjectLiteralElement, true); - parseExpectedMatchingBrackets(18, 19, openBracePosition); + if (!parseExpected(19)) { + var lastError = ts.lastOrUndefined(parseDiagnostics); + if (lastError && lastError.code === ts.Diagnostics._0_expected.code) { + ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here)); + } + } return finishNode(factory.createObjectLiteralExpression(properties, multiLine), pos); } function parseFunctionExpression() { @@ -27030,7 +27090,12 @@ var ts; if (parseExpected(18, diagnosticMessage) || ignoreMissingOpenBrace) { var multiLine = scanner.hasPrecedingLineBreak(); var statements = parseList(1, parseStatement); - parseExpectedMatchingBrackets(18, 19, openBracePosition); + if (!parseExpected(19)) { + var lastError = ts.lastOrUndefined(parseDiagnostics); + if (lastError && lastError.code === ts.Diagnostics._0_expected.code) { + ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here)); + } + } var result = withJSDoc(finishNode(factory.createBlock(statements, multiLine), pos), hasJSDoc); if (token() === 62) { parseErrorAtCurrentToken(ts.Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses); @@ -27073,10 +27138,9 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(98); - var openParenPosition = scanner.getTokenPos(); parseExpected(20); var expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20, 21, openParenPosition); + parseExpected(21); var thenStatement = parseStatement(); var elseStatement = parseOptional(90) ? parseStatement() : undefined; return withJSDoc(finishNode(factory.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc); @@ -27087,10 +27151,9 @@ var ts; parseExpected(89); var statement = parseStatement(); parseExpected(114); - var openParenPosition = scanner.getTokenPos(); parseExpected(20); var expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20, 21, openParenPosition); + parseExpected(21); parseOptional(26); return withJSDoc(finishNode(factory.createDoStatement(statement, expression), pos), hasJSDoc); } @@ -27098,10 +27161,9 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(114); - var openParenPosition = scanner.getTokenPos(); parseExpected(20); var expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20, 21, openParenPosition); + parseExpected(21); var statement = parseStatement(); return withJSDoc(finishNode(factory.createWhileStatement(expression, statement), pos), hasJSDoc); } @@ -27168,10 +27230,9 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(115); - var openParenPosition = scanner.getTokenPos(); parseExpected(20); var expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20, 21, openParenPosition); + parseExpected(21); var statement = doInsideOfContext(16777216, parseStatement); return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc); } @@ -28919,7 +28980,8 @@ var ts; hasChildren = true; if (child.kind === 333) { if (childTypeTag) { - var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); + parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); + var lastError = ts.lastOrUndefined(parseDiagnostics); if (lastError) { ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, 0, 0, ts.Diagnostics.The_tag_was_first_specified_here)); } @@ -35157,7 +35219,8 @@ var ts; } var identifier = prop.name; var currentKind = prop.kind === 289 || prop.kind === 290 || prop.kind === 166 - ? 1 : 2; + ? 1 + : 2; var existingKind = seen.get(identifier.escapedText); if (!existingKind) { seen.set(identifier.escapedText, currentKind); @@ -35692,7 +35755,8 @@ var ts; case 337: var propTag = node; var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 308 ? - 4 | 16777216 : 4; + 4 | 16777216 : + 4; return declareSymbolAndAddToSymbolTable(propTag, flags, 0); case 335: case 328: @@ -35727,7 +35791,8 @@ var ts; } else { var flags = ts.exportAssignmentIsAlias(node) - ? 2097152 : 4; + ? 2097152 + : 4; var symbol = declareSymbol(container.symbol.exports, container.symbol, node, flags, 67108863); if (node.isExportEquals) { ts.setValueDeclaration(symbol, node); @@ -35822,7 +35887,8 @@ var ts; return; } var flags = ts.exportAssignmentIsAlias(node) - ? 2097152 : 4 | 1048576 | 512; + ? 2097152 + : 4 | 1048576 | 512; var symbol = declareSymbol(file.symbol.exports, file.symbol, node, flags | 67108864, 0); ts.setValueDeclaration(symbol, node); } @@ -41579,7 +41645,8 @@ var ts; } else { var flags = !(symbol.flags & 2) ? undefined - : isConstVariable(symbol) ? 2 : 1; + : isConstVariable(symbol) ? 2 + : 1; var name = (needsPostExportDefault || !(symbol.flags & 4)) ? localName : getUnusedName(localName, symbol); var textRange = symbol.declarations && ts.find(symbol.declarations, function (d) { return ts.isVariableDeclaration(d); }); if (textRange && ts.isVariableDeclarationList(textRange.parent) && textRange.parent.declarations.length === 1) { @@ -42033,7 +42100,9 @@ var ts; var statement = ts.factory.createVariableStatement(undefined, ts.factory.createVariableDeclarationList([ ts.factory.createVariableDeclaration(varName, undefined, serializeTypeForDeclaration(context, typeToSerialize, symbol, enclosingDeclaration, includePrivateSymbol, bundled)) ], 2)); - addResult(statement, target && target.flags & 4 && target.escapedName === "export=" ? 2 : name === varName ? 1 : 0); + addResult(statement, target && target.flags & 4 && target.escapedName === "export=" ? 2 + : name === varName ? 1 + : 0); } if (isExportAssignmentCompatibleSymbolName) { results.push(ts.factory.createExportAssignment(undefined, undefined, isExportEquals, ts.factory.createIdentifier(varName))); @@ -46817,7 +46886,8 @@ var ts; return getRestTypeElementFlags(node); case 193: return node.questionToken ? 2 : - node.dotDotDotToken ? getRestTypeElementFlags(node) : 1; + node.dotDotDotToken ? getRestTypeElementFlags(node) : + 1; default: return 1; } @@ -49963,7 +50033,8 @@ var ts; } } var related = source.type === target.type ? -1 : - source.type && target.type ? compareTypes(source.type, target.type, reportErrors) : 0; + source.type && target.type ? compareTypes(source.type, target.type, reportErrors) : + 0; if (related === 0 && reportErrors) { errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); } @@ -51725,8 +51796,10 @@ var ts; } var sourceIsJSConstructor = source.symbol && isJSConstructor(source.symbol.valueDeclaration); var targetIsJSConstructor = target.symbol && isJSConstructor(target.symbol.valueDeclaration); - var sourceSignatures = getSignaturesOfType(source, (sourceIsJSConstructor && kind === 1) ? 0 : kind); - var targetSignatures = getSignaturesOfType(target, (targetIsJSConstructor && kind === 1) ? 0 : kind); + var sourceSignatures = getSignaturesOfType(source, (sourceIsJSConstructor && kind === 1) ? + 0 : kind); + var targetSignatures = getSignaturesOfType(target, (targetIsJSConstructor && kind === 1) ? + 0 : kind); if (kind === 1 && sourceSignatures.length && targetSignatures.length) { var sourceIsAbstract = !!(sourceSignatures[0].flags & 4); var targetIsAbstract = !!(targetSignatures[0].flags & 4); @@ -52295,7 +52368,8 @@ var ts; function compareTypePredicatesIdentical(source, target, compareTypes) { return !(source && target && typePredicateKindsMatch(source, target)) ? 0 : source.type === target.type ? -1 : - source.type && target.type ? compareTypes(source.type, target.type) : 0; + source.type && target.type ? compareTypes(source.type, target.type) : + 0; } function literalTypesWithSameBaseType(types) { var commonBaseType; @@ -53545,7 +53619,9 @@ var ts; if (inference && !inference.isFixed && !isFromInferenceBlockedSource(source)) { var inferredType = inferTypeForHomomorphicMappedType(source, target, constraintType); if (inferredType) { - inferWithPriority(inferredType, inference.typeParameter, ts.getObjectFlags(source) & 524288 ? 16 : 8); + inferWithPriority(inferredType, inference.typeParameter, ts.getObjectFlags(source) & 524288 ? + 16 : + 8); } } return true; @@ -58572,7 +58648,8 @@ var ts; } var effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType; var accessFlags = ts.isAssignmentTarget(node) ? - 2 | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 1 : 0) : 0; + 2 | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 1 : 0) : + 0; var indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, undefined, node, accessFlags | 16) || errorType; return checkIndexedAccessIndexType(getFlowTypeOfAccessExpression(node, getNodeLinks(node).resolvedSymbol, indexedAccessType, indexExpression, checkMode), node); } @@ -59325,14 +59402,14 @@ var ts; var i_1 = 0; var _loop_22 = function (c) { var chain_2 = function () { return ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); }; - var diags_3 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0, true, chain_2); - if (diags_3) { - if (diags_3.length <= min_3) { - min_3 = diags_3.length; + var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0, true, chain_2); + if (diags_2) { + if (diags_2.length <= min_3) { + min_3 = diags_2.length; minIndex = i_1; } - max = Math.max(max, diags_3.length); - allDiagnostics.push(diags_3); + max = Math.max(max, diags_2.length); + allDiagnostics.push(diags_2); } else { ts.Debug.fail("No error for 3 or fewer overload signatures"); @@ -59343,13 +59420,13 @@ var ts; var c = candidatesForArgumentError_1[_a]; _loop_22(c); } - var diags_2 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics); - ts.Debug.assert(diags_2.length > 0, "No errors reported for 3 or fewer overload signatures"); - var chain = ts.chainDiagnosticMessages(ts.map(diags_2, function (d) { return typeof d.messageText === "string" ? d : d.messageText; }), ts.Diagnostics.No_overload_matches_this_call); - var related = __spreadArray([], ts.flatMap(diags_2, function (d) { return d.relatedInformation; })); + var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics); + ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures"); + var chain = ts.chainDiagnosticMessages(ts.map(diags_3, function (d) { return typeof d.messageText === "string" ? d : d.messageText; }), ts.Diagnostics.No_overload_matches_this_call); + var related = __spreadArray([], ts.flatMap(diags_3, function (d) { return d.relatedInformation; })); var diag = void 0; - if (ts.every(diags_2, function (d) { return d.start === diags_2[0].start && d.length === diags_2[0].length && d.file === diags_2[0].file; })) { - var _b = diags_2[0], file = _b.file, start = _b.start, length_7 = _b.length; + if (ts.every(diags_3, function (d) { return d.start === diags_3[0].start && d.length === diags_3[0].length && d.file === diags_3[0].file; })) { + var _b = diags_3[0], file = _b.file, start = _b.start, length_7 = _b.length; diag = { file: file, start: start, length: length_7, code: chain.code, category: chain.category, messageText: chain, relatedInformation: related }; } else { @@ -59585,7 +59662,8 @@ var ts; if (ts.isCallChain(node)) { var nonOptionalType = getOptionalExpressionType(funcType, node.expression); callChainFlags = nonOptionalType === funcType ? 0 : - ts.isOutermostOptionalChain(node) ? 16 : 8; + ts.isOutermostOptionalChain(node) ? 16 : + 8; funcType = nonOptionalType; } else { @@ -60242,8 +60320,10 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 - ? 252 : resolvedRequire.flags & 3 - ? 250 : 0; + ? 252 + : resolvedRequire.flags & 3 + ? 250 + : 0; if (targetDeclarationKind !== 0) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); return !!decl && !!(decl.flags & 8388608); @@ -64514,7 +64594,12 @@ var ts; if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) { return false; } - var interestingFlags = 8 | 16 | 256 | 128 | 64 | 32; + var interestingFlags = 8 | + 16 | + 256 | + 128 | + 64 | + 32; return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags); } function checkVariableDeclaration(node) { @@ -65901,9 +65986,9 @@ var ts; ts.forEach(properties, function (p) { seen.set(p.escapedName, p); }); for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { var base = baseTypes_2[_i]; - var properties_4 = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)); - for (var _a = 0, properties_5 = properties_4; _a < properties_5.length; _a++) { - var prop = properties_5[_a]; + var properties_5 = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)); + for (var _a = 0, properties_4 = properties_5; _a < properties_4.length; _a++) { + var prop = properties_4[_a]; var existing = seen.get(prop.escapedName); if (existing && !isPropertyIdenticalTo(existing, prop)) { seen.delete(prop.escapedName); @@ -73754,7 +73839,9 @@ var ts; } function visitPrefixUnaryExpression(node) { if (shouldTransformPrivateElements && ts.isPrivateIdentifierPropertyAccessExpression(node.operand)) { - var operator = node.operator === 45 ? 39 : node.operator === 46 ? 40 : undefined; + var operator = node.operator === 45 ? + 39 : node.operator === 46 ? + 40 : undefined; var info = void 0; if (operator && (info = accessPrivateIdentifier(node.operand.name))) { var receiver = ts.visitNode(node.operand.expression, visitor, ts.isExpression); @@ -73767,7 +73854,9 @@ var ts; } function visitPostfixUnaryExpression(node, valueIsDiscarded) { if (shouldTransformPrivateElements && ts.isPrivateIdentifierPropertyAccessExpression(node.operand)) { - var operator = node.operator === 45 ? 39 : node.operator === 46 ? 40 : undefined; + var operator = node.operator === 45 ? + 39 : node.operator === 46 ? + 40 : undefined; var info = void 0; if (operator && (info = accessPrivateIdentifier(node.operand.name))) { var receiver = ts.visitNode(node.operand.expression, visitor, ts.isExpression); @@ -73895,16 +73984,20 @@ var ts; return ts.visitEachChild(node, visitor, context); } var staticProperties = ts.getProperties(node, false, true); + var pendingPrivateStateAssignment; if (shouldTransformPrivateElements && ts.some(node.members, function (m) { return ts.hasStaticModifier(m) && !!m.name && ts.isPrivateIdentifier(m.name); })) { var temp = factory.createTempVariable(hoistVariableDeclaration, true); getPrivateIdentifierEnvironment().classConstructor = factory.cloneNode(temp); - getPendingExpressions().push(factory.createAssignment(temp, factory.getInternalName(node))); + pendingPrivateStateAssignment = factory.createAssignment(temp, factory.getInternalName(node)); } var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 103); var statements = [ factory.updateClassDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)) ]; + if (pendingPrivateStateAssignment) { + getPendingExpressions().unshift(pendingPrivateStateAssignment); + } if (ts.some(pendingExpressions)) { statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))); } @@ -75139,7 +75232,9 @@ var ts; return ts.visitEachChild(node, expressionResultIsUnused ? visitorWithUnusedExpressionResult : visitor, context); } function visitSourceFile(node) { - var ancestorFacts = enterSubtree(2, ts.isEffectiveStrictModeSourceFile(node, compilerOptions) ? 0 : 1); + var ancestorFacts = enterSubtree(2, ts.isEffectiveStrictModeSourceFile(node, compilerOptions) ? + 0 : + 1); exportedVariableStatement = false; var visited = ts.visitEachChild(node, visitor, context); var statement = ts.concatenate(visited.statements, taggedTemplateStringDeclarations && [ @@ -82525,7 +82620,13 @@ var ts; }); } ts.isInternalDeclaration = isInternalDeclaration; - var declarationEmitNodeBuilderFlags = 1024 | 2048 | 4096 | 8 | 524288 | 4 | 1; + var declarationEmitNodeBuilderFlags = 1024 | + 2048 | + 4096 | + 8 | + 524288 | + 4 | + 1; function transformDeclarations(context) { var throwDiagnostic = function () { return ts.Debug.fail("Diagnostic emitted without context"); }; var getSymbolAccessibilityDiagnostic = throwDiagnostic; @@ -84254,8 +84355,11 @@ var ts; if (configFile.options.emitDeclarationOnly) return undefined; var isJsonFile = ts.fileExtensionIs(inputFileName, ".json"); - var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory), isJsonFile ? ".json" : - configFile.options.jsx === 1 && (ts.fileExtensionIs(inputFileName, ".tsx") || ts.fileExtensionIs(inputFileName, ".jsx")) ? ".jsx" : ".js"); + var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory), isJsonFile ? + ".json" : + configFile.options.jsx === 1 && (ts.fileExtensionIs(inputFileName, ".tsx") || ts.fileExtensionIs(inputFileName, ".jsx")) ? + ".jsx" : + ".js"); return !isJsonFile || ts.comparePaths(inputFileName, outputFileName, ts.Debug.checkDefined(configFile.options.configFilePath), ignoreCase) !== 0 ? outputFileName : undefined; @@ -85694,7 +85798,9 @@ var ts; var pos = getTextPosWithWriteLine(); writeUnparsedNode(unparsed); if (bundleFileInfo) { - updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 295 ? "text" : "internal"); + updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 295 ? + "text" : + "internal"); } } function emitUnparsedSyntheticReference(unparsed) { @@ -94063,7 +94169,8 @@ var ts; return { relativePreference: importModuleSpecifierPreference === "relative" ? 0 : importModuleSpecifierPreference === "non-relative" ? 1 : - importModuleSpecifierPreference === "project-relative" ? 3 : 2, + importModuleSpecifierPreference === "project-relative" ? 3 : + 2, ending: getEnding(), }; function getEnding() { @@ -94071,14 +94178,16 @@ var ts; case "minimal": return 0; case "index": return 1; case "js": return 2; - default: return usesJsExtensionOnImports(importingSourceFile) ? 2 : ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeJs ? 1 : 0; + default: return usesJsExtensionOnImports(importingSourceFile) ? 2 + : ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeJs ? 1 : 0; } } } function getPreferencesForUpdate(compilerOptions, oldImportSpecifier) { return { relativePreference: ts.isExternalModuleNameRelative(oldImportSpecifier) ? 0 : 1, - ending: ts.hasJSFileExtension(oldImportSpecifier) ? 2 : + ending: ts.hasJSFileExtension(oldImportSpecifier) ? + 2 : ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeJs || ts.endsWith(oldImportSpecifier, "index") ? 1 : 0, }; } diff --git a/lib/tsserver.js b/lib/tsserver.js index 6e6e77c2f51c8..9d0fcc773e8c0 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -96,7 +96,7 @@ var ts; // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types - ts.version = "4.3.1-rc"; + ts.version = "4.3.2"; /* @internal */ var Comparison; (function (Comparison) { @@ -1653,7 +1653,8 @@ var ts; return a === b ? 0 /* EqualTo */ : a === undefined ? -1 /* LessThan */ : b === undefined ? 1 /* GreaterThan */ : - a < b ? -1 /* LessThan */ : 1 /* GreaterThan */; + a < b ? -1 /* LessThan */ : + 1 /* GreaterThan */; } /** * Compare two numeric values for their order relative to each other. @@ -7668,7 +7669,8 @@ var ts; if (ts.sys && ts.sys.getEnvironmentVariable) { setCustomPollingValues(ts.sys); ts.Debug.setAssertionLevel(/^development$/i.test(ts.sys.getEnvironmentVariable("NODE_ENV")) - ? 1 /* Normal */ : 0 /* None */); + ? 1 /* Normal */ + : 0 /* None */); } if (ts.sys && ts.sys.debugMode) { ts.Debug.isDebugging = true; @@ -7687,7 +7689,7 @@ var ts; Identifier_expected: diag(1003, ts.DiagnosticCategory.Error, "Identifier_expected_1003", "Identifier expected."), _0_expected: diag(1005, ts.DiagnosticCategory.Error, "_0_expected_1005", "'{0}' expected."), A_file_cannot_have_a_reference_to_itself: diag(1006, ts.DiagnosticCategory.Error, "A_file_cannot_have_a_reference_to_itself_1006", "A file cannot have a reference to itself."), - The_parser_expected_to_find_a_1_to_match_the_0_token_here: diag(1007, ts.DiagnosticCategory.Error, "The_parser_expected_to_find_a_1_to_match_the_0_token_here_1007", "The parser expected to find a '{1}' to match the '{0}' token here."), + The_parser_expected_to_find_a_to_match_the_token_here: diag(1007, ts.DiagnosticCategory.Error, "The_parser_expected_to_find_a_to_match_the_token_here_1007", "The parser expected to find a '}' to match the '{' token here."), Trailing_comma_not_allowed: diag(1009, ts.DiagnosticCategory.Error, "Trailing_comma_not_allowed_1009", "Trailing comma not allowed."), Asterisk_Slash_expected: diag(1010, ts.DiagnosticCategory.Error, "Asterisk_Slash_expected_1010", "'*/' expected."), An_element_access_expression_should_take_an_argument: diag(1011, ts.DiagnosticCategory.Error, "An_element_access_expression_should_take_an_argument_1011", "An element access expression should take an argument."), @@ -13008,7 +13010,7 @@ var ts; case 105 /* SuperKeyword */: case 226 /* NonNullExpression */: case 227 /* MetaProperty */: - case 99 /* ImportKeyword */: + case 99 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression return true; default: return false; @@ -16081,7 +16083,8 @@ var ts; case 217 /* BinaryExpression */: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? - binaryOperator === 62 /* EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* Definite */ : 2 /* Compound */ : 0 /* None */; + binaryOperator === 62 /* EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* Definite */ : 2 /* Compound */ : + 0 /* None */; case 215 /* PrefixUnaryExpression */: case 216 /* PostfixUnaryExpression */: var unaryOperator = parent.operator; @@ -18506,7 +18509,8 @@ var ts; if (getCheckFlags(s) & 6 /* Synthetic */) { var checkFlags = s.checkFlags; var accessModifier = checkFlags & 1024 /* ContainsPrivate */ ? 8 /* Private */ : - checkFlags & 256 /* ContainsPublic */ ? 4 /* Public */ : 16 /* Protected */; + checkFlags & 256 /* ContainsPublic */ ? 4 /* Public */ : + 16 /* Protected */; var staticModifier = checkFlags & 2048 /* ContainsStatic */ ? 32 /* Static */ : 0; return accessModifier | staticModifier; } @@ -19038,7 +19042,8 @@ var ts; } function compareDiagnostics(d1, d2) { return compareDiagnosticsSkipRelatedInformation(d1, d2) || - compareRelatedInformation(d1, d2) || 0 /* EqualTo */; + compareRelatedInformation(d1, d2) || + 0 /* EqualTo */; } ts.compareDiagnostics = compareDiagnostics; function compareDiagnosticsSkipRelatedInformation(d1, d2) { @@ -19046,7 +19051,8 @@ var ts; ts.compareValues(d1.start, d2.start) || ts.compareValues(d1.length, d2.length) || ts.compareValues(d1.code, d2.code) || - compareMessageText(d1.messageText, d2.messageText) || 0 /* EqualTo */; + compareMessageText(d1.messageText, d2.messageText) || + 0 /* EqualTo */; } ts.compareDiagnosticsSkipRelatedInformation = compareDiagnosticsSkipRelatedInformation; function compareRelatedInformation(d1, d2) { @@ -19898,15 +19904,15 @@ var ts; var log2Base; switch (stringValue.charCodeAt(1)) { // "x" in "0x123" case 98 /* b */: - case 66 /* B */: + case 66 /* B */: // 0b or 0B log2Base = 1; break; case 111 /* o */: - case 79 /* O */: + case 79 /* O */: // 0o or 0O log2Base = 3; break; case 120 /* x */: - case 88 /* X */: + case 88 /* X */: // 0x or 0X log2Base = 4; break; default: // already in decimal; omit trailing "n" @@ -21573,7 +21579,8 @@ var ts; case 129 /* AsyncKeyword */: // 'async' modifier is ES2017 (async functions) or ES2018 (async generators) transformFlags = - 128 /* ContainsES2017 */ | 64 /* ContainsES2018 */; + 128 /* ContainsES2017 */ | + 64 /* ContainsES2018 */; break; case 122 /* PublicKeyword */: case 120 /* PrivateKeyword */: @@ -21593,7 +21600,7 @@ var ts; case 148 /* SymbolKeyword */: case 113 /* VoidKeyword */: case 152 /* UnknownKeyword */: - case 150 /* UndefinedKeyword */: + case 150 /* UndefinedKeyword */: // `undefined` is an Identifier in the expression case. transformFlags = 1 /* ContainsTypeScript */; break; case 123 /* StaticKeyword */: @@ -21706,7 +21713,9 @@ var ts; var node = createBaseNode(159 /* ComputedPropertyName */); node.expression = parenthesizerRules().parenthesizeExpressionOfComputedPropertyName(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 512 /* ContainsES2015 */ | 65536 /* ContainsComputedPropertyName */; + propagateChildFlags(node.expression) | + 512 /* ContainsES2015 */ | + 65536 /* ContainsComputedPropertyName */; return node; } // @api @@ -21774,7 +21783,9 @@ var ts; var node = createBaseNode(162 /* Decorator */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */ | 4096 /* ContainsTypeScriptClassSyntax */; + propagateChildFlags(node.expression) | + 1 /* ContainsTypeScript */ | + 4096 /* ContainsTypeScriptClassSyntax */; return node; } // @api @@ -21811,7 +21822,8 @@ var ts; node.exclamationToken = questionOrExclamationToken && ts.isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.transformFlags |= propagateChildFlags(node.questionToken) | - propagateChildFlags(node.exclamationToken) | 8388608 /* ContainsClassFields */; + propagateChildFlags(node.exclamationToken) | + 8388608 /* ContainsClassFields */; if (ts.isComputedPropertyName(node.name) || (ts.hasStaticModifier(node) && node.initializer)) { node.transformFlags |= 4096 /* ContainsTypeScriptClassSyntax */; } @@ -21858,7 +21870,8 @@ var ts; node.questionToken = questionToken; node.transformFlags |= propagateChildFlags(node.asteriskToken) | - propagateChildFlags(node.questionToken) | 512 /* ContainsES2015 */; + propagateChildFlags(node.questionToken) | + 512 /* ContainsES2015 */; if (questionToken) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -22386,10 +22399,13 @@ var ts; var node = createBaseNode(197 /* ObjectBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= - propagateChildrenFlags(node.elements) | 512 /* ContainsES2015 */ | 262144 /* ContainsBindingPattern */; + propagateChildrenFlags(node.elements) | + 512 /* ContainsES2015 */ | + 262144 /* ContainsBindingPattern */; if (node.transformFlags & 16384 /* ContainsRestOrSpread */) { node.transformFlags |= - 64 /* ContainsES2018 */ | 32768 /* ContainsObjectRestOrSpread */; + 64 /* ContainsES2018 */ | + 32768 /* ContainsObjectRestOrSpread */; } return node; } @@ -22404,7 +22420,9 @@ var ts; var node = createBaseNode(198 /* ArrayBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= - propagateChildrenFlags(node.elements) | 512 /* ContainsES2015 */ | 262144 /* ContainsBindingPattern */; + propagateChildrenFlags(node.elements) | + 512 /* ContainsES2015 */ | + 262144 /* ContainsBindingPattern */; return node; } // @api @@ -22421,7 +22439,8 @@ var ts; node.propertyName = asName(propertyName); node.dotDotDotToken = dotDotDotToken; node.transformFlags |= - propagateChildFlags(node.dotDotDotToken) | 512 /* ContainsES2015 */; + propagateChildFlags(node.dotDotDotToken) | + 512 /* ContainsES2015 */; if (node.propertyName) { node.transformFlags |= ts.isIdentifier(node.propertyName) ? propagateIdentifierNameFlags(node.propertyName) : @@ -22490,7 +22509,8 @@ var ts; // super method calls require a lexical 'this' // super method calls require 'super' hoisting in ES2017 and ES2018 async functions and async generators node.transformFlags |= - 128 /* ContainsES2017 */ | 64 /* ContainsES2018 */; + 128 /* ContainsES2017 */ | + 64 /* ContainsES2018 */; } return node; } @@ -22543,7 +22563,8 @@ var ts; // super method calls require a lexical 'this' // super method calls require 'super' hoisting in ES2017 and ES2018 async functions and async generators node.transformFlags |= - 128 /* ContainsES2017 */ | 64 /* ContainsES2018 */; + 128 /* ContainsES2017 */ | + 64 /* ContainsES2018 */; } return node; } @@ -22567,7 +22588,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.questionDotToken) | - propagateChildFlags(node.argumentExpression) | 16 /* ContainsES2020 */; + propagateChildFlags(node.argumentExpression) | + 16 /* ContainsES2020 */; return node; } // @api @@ -22625,7 +22647,8 @@ var ts; propagateChildFlags(node.expression) | propagateChildFlags(node.questionDotToken) | propagateChildrenFlags(node.typeArguments) | - propagateChildrenFlags(node.arguments) | 16 /* ContainsES2020 */; + propagateChildrenFlags(node.arguments) | + 16 /* ContainsES2020 */; if (node.typeArguments) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -22653,7 +22676,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.expression) | propagateChildrenFlags(node.typeArguments) | - propagateChildrenFlags(node.arguments) | 16 /* ContainsES2020 */; + propagateChildrenFlags(node.arguments) | + 16 /* ContainsES2020 */; if (node.typeArguments) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -22676,7 +22700,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.tag) | propagateChildrenFlags(node.typeArguments) | - propagateChildFlags(node.template) | 512 /* ContainsES2015 */; + propagateChildFlags(node.template) | + 512 /* ContainsES2015 */; if (node.typeArguments) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -22700,7 +22725,8 @@ var ts; node.type = type; node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildFlags(node.type) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.type) | + 1 /* ContainsTypeScript */; return node; } // @api @@ -22764,7 +22790,8 @@ var ts; /*name*/ undefined, typeParameters, parameters, type, parenthesizerRules().parenthesizeConciseBodyOfArrowFunction(body)); node.equalsGreaterThanToken = equalsGreaterThanToken !== null && equalsGreaterThanToken !== void 0 ? equalsGreaterThanToken : createToken(38 /* EqualsGreaterThanToken */); node.transformFlags |= - propagateChildFlags(node.equalsGreaterThanToken) | 512 /* ContainsES2015 */; + propagateChildFlags(node.equalsGreaterThanToken) | + 512 /* ContainsES2015 */; if (ts.modifiersToFlags(node.modifiers) & 256 /* Async */) { node.transformFlags |= 128 /* ContainsES2017 */; } @@ -22825,7 +22852,10 @@ var ts; var node = createBaseExpression(214 /* AwaitExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 128 /* ContainsES2017 */ | 64 /* ContainsES2018 */ | 1048576 /* ContainsAwait */; + propagateChildFlags(node.expression) | + 128 /* ContainsES2017 */ | + 64 /* ContainsES2018 */ | + 1048576 /* ContainsAwait */; return node; } // @api @@ -22880,12 +22910,15 @@ var ts; else if (operatorKind === 62 /* EqualsToken */) { if (ts.isObjectLiteralExpression(node.left)) { node.transformFlags |= - 512 /* ContainsES2015 */ | 64 /* ContainsES2018 */ | 2048 /* ContainsDestructuringAssignment */ | + 512 /* ContainsES2015 */ | + 64 /* ContainsES2018 */ | + 2048 /* ContainsDestructuringAssignment */ | propagateAssignmentPatternFlags(node.left); } else if (ts.isArrayLiteralExpression(node.left)) { node.transformFlags |= - 512 /* ContainsES2015 */ | 2048 /* ContainsDestructuringAssignment */ | + 512 /* ContainsES2015 */ | + 2048 /* ContainsDestructuringAssignment */ | propagateAssignmentPatternFlags(node.left); } } @@ -22961,7 +22994,8 @@ var ts; node.templateSpans = createNodeArray(templateSpans); node.transformFlags |= propagateChildFlags(node.head) | - propagateChildrenFlags(node.templateSpans) | 512 /* ContainsES2015 */; + propagateChildrenFlags(node.templateSpans) | + 512 /* ContainsES2015 */; return node; } // @api @@ -23030,7 +23064,10 @@ var ts; node.asteriskToken = asteriskToken; node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildFlags(node.asteriskToken) | 512 /* ContainsES2015 */ | 64 /* ContainsES2018 */ | 524288 /* ContainsYield */; + propagateChildFlags(node.asteriskToken) | + 512 /* ContainsES2015 */ | + 64 /* ContainsES2018 */ | + 524288 /* ContainsYield */; return node; } // @api @@ -23045,7 +23082,9 @@ var ts; var node = createBaseExpression(221 /* SpreadElement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 512 /* ContainsES2015 */ | 16384 /* ContainsRestOrSpread */; + propagateChildFlags(node.expression) | + 512 /* ContainsES2015 */ | + 16384 /* ContainsRestOrSpread */; return node; } // @api @@ -23082,7 +23121,8 @@ var ts; node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildrenFlags(node.typeArguments) | 512 /* ContainsES2015 */; + propagateChildrenFlags(node.typeArguments) | + 512 /* ContainsES2015 */; return node; } // @api @@ -23099,7 +23139,8 @@ var ts; node.type = type; node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildFlags(node.type) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.type) | + 1 /* ContainsTypeScript */; return node; } // @api @@ -23114,7 +23155,8 @@ var ts; var node = createBaseExpression(226 /* NonNullExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.expression) | + 1 /* ContainsTypeScript */; return node; } // @api @@ -23132,7 +23174,8 @@ var ts; node.flags |= 32 /* OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.expression) | + 1 /* ContainsTypeScript */; return node; } // @api @@ -23176,7 +23219,8 @@ var ts; node.literal = literal; node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildFlags(node.literal) | 512 /* ContainsES2015 */; + propagateChildFlags(node.literal) | + 512 /* ContainsES2015 */; return node; } // @api @@ -23352,7 +23396,8 @@ var ts; propagateChildFlags(node.awaitModifier) | propagateChildFlags(node.initializer) | propagateChildFlags(node.expression) | - propagateChildFlags(node.statement) | 512 /* ContainsES2015 */; + propagateChildFlags(node.statement) | + 512 /* ContainsES2015 */; if (awaitModifier) node.transformFlags |= 64 /* ContainsES2018 */; return node; @@ -23371,7 +23416,8 @@ var ts; var node = createBaseNode(241 /* ContinueStatement */); node.label = asName(label); node.transformFlags |= - propagateChildFlags(node.label) | 2097152 /* ContainsHoistedDeclarationOrCompletion */; + propagateChildFlags(node.label) | + 2097152 /* ContainsHoistedDeclarationOrCompletion */; return node; } // @api @@ -23385,7 +23431,8 @@ var ts; var node = createBaseNode(242 /* BreakStatement */); node.label = asName(label); node.transformFlags |= - propagateChildFlags(node.label) | 2097152 /* ContainsHoistedDeclarationOrCompletion */; + propagateChildFlags(node.label) | + 2097152 /* ContainsHoistedDeclarationOrCompletion */; return node; } // @api @@ -23400,7 +23447,9 @@ var ts; node.expression = expression; // return in an ES2018 async generator must be awaited node.transformFlags |= - propagateChildFlags(node.expression) | 64 /* ContainsES2018 */ | 2097152 /* ContainsHoistedDeclarationOrCompletion */; + propagateChildFlags(node.expression) | + 64 /* ContainsES2018 */ | + 2097152 /* ContainsHoistedDeclarationOrCompletion */; return node; } // @api @@ -23525,10 +23574,12 @@ var ts; node.flags |= flags & 3 /* BlockScoped */; node.declarations = createNodeArray(declarations); node.transformFlags |= - propagateChildrenFlags(node.declarations) | 2097152 /* ContainsHoistedDeclarationOrCompletion */; + propagateChildrenFlags(node.declarations) | + 2097152 /* ContainsHoistedDeclarationOrCompletion */; if (flags & 3 /* BlockScoped */) { node.transformFlags |= - 512 /* ContainsES2015 */ | 131072 /* ContainsBlockScopedBinding */; + 512 /* ContainsES2015 */ | + 131072 /* ContainsBlockScopedBinding */; } return node; } @@ -23547,7 +23598,8 @@ var ts; } else { node.transformFlags |= - propagateChildFlags(node.asteriskToken) | 2097152 /* ContainsHoistedDeclarationOrCompletion */; + propagateChildFlags(node.asteriskToken) | + 2097152 /* ContainsHoistedDeclarationOrCompletion */; if (ts.modifiersToFlags(node.modifiers) & 256 /* Async */) { if (node.asteriskToken) { node.transformFlags |= 64 /* ContainsES2018 */; @@ -23640,7 +23692,8 @@ var ts; var node = createBaseNamedDeclaration(256 /* EnumDeclaration */, decorators, modifiers, name); node.members = createNodeArray(members); node.transformFlags |= - propagateChildrenFlags(node.members) | 1 /* ContainsTypeScript */; + propagateChildrenFlags(node.members) | + 1 /* ContainsTypeScript */; node.transformFlags &= ~16777216 /* ContainsPossibleTopLevelAwait */; // Enum declarations cannot contain `await` return node; } @@ -23666,7 +23719,8 @@ var ts; else { node.transformFlags |= propagateChildFlags(node.name) | - propagateChildFlags(node.body) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.body) | + 1 /* ContainsTypeScript */; } node.transformFlags &= ~16777216 /* ContainsPossibleTopLevelAwait */; // Module declarations cannot contain `await`. return node; @@ -23803,7 +23857,8 @@ var ts; var node = createBaseNode(270 /* NamespaceExport */); node.name = name; node.transformFlags |= - propagateChildFlags(node.name) | 4 /* ContainsESNext */; + propagateChildFlags(node.name) | + 4 /* ContainsESNext */; node.transformFlags &= ~16777216 /* ContainsPossibleTopLevelAwait */; // always parsed in an Await context return node; } @@ -24309,7 +24364,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.openingElement) | propagateChildrenFlags(node.children) | - propagateChildFlags(node.closingElement) | 2 /* ContainsJsx */; + propagateChildFlags(node.closingElement) | + 2 /* ContainsJsx */; return node; } // @api @@ -24329,7 +24385,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.tagName) | propagateChildrenFlags(node.typeArguments) | - propagateChildFlags(node.attributes) | 2 /* ContainsJsx */; + propagateChildFlags(node.attributes) | + 2 /* ContainsJsx */; if (node.typeArguments) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -24352,7 +24409,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.tagName) | propagateChildrenFlags(node.typeArguments) | - propagateChildFlags(node.attributes) | 2 /* ContainsJsx */; + propagateChildFlags(node.attributes) | + 2 /* ContainsJsx */; if (typeArguments) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -24371,7 +24429,8 @@ var ts; var node = createBaseNode(277 /* JsxClosingElement */); node.tagName = tagName; node.transformFlags |= - propagateChildFlags(node.tagName) | 2 /* ContainsJsx */; + propagateChildFlags(node.tagName) | + 2 /* ContainsJsx */; return node; } // @api @@ -24389,7 +24448,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.openingFragment) | propagateChildrenFlags(node.children) | - propagateChildFlags(node.closingFragment) | 2 /* ContainsJsx */; + propagateChildFlags(node.closingFragment) | + 2 /* ContainsJsx */; return node; } // @api @@ -24434,7 +24494,8 @@ var ts; node.initializer = initializer; node.transformFlags |= propagateChildFlags(node.name) | - propagateChildFlags(node.initializer) | 2 /* ContainsJsx */; + propagateChildFlags(node.initializer) | + 2 /* ContainsJsx */; return node; } // @api @@ -24449,7 +24510,8 @@ var ts; var node = createBaseNode(282 /* JsxAttributes */); node.properties = createNodeArray(properties); node.transformFlags |= - propagateChildrenFlags(node.properties) | 2 /* ContainsJsx */; + propagateChildrenFlags(node.properties) | + 2 /* ContainsJsx */; return node; } // @api @@ -24463,7 +24525,8 @@ var ts; var node = createBaseNode(283 /* JsxSpreadAttribute */); node.expression = expression; node.transformFlags |= - propagateChildFlags(node.expression) | 2 /* ContainsJsx */; + propagateChildFlags(node.expression) | + 2 /* ContainsJsx */; return node; } // @api @@ -24479,7 +24542,8 @@ var ts; node.expression = expression; node.transformFlags |= propagateChildFlags(node.dotDotDotToken) | - propagateChildFlags(node.expression) | 2 /* ContainsJsx */; + propagateChildFlags(node.expression) | + 2 /* ContainsJsx */; return node; } // @api @@ -24608,7 +24672,8 @@ var ts; /*modifiers*/ undefined, name); node.objectAssignmentInitializer = objectAssignmentInitializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(objectAssignmentInitializer); node.transformFlags |= - propagateChildFlags(node.objectAssignmentInitializer) | 512 /* ContainsES2015 */; + propagateChildFlags(node.objectAssignmentInitializer) | + 512 /* ContainsES2015 */; return node; } function finishUpdateShorthandPropertyAssignment(updated, original) { @@ -24637,7 +24702,9 @@ var ts; var node = createBaseNode(291 /* SpreadAssignment */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 64 /* ContainsES2018 */ | 32768 /* ContainsObjectRestOrSpread */; + propagateChildFlags(node.expression) | + 64 /* ContainsES2018 */ | + 32768 /* ContainsObjectRestOrSpread */; return node; } // @api @@ -24656,7 +24723,8 @@ var ts; node.initializer = initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= propagateChildFlags(node.name) | - propagateChildFlags(node.initializer) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.initializer) | + 1 /* ContainsTypeScript */; return node; } // @api @@ -24832,7 +24900,8 @@ var ts; node.expression = expression; node.original = original; node.transformFlags |= - propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.expression) | + 1 /* ContainsTypeScript */; ts.setTextRange(node, original); return node; } @@ -29961,23 +30030,20 @@ var ts; return inContext(32768 /* AwaitContext */); } function parseErrorAtCurrentToken(message, arg0) { - return parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0); + parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0); } function parseErrorAtPosition(start, length, message, arg0) { // Don't report another error if it would just be at the same position as the last error. var lastError = ts.lastOrUndefined(parseDiagnostics); - var result; if (!lastError || start !== lastError.start) { - result = ts.createDetachedDiagnostic(fileName, start, length, message, arg0); - parseDiagnostics.push(result); + parseDiagnostics.push(ts.createDetachedDiagnostic(fileName, start, length, message, arg0)); } // Mark that we've encountered an error. We'll set an appropriate bit on the next // node we finish so that it can't be reused incrementally. parseErrorBeforeNextFinishedNode = true; - return result; } function parseErrorAt(start, end, message, arg0) { - return parseErrorAtPosition(start, end - start, message, arg0); + parseErrorAtPosition(start, end - start, message, arg0); } function parseErrorAtRange(range, message, arg0) { parseErrorAt(range.pos, range.end, message, arg0); @@ -30134,16 +30200,6 @@ var ts; parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind)); return false; } - function parseExpectedMatchingBrackets(openKind, closeKind, openPosition) { - if (token() === closeKind) { - nextToken(); - return; - } - var lastError = parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(closeKind)); - if (lastError) { - ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openPosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, ts.tokenToString(openKind), ts.tokenToString(closeKind))); - } - } function parseOptional(t) { if (token() === t) { nextToken(); @@ -30432,7 +30488,7 @@ var ts; case 22 /* OpenBracketToken */: case 41 /* AsteriskToken */: case 25 /* DotDotDotToken */: - case 24 /* DotToken */: + case 24 /* DotToken */: // Not an object literal member, but don't want to close the object (see `tests/cases/fourslash/completionsDotInObjectLiteral.ts`) return true; default: return isLiteralPropertyName(); @@ -30465,7 +30521,7 @@ var ts; case 15 /* ArrayLiteralMembers */: switch (token()) { case 27 /* CommaToken */: - case 24 /* DotToken */: + case 24 /* DotToken */: // Not an array literal member, but don't want to close the array (see `tests/cases/fourslash/completionsDotInArrayLiteralInObjectLiteral.ts`) return true; } // falls through @@ -33427,7 +33483,7 @@ var ts; case 50 /* AmpersandToken */: // foo & case 51 /* BarToken */: // foo | case 19 /* CloseBraceToken */: // foo } - case 1 /* EndOfFileToken */: + case 1 /* EndOfFileToken */: // foo // these cases can't legally follow a type arg list. However, they're not legal // expressions either. The user is probably in the middle of a generic type. So // treat it as such. @@ -33511,11 +33567,10 @@ var ts; } function parseArrayLiteralExpression() { var pos = getNodePos(); - var openBracketPosition = scanner.getTokenPos(); parseExpected(22 /* OpenBracketToken */); var multiLine = scanner.hasPrecedingLineBreak(); var elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement); - parseExpectedMatchingBrackets(22 /* OpenBracketToken */, 23 /* CloseBracketToken */, openBracketPosition); + parseExpected(23 /* CloseBracketToken */); return finishNode(factory.createArrayLiteralExpression(elements, multiLine), pos); } function parseObjectLiteralElement() { @@ -33575,7 +33630,12 @@ var ts; parseExpected(18 /* OpenBraceToken */); var multiLine = scanner.hasPrecedingLineBreak(); var properties = parseDelimitedList(12 /* ObjectLiteralMembers */, parseObjectLiteralElement, /*considerSemicolonAsDelimiter*/ true); - parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBracePosition); + if (!parseExpected(19 /* CloseBraceToken */)) { + var lastError = ts.lastOrUndefined(parseDiagnostics); + if (lastError && lastError.code === ts.Diagnostics._0_expected.code) { + ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here)); + } + } return finishNode(factory.createObjectLiteralExpression(properties, multiLine), pos); } function parseFunctionExpression() { @@ -33649,7 +33709,12 @@ var ts; if (parseExpected(18 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { var multiLine = scanner.hasPrecedingLineBreak(); var statements = parseList(1 /* BlockStatements */, parseStatement); - parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBracePosition); + if (!parseExpected(19 /* CloseBraceToken */)) { + var lastError = ts.lastOrUndefined(parseDiagnostics); + if (lastError && lastError.code === ts.Diagnostics._0_expected.code) { + ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here)); + } + } var result = withJSDoc(finishNode(factory.createBlock(statements, multiLine), pos), hasJSDoc); if (token() === 62 /* EqualsToken */) { parseErrorAtCurrentToken(ts.Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses); @@ -33694,10 +33759,9 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(98 /* IfKeyword */); - var openParenPosition = scanner.getTokenPos(); parseExpected(20 /* OpenParenToken */); var expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition); + parseExpected(21 /* CloseParenToken */); var thenStatement = parseStatement(); var elseStatement = parseOptional(90 /* ElseKeyword */) ? parseStatement() : undefined; return withJSDoc(finishNode(factory.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc); @@ -33708,10 +33772,9 @@ var ts; parseExpected(89 /* DoKeyword */); var statement = parseStatement(); parseExpected(114 /* WhileKeyword */); - var openParenPosition = scanner.getTokenPos(); parseExpected(20 /* OpenParenToken */); var expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition); + parseExpected(21 /* CloseParenToken */); // From: https://mail.mozilla.org/pipermail/es-discuss/2011-August/016188.html // 157 min --- All allen at wirfs-brock.com CONF --- "do{;}while(false)false" prohibited in // spec but allowed in consensus reality. Approved -- this is the de-facto standard whereby @@ -33723,10 +33786,9 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(114 /* WhileKeyword */); - var openParenPosition = scanner.getTokenPos(); parseExpected(20 /* OpenParenToken */); var expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition); + parseExpected(21 /* CloseParenToken */); var statement = parseStatement(); return withJSDoc(finishNode(factory.createWhileStatement(expression, statement), pos), hasJSDoc); } @@ -33793,10 +33855,9 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(115 /* WithKeyword */); - var openParenPosition = scanner.getTokenPos(); parseExpected(20 /* OpenParenToken */); var expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition); + parseExpected(21 /* CloseParenToken */); var statement = doInsideOfContext(16777216 /* InWithStatement */, parseStatement); return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc); } @@ -34499,7 +34560,7 @@ var ts; case 53 /* ExclamationToken */: // Non-null assertion on property name case 58 /* ColonToken */: // Type Annotation for declaration case 62 /* EqualsToken */: // Initializer for declaration - case 57 /* QuestionToken */: + case 57 /* QuestionToken */: // Not valid, but permitted so that it gets caught later on. return true; default: // Covers @@ -35787,7 +35848,8 @@ var ts; hasChildren = true; if (child.kind === 333 /* JSDocTypeTag */) { if (childTypeTag) { - var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); + parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); + var lastError = ts.lastOrUndefined(parseDiagnostics); if (lastError) { ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, 0, 0, ts.Diagnostics.The_tag_was_first_specified_here)); } @@ -43039,7 +43101,8 @@ var ts; // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = prop.kind === 289 /* PropertyAssignment */ || prop.kind === 290 /* ShorthandPropertyAssignment */ || prop.kind === 166 /* MethodDeclaration */ - ? 1 /* Property */ : 2 /* Accessor */; + ? 1 /* Property */ + : 2 /* Accessor */; var existingKind = seen.get(identifier.escapedText); if (!existingKind) { seen.set(identifier.escapedText, currentKind); @@ -43560,7 +43623,7 @@ var ts; case 252 /* FunctionDeclaration */: return bindFunctionDeclaration(node); case 167 /* Constructor */: - return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, 0 /* None */); + return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); case 168 /* GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 46015 /* GetAccessorExcludes */); case 169 /* SetAccessor */: @@ -43653,7 +43716,8 @@ var ts; case 337 /* JSDocPropertyTag */: var propTag = node; var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 308 /* JSDocOptionalType */ ? - 4 /* Property */ | 16777216 /* Optional */ : 4 /* Property */; + 4 /* Property */ | 16777216 /* Optional */ : + 4 /* Property */; return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* PropertyExcludes */); case 335 /* JSDocTypedefTag */: case 328 /* JSDocCallbackTag */: @@ -43691,9 +43755,9 @@ var ts; else { var flags = ts.exportAssignmentIsAlias(node) // An export default clause with an EntityNameExpression or a class expression exports all meanings of that identifier or expression; - ? 2097152 /* Alias */ - // An export default clause with any other expression exports a value - : 4 /* Property */; + ? 2097152 /* Alias */ + // An export default clause with any other expression exports a value + : 4 /* Property */; // If there is an `export default x;` alias declaration, can't `export default` anything else. // (In contrast, you can still have `export default function f() {}` and `export default interface I {}`.) var symbol = declareSymbol(container.symbol.exports, container.symbol, node, flags, 67108863 /* All */); @@ -43802,7 +43866,8 @@ var ts; } // 'module.exports = expr' assignment var flags = ts.exportAssignmentIsAlias(node) - ? 2097152 /* Alias */ : 4 /* Property */ | 1048576 /* ExportValue */ | 512 /* ValueModule */; + ? 2097152 /* Alias */ + : 4 /* Property */ | 1048576 /* ExportValue */ | 512 /* ValueModule */; var symbol = declareSymbol(file.symbol.exports, file.symbol, node, flags | 67108864 /* Assignment */, 0 /* None */); ts.setValueDeclaration(symbol, node); } @@ -46587,7 +46652,7 @@ var ts; case 254 /* InterfaceDeclaration */: case 256 /* EnumDeclaration */: case 255 /* TypeAliasDeclaration */: - case 257 /* ModuleDeclaration */: + case 257 /* ModuleDeclaration */: // For `namespace N { N; }` return true; default: return false; @@ -50512,7 +50577,8 @@ var ts; // A Class + Property merge is made for a `module.exports.Member = class {}`, and it doesn't serialize well as either a class _or_ a property symbol - in fact, _it behaves like an alias!_ // `var` is `FunctionScopedVariable`, `const` and `let` are `BlockScopedVariable`, and `module.exports.thing =` is `Property` var flags = !(symbol.flags & 2 /* BlockScopedVariable */) ? undefined - : isConstVariable(symbol) ? 2 /* Const */ : 1 /* Let */; + : isConstVariable(symbol) ? 2 /* Const */ + : 1 /* Let */; var name = (needsPostExportDefault || !(symbol.flags & 4 /* Property */)) ? localName : getUnusedName(localName, symbol); var textRange = symbol.declarations && ts.find(symbol.declarations, function (d) { return ts.isVariableDeclaration(d); }); if (textRange && ts.isVariableDeclarationList(textRange.parent) && textRange.parent.declarations.length === 1) { @@ -51152,7 +51218,9 @@ var ts; ], 2 /* Const */)); // Inlined JSON types exported with [module.]exports= will already emit an export=, so should use `declare`. // Otherwise, the type itself should be exported. - addResult(statement, target && target.flags & 4 /* Property */ && target.escapedName === "export=" /* ExportEquals */ ? 2 /* Ambient */ : name === varName ? 1 /* Export */ : 0 /* None */); + addResult(statement, target && target.flags & 4 /* Property */ && target.escapedName === "export=" /* ExportEquals */ ? 2 /* Ambient */ + : name === varName ? 1 /* Export */ + : 0 /* None */); } if (isExportAssignmentCompatibleSymbolName) { results.push(ts.factory.createExportAssignment( @@ -56614,7 +56682,8 @@ var ts; return getRestTypeElementFlags(node); case 193 /* NamedTupleMember */: return node.questionToken ? 2 /* Optional */ : - node.dotDotDotToken ? getRestTypeElementFlags(node) : 1 /* Required */; + node.dotDotDotToken ? getRestTypeElementFlags(node) : + 1 /* Required */; default: return 1 /* Required */; } @@ -57191,7 +57260,7 @@ var ts; } function createUnionType(types, aliasSymbol, aliasTypeArguments, origin) { var result = createType(1048576 /* Union */); - result.objectFlags = getPropagatingFlagsOfTypes(types, 98304 /* Nullable */); + result.objectFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 98304 /* Nullable */); result.types = types; result.origin = origin; result.aliasSymbol = aliasSymbol; @@ -57379,7 +57448,7 @@ var ts; } function createIntersectionType(types, aliasSymbol, aliasTypeArguments) { var result = createType(2097152 /* Intersection */); - result.objectFlags = getPropagatingFlagsOfTypes(types, 98304 /* Nullable */); + result.objectFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 98304 /* Nullable */); result.types = types; result.aliasSymbol = aliasSymbol; result.aliasTypeArguments = aliasTypeArguments; @@ -59402,7 +59471,7 @@ var ts; case 209 /* FunctionExpression */: case 210 /* ArrowFunction */: case 166 /* MethodDeclaration */: - case 252 /* FunctionDeclaration */: + case 252 /* FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type return isContextSensitiveFunctionLikeDeclaration(node); case 201 /* ObjectLiteralExpression */: return ts.some(node.properties, isContextSensitive); @@ -60126,7 +60195,8 @@ var ts; } } var related = source.type === target.type ? -1 /* True */ : - source.type && target.type ? compareTypes(source.type, target.type, reportErrors) : 0 /* False */; + source.type && target.type ? compareTypes(source.type, target.type, reportErrors) : + 0 /* False */; if (related === 0 /* False */ && reportErrors) { errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); } @@ -62199,8 +62269,10 @@ var ts; } var sourceIsJSConstructor = source.symbol && isJSConstructor(source.symbol.valueDeclaration); var targetIsJSConstructor = target.symbol && isJSConstructor(target.symbol.valueDeclaration); - var sourceSignatures = getSignaturesOfType(source, (sourceIsJSConstructor && kind === 1 /* Construct */) ? 0 /* Call */ : kind); - var targetSignatures = getSignaturesOfType(target, (targetIsJSConstructor && kind === 1 /* Construct */) ? 0 /* Call */ : kind); + var sourceSignatures = getSignaturesOfType(source, (sourceIsJSConstructor && kind === 1 /* Construct */) ? + 0 /* Call */ : kind); + var targetSignatures = getSignaturesOfType(target, (targetIsJSConstructor && kind === 1 /* Construct */) ? + 0 /* Call */ : kind); if (kind === 1 /* Construct */ && sourceSignatures.length && targetSignatures.length) { var sourceIsAbstract = !!(sourceSignatures[0].flags & 4 /* Abstract */); var targetIsAbstract = !!(targetSignatures[0].flags & 4 /* Abstract */); @@ -62882,7 +62954,8 @@ var ts; function compareTypePredicatesIdentical(source, target, compareTypes) { return !(source && target && typePredicateKindsMatch(source, target)) ? 0 /* False */ : source.type === target.type ? -1 /* True */ : - source.type && target.type ? compareTypes(source.type, target.type) : 0 /* False */; + source.type && target.type ? compareTypes(source.type, target.type) : + 0 /* False */; } function literalTypesWithSameBaseType(types) { var commonBaseType; @@ -64321,7 +64394,9 @@ var ts; // We assign a lower priority to inferences made from types containing non-inferrable // types because we may only have a partial result (i.e. we may have failed to make // reverse inferences for some properties). - inferWithPriority(inferredType, inference.typeParameter, ts.getObjectFlags(source) & 524288 /* NonInferrableType */ ? 16 /* PartialHomomorphicMappedType */ : 8 /* HomomorphicMappedType */); + inferWithPriority(inferredType, inference.typeParameter, ts.getObjectFlags(source) & 524288 /* NonInferrableType */ ? + 16 /* PartialHomomorphicMappedType */ : + 8 /* HomomorphicMappedType */); } } return true; @@ -66768,7 +66843,7 @@ var ts; return !!ts.findAncestor(location, function (e) { return e.parent && ts.isExportAssignment(e.parent) && e.parent.expression === e && ts.isEntityNameExpression(e); }); } function markAliasReferenced(symbol, location) { - if (isNonLocalAlias(symbol, 111551 /* Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) { + if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) { var target = resolveAlias(symbol); if (target.flags & 111551 /* Value */) { // An alias resolving to a const enum cannot be elided if (1) 'isolatedModules' is enabled @@ -70171,7 +70246,8 @@ var ts; } var effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType; var accessFlags = ts.isAssignmentTarget(node) ? - 2 /* Writing */ | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 1 /* NoIndexSignatures */ : 0) : 0 /* None */; + 2 /* Writing */ | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 1 /* NoIndexSignatures */ : 0) : + 0 /* None */; var indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, /*noUncheckedIndexedAccessCandidate*/ undefined, node, accessFlags | 16 /* ExpressionPosition */) || errorType; return checkIndexedAccessIndexType(getFlowTypeOfAccessExpression(node, getNodeLinks(node).resolvedSymbol, indexedAccessType, indexExpression, checkMode), node); } @@ -71081,14 +71157,14 @@ var ts; var i_1 = 0; var _loop_22 = function (c) { var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); }; - var diags_3 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* Normal */, /*reportErrors*/ true, chain_2); - if (diags_3) { - if (diags_3.length <= min_3) { - min_3 = diags_3.length; + var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* Normal */, /*reportErrors*/ true, chain_2); + if (diags_2) { + if (diags_2.length <= min_3) { + min_3 = diags_2.length; minIndex = i_1; } - max = Math.max(max, diags_3.length); - allDiagnostics.push(diags_3); + max = Math.max(max, diags_2.length); + allDiagnostics.push(diags_2); } else { ts.Debug.fail("No error for 3 or fewer overload signatures"); @@ -71099,15 +71175,15 @@ var ts; var c = candidatesForArgumentError_1[_a]; _loop_22(c); } - var diags_2 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics); - ts.Debug.assert(diags_2.length > 0, "No errors reported for 3 or fewer overload signatures"); - var chain = ts.chainDiagnosticMessages(ts.map(diags_2, function (d) { return typeof d.messageText === "string" ? d : d.messageText; }), ts.Diagnostics.No_overload_matches_this_call); + var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics); + ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures"); + var chain = ts.chainDiagnosticMessages(ts.map(diags_3, function (d) { return typeof d.messageText === "string" ? d : d.messageText; }), ts.Diagnostics.No_overload_matches_this_call); // The below is a spread to guarantee we get a new (mutable) array - our `flatMap` helper tries to do "smart" optimizations where it reuses input // arrays and the emptyArray singleton where possible, which is decidedly not what we want while we're still constructing this diagnostic - var related = __spreadArray([], ts.flatMap(diags_2, function (d) { return d.relatedInformation; })); + var related = __spreadArray([], ts.flatMap(diags_3, function (d) { return d.relatedInformation; })); var diag = void 0; - if (ts.every(diags_2, function (d) { return d.start === diags_2[0].start && d.length === diags_2[0].length && d.file === diags_2[0].file; })) { - var _b = diags_2[0], file = _b.file, start = _b.start, length_7 = _b.length; + if (ts.every(diags_3, function (d) { return d.start === diags_3[0].start && d.length === diags_3[0].length && d.file === diags_3[0].file; })) { + var _b = diags_3[0], file = _b.file, start = _b.start, length_7 = _b.length; diag = { file: file, start: start, length: length_7, code: chain.code, category: chain.category, messageText: chain, relatedInformation: related }; } else { @@ -71369,7 +71445,8 @@ var ts; if (ts.isCallChain(node)) { var nonOptionalType = getOptionalExpressionType(funcType, node.expression); callChainFlags = nonOptionalType === funcType ? 0 /* None */ : - ts.isOutermostOptionalChain(node) ? 16 /* IsOuterCallChain */ : 8 /* IsInnerCallChain */; + ts.isOutermostOptionalChain(node) ? 16 /* IsOuterCallChain */ : + 8 /* IsInnerCallChain */; funcType = nonOptionalType; } else { @@ -72146,8 +72223,10 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 /* Function */ - ? 252 /* FunctionDeclaration */ : resolvedRequire.flags & 3 /* Variable */ - ? 250 /* VariableDeclaration */ : 0 /* Unknown */; + ? 252 /* FunctionDeclaration */ + : resolvedRequire.flags & 3 /* Variable */ + ? 250 /* VariableDeclaration */ + : 0 /* Unknown */; if (targetDeclarationKind !== 0 /* Unknown */) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); // function/variable declaration should be ambient @@ -75805,7 +75884,7 @@ var ts; case 199 /* BindingElement */: case 252 /* FunctionDeclaration */: case 266 /* ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 - case 78 /* Identifier */: + case 78 /* Identifier */: // https://github.com/microsoft/TypeScript/issues/36098 // Identifiers are used as declarations of assignment declarations whose parents may be // SyntaxKind.CallExpression - `Object.defineProperty(thing, "aField", {value: 42});` // SyntaxKind.ElementAccessExpression - `thing["aField"] = 42;` or `thing["aField"];` (with a doc comment on it) @@ -77081,7 +77160,12 @@ var ts; if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) { return false; } - var interestingFlags = 8 /* Private */ | 16 /* Protected */ | 256 /* Async */ | 128 /* Abstract */ | 64 /* Readonly */ | 32 /* Static */; + var interestingFlags = 8 /* Private */ | + 16 /* Protected */ | + 256 /* Async */ | + 128 /* Abstract */ | + 64 /* Readonly */ | + 32 /* Static */; return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags); } function checkVariableDeclaration(node) { @@ -78802,9 +78886,9 @@ var ts; ts.forEach(properties, function (p) { seen.set(p.escapedName, p); }); for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { var base = baseTypes_2[_i]; - var properties_4 = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)); - for (var _a = 0, properties_5 = properties_4; _a < properties_5.length; _a++) { - var prop = properties_5[_a]; + var properties_5 = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)); + for (var _a = 0, properties_4 = properties_5; _a < properties_4.length; _a++) { + var prop = properties_4[_a]; var existing = seen.get(prop.escapedName); if (existing && !isPropertyIdenticalTo(existing, prop)) { seen.delete(prop.escapedName); @@ -80507,7 +80591,7 @@ var ts; } } if (name.parent.kind === 173 /* TypePredicate */) { - return resolveEntityName(name, 1 /* FunctionScopedVariable */); + return resolveEntityName(name, /*meaning*/ 1 /* FunctionScopedVariable */); } return undefined; } @@ -80896,7 +80980,7 @@ var ts; var symbol = getReferencedValueSymbol(node); // We should only get the declaration of an alias if there isn't a local value // declaration for the symbol - if (isNonLocalAlias(symbol, 111551 /* Value */) && !getTypeOnlyAliasDeclaration(symbol)) { + if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* Value */) && !getTypeOnlyAliasDeclaration(symbol)) { return getDeclarationOfAliasSymbol(symbol); } } @@ -88449,7 +88533,9 @@ var ts; } function visitPrefixUnaryExpression(node) { if (shouldTransformPrivateElements && ts.isPrivateIdentifierPropertyAccessExpression(node.operand)) { - var operator = node.operator === 45 /* PlusPlusToken */ ? 39 /* PlusToken */ : node.operator === 46 /* MinusMinusToken */ ? 40 /* MinusToken */ : undefined; + var operator = node.operator === 45 /* PlusPlusToken */ ? + 39 /* PlusToken */ : node.operator === 46 /* MinusMinusToken */ ? + 40 /* MinusToken */ : undefined; var info = void 0; if (operator && (info = accessPrivateIdentifier(node.operand.name))) { var receiver = ts.visitNode(node.operand.expression, visitor, ts.isExpression); @@ -88462,7 +88548,9 @@ var ts; } function visitPostfixUnaryExpression(node, valueIsDiscarded) { if (shouldTransformPrivateElements && ts.isPrivateIdentifierPropertyAccessExpression(node.operand)) { - var operator = node.operator === 45 /* PlusPlusToken */ ? 39 /* PlusToken */ : node.operator === 46 /* MinusMinusToken */ ? 40 /* MinusToken */ : undefined; + var operator = node.operator === 45 /* PlusPlusToken */ ? + 39 /* PlusToken */ : node.operator === 46 /* MinusMinusToken */ ? + 40 /* MinusToken */ : undefined; var info = void 0; if (operator && (info = accessPrivateIdentifier(node.operand.name))) { var receiver = ts.visitNode(node.operand.expression, visitor, ts.isExpression); @@ -88602,10 +88690,11 @@ var ts; return ts.visitEachChild(node, visitor, context); } var staticProperties = ts.getProperties(node, /*requireInitializer*/ false, /*isStatic*/ true); + var pendingPrivateStateAssignment; if (shouldTransformPrivateElements && ts.some(node.members, function (m) { return ts.hasStaticModifier(m) && !!m.name && ts.isPrivateIdentifier(m.name); })) { var temp = factory.createTempVariable(hoistVariableDeclaration, /* reservedInNestedScopes */ true); getPrivateIdentifierEnvironment().classConstructor = factory.cloneNode(temp); - getPendingExpressions().push(factory.createAssignment(temp, factory.getInternalName(node))); + pendingPrivateStateAssignment = factory.createAssignment(temp, factory.getInternalName(node)); } var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 103 /* NullKeyword */); @@ -88614,6 +88703,9 @@ var ts; /*decorators*/ undefined, node.modifiers, node.name, /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)) ]; + if (pendingPrivateStateAssignment) { + getPendingExpressions().unshift(pendingPrivateStateAssignment); + } // Write any pending expressions from elided or moved computed property names if (ts.some(pendingExpressions)) { statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))); @@ -90177,7 +90269,9 @@ var ts; return ts.visitEachChild(node, expressionResultIsUnused ? visitorWithUnusedExpressionResult : visitor, context); } function visitSourceFile(node) { - var ancestorFacts = enterSubtree(2 /* SourceFileExcludes */, ts.isEffectiveStrictModeSourceFile(node, compilerOptions) ? 0 /* StrictModeSourceFileIncludes */ : 1 /* SourceFileIncludes */); + var ancestorFacts = enterSubtree(2 /* SourceFileExcludes */, ts.isEffectiveStrictModeSourceFile(node, compilerOptions) ? + 0 /* StrictModeSourceFileIncludes */ : + 1 /* SourceFileIncludes */); exportedVariableStatement = false; var visited = ts.visitEachChild(node, visitor, context); var statement = ts.concatenate(visited.statements, taggedTemplateStringDeclarations && [ @@ -101095,7 +101189,13 @@ var ts; }); } ts.isInternalDeclaration = isInternalDeclaration; - var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */; + var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | + 2048 /* WriteClassExpressionAsTypeLiteral */ | + 4096 /* UseTypeOfFunction */ | + 8 /* UseStructuralFallback */ | + 524288 /* AllowEmptyTuple */ | + 4 /* GenerateNamesForShadowedTypeParams */ | + 1 /* NoTruncation */; /** * Transforms a ts file into a .d.ts file * This process requires type information, which is retrieved through the emit resolver. Because of this, @@ -101996,7 +102096,7 @@ var ts; } var previousNeedsDeclare = needsDeclare; switch (input.kind) { - case 255 /* TypeAliasDeclaration */: + case 255 /* TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all return cleanup(factory.updateTypeAliasDeclaration(input, /*decorators*/ undefined, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); case 254 /* InterfaceDeclaration */: { @@ -103084,8 +103184,11 @@ var ts; if (configFile.options.emitDeclarationOnly) return undefined; var isJsonFile = ts.fileExtensionIs(inputFileName, ".json" /* Json */); - var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory), isJsonFile ? ".json" /* Json */ : - configFile.options.jsx === 1 /* Preserve */ && (ts.fileExtensionIs(inputFileName, ".tsx" /* Tsx */) || ts.fileExtensionIs(inputFileName, ".jsx" /* Jsx */)) ? ".jsx" /* Jsx */ : ".js" /* Js */); + var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory), isJsonFile ? + ".json" /* Json */ : + configFile.options.jsx === 1 /* Preserve */ && (ts.fileExtensionIs(inputFileName, ".tsx" /* Tsx */) || ts.fileExtensionIs(inputFileName, ".jsx" /* Jsx */)) ? + ".jsx" /* Jsx */ : + ".js" /* Js */); return !isJsonFile || ts.comparePaths(inputFileName, outputFileName, ts.Debug.checkDefined(configFile.options.configFilePath), ignoreCase) !== 0 /* EqualTo */ ? outputFileName : undefined; @@ -104652,7 +104755,9 @@ var ts; var pos = getTextPosWithWriteLine(); writeUnparsedNode(unparsed); if (bundleFileInfo) { - updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 295 /* UnparsedText */ ? "text" /* Text */ : "internal" /* Internal */); + updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 295 /* UnparsedText */ ? + "text" /* Text */ : + "internal" /* Internal */); } } // SyntaxKind.UnparsedSyntheticReference @@ -114174,7 +114279,8 @@ var ts; return { relativePreference: importModuleSpecifierPreference === "relative" ? 0 /* Relative */ : importModuleSpecifierPreference === "non-relative" ? 1 /* NonRelative */ : - importModuleSpecifierPreference === "project-relative" ? 3 /* ExternalNonRelative */ : 2 /* Shortest */, + importModuleSpecifierPreference === "project-relative" ? 3 /* ExternalNonRelative */ : + 2 /* Shortest */, ending: getEnding(), }; function getEnding() { @@ -114182,14 +114288,16 @@ var ts; case "minimal": return 0 /* Minimal */; case "index": return 1 /* Index */; case "js": return 2 /* JsExtension */; - default: return usesJsExtensionOnImports(importingSourceFile) ? 2 /* JsExtension */ : ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeJs ? 1 /* Index */ : 0 /* Minimal */; + default: return usesJsExtensionOnImports(importingSourceFile) ? 2 /* JsExtension */ + : ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeJs ? 1 /* Index */ : 0 /* Minimal */; } } } function getPreferencesForUpdate(compilerOptions, oldImportSpecifier) { return { relativePreference: ts.isExternalModuleNameRelative(oldImportSpecifier) ? 0 /* Relative */ : 1 /* NonRelative */, - ending: ts.hasJSFileExtension(oldImportSpecifier) ? 2 /* JsExtension */ : + ending: ts.hasJSFileExtension(oldImportSpecifier) ? + 2 /* JsExtension */ : ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeJs || ts.endsWith(oldImportSpecifier, "index") ? 1 /* Index */ : 0 /* Minimal */, }; } @@ -118294,8 +118402,10 @@ var ts; } function getKindOfVariableDeclaration(v) { return ts.isVarConst(v) - ? "const" /* constElement */ : ts.isLet(v) - ? "let" /* letElement */ : "var" /* variableElement */; + ? "const" /* constElement */ + : ts.isLet(v) + ? "let" /* letElement */ + : "var" /* variableElement */; } } ts.getNodeKind = getNodeKind; @@ -120229,10 +120339,10 @@ var ts; var delta = 0; var lastPos = -1; for (var _i = 0, edits_1 = edits; _i < edits_1.length; _i++) { - var _a = edits_1[_i], fileName = _a.fileName, textChanges_1 = _a.textChanges; + var _a = edits_1[_i], fileName = _a.fileName, textChanges_2 = _a.textChanges; ts.Debug.assert(fileName === renameFilename); - for (var _b = 0, textChanges_2 = textChanges_1; _b < textChanges_2.length; _b++) { - var change = textChanges_2[_b]; + for (var _b = 0, textChanges_1 = textChanges_2; _b < textChanges_1.length; _b++) { + var change = textChanges_1[_b]; var span = change.span, newText = change.newText; var index = indexInTextChange(newText, name); if (index !== -1) { @@ -123055,6 +123165,8 @@ var ts; return jsdocCompletionInfo(ts.JsDoc.getJSDocTagCompletions()); case 3 /* JsDocParameterName */: return jsdocCompletionInfo(ts.JsDoc.getJSDocParameterNameCompletions(completionData.tag)); + case 4 /* Keywords */: + return specificKeywordCompletionInfo(completionData.keywords); default: return ts.Debug.assertNever(completionData); } @@ -123063,6 +123175,19 @@ var ts; function jsdocCompletionInfo(entries) { return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries }; } + function specificKeywordCompletionInfo(keywords) { + return { + isGlobalCompletion: false, + isMemberCompletion: false, + isNewIdentifierLocation: false, + entries: keywords.map(function (k) { return ({ + name: ts.tokenToString(k), + kind: "keyword" /* keyword */, + kindModifiers: "" /* none */, + sortText: SortText.GlobalsOrKeywords, + }); }), + }; + } function getOptionalReplacementSpan(location) { // StringLiteralLike locations are handled separately in stringCompletions.ts return (location === null || location === void 0 ? void 0 : location.kind) === 78 /* Identifier */ ? ts.createTextSpanFromNode(location) : undefined; @@ -123289,7 +123414,8 @@ var ts; var replacementSpan = ts.createTextSpanFromNode(importCompletionNode, sourceFile); var quotedModuleSpecifier = ts.quote(sourceFile, preferences, origin.moduleSpecifier); var exportKind = origin.isDefaultExport ? 1 /* Default */ : - origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : 0 /* Named */; + origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : + 0 /* Named */; var tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : ""; var importKind = ts.codefix.getImportKind(sourceFile, exportKind, options); var suffix = useSemicolons ? ";" : ""; @@ -123486,6 +123612,8 @@ var ts; return ts.JsDoc.getJSDocTagCompletionDetails(name); case 3 /* JsDocParameterName */: return ts.JsDoc.getJSDocParameterNameCompletionDetails(name); + case 4 /* Keywords */: + return request.keywords.indexOf(ts.stringToToken(name)) > -1 ? createSimpleDetails(name, "keyword" /* keyword */, ts.SymbolDisplayPartKind.keyword) : undefined; default: return ts.Debug.assertNever(request); } @@ -123544,6 +123672,7 @@ var ts; CompletionDataKind[CompletionDataKind["JsDocTagName"] = 1] = "JsDocTagName"; CompletionDataKind[CompletionDataKind["JsDocTag"] = 2] = "JsDocTag"; CompletionDataKind[CompletionDataKind["JsDocParameterName"] = 3] = "JsDocParameterName"; + CompletionDataKind[CompletionDataKind["Keywords"] = 4] = "Keywords"; })(CompletionDataKind || (CompletionDataKind = {})); var CompletionKind; (function (CompletionKind) { @@ -123598,7 +123727,7 @@ var ts; } } function getFirstSymbolInChain(symbol, enclosingDeclaration, checker) { - var chain = checker.getAccessibleSymbolChain(symbol, enclosingDeclaration, 67108863 /* All */, /*useOnlyExternalAliasing*/ false); + var chain = checker.getAccessibleSymbolChain(symbol, enclosingDeclaration, /*meaning*/ 67108863 /* All */, /*useOnlyExternalAliasing*/ false); if (chain) return ts.first(chain); return symbol.parent && (isModuleSymbol(symbol.parent) ? symbol : getFirstSymbolInChain(symbol.parent, enclosingDeclaration, checker)); @@ -123704,13 +123833,17 @@ var ts; var importCompletionNode; var location = ts.getTouchingPropertyName(sourceFile, position); if (contextToken) { + var importCompletionCandidate = getImportCompletionNode(contextToken); + if (importCompletionCandidate === 153 /* FromKeyword */) { + return { kind: 4 /* Keywords */, keywords: [153 /* FromKeyword */] }; + } // Import statement completions use `insertText`, and also require the `data` property of `CompletionEntryIdentifier` // added in TypeScript 4.3 to be sent back from the client during `getCompletionEntryDetails`. Since this feature // is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients // to opt in with the `includeCompletionsForImportStatements` user preference. - importCompletionNode = preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText - ? getImportCompletionNode(contextToken) - : undefined; + if (importCompletionCandidate && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) { + importCompletionNode = importCompletionCandidate; + } // Bail out if this is a known invalid completion location if (!importCompletionNode && isCompletionListBlocker(contextToken)) { log("Returning an empty list because completion was requested in an invalid position."); @@ -124186,7 +124319,8 @@ var ts; collectAutoImports(/*resolveModuleSpecifier*/ false); if (isTypeOnly) { keywordFilters = contextToken && ts.isAssertionExpression(contextToken.parent) - ? 6 /* TypeAssertionKeywords */ : 7 /* TypeKeywords */; + ? 6 /* TypeAssertionKeywords */ + : 7 /* TypeKeywords */; } } function shouldOfferImportCompletions() { @@ -124417,7 +124551,7 @@ var ts; || containingNodeKind === 172 /* IndexSignature */ // [ | : string ] || containingNodeKind === 159 /* ComputedPropertyName */; // [ | /* this can become an index signature */ case 139 /* ModuleKeyword */: // module | - case 140 /* NamespaceKeyword */: + case 140 /* NamespaceKeyword */: // namespace | return true; case 24 /* DotToken */: return containingNodeKind === 257 /* ModuleDeclaration */; // module A.| @@ -124666,7 +124800,7 @@ var ts; var parent = contextToken.parent; switch (contextToken.kind) { case 18 /* OpenBraceToken */: // const x = { | - case 27 /* CommaToken */: + case 27 /* CommaToken */: // const x = { a: 0, | if (ts.isObjectLiteralExpression(parent) || ts.isObjectBindingPattern(parent)) { return parent; } @@ -124845,7 +124979,7 @@ var ts; case 118 /* LetKeyword */: case 84 /* ConstKeyword */: case 135 /* InferKeyword */: - case 149 /* TypeKeyword */: + case 149 /* TypeKeyword */: // type htm| return true; case 41 /* AsteriskToken */: return ts.isFunctionLike(contextToken.parent) && !ts.isMethodDeclaration(contextToken.parent); @@ -125138,7 +125272,7 @@ var ts; // TODO: GH#18169 return { name: JSON.stringify(name), needsConvertPropertyAccess: false }; case 2 /* PropertyAccess */: - case 1 /* Global */: + case 1 /* Global */: // For a 'this.' completion it will be in a global context, but may have a non-identifier name. // Don't add a completion for a name starting with a space. See https://github.com/Microsoft/TypeScript/pull/20547 return name.charCodeAt(0) === 32 /* space */ ? undefined : { name: name, needsConvertPropertyAccess: true }; case 5 /* None */: @@ -125334,16 +125468,16 @@ var ts; return ts.findAncestor(contextToken, ts.isClassLike); } switch (contextToken.kind) { - case 62 /* EqualsToken */: + case 62 /* EqualsToken */: // class c { public prop = | /* global completions */ } return undefined; case 26 /* SemicolonToken */: // class c {getValue(): number; | } - case 19 /* CloseBraceToken */: + case 19 /* CloseBraceToken */: // class c { method() { } | } // class c { method() { } b| } return isFromObjectTypeDeclaration(location) && location.parent.name === location ? location.parent.parent : ts.tryCast(location, ts.isObjectTypeDeclaration); case 18 /* OpenBraceToken */: // class c { | - case 27 /* CommaToken */: + case 27 /* CommaToken */: // class c {getValue(): number, | } return ts.tryCast(contextToken.parent, ts.isObjectTypeDeclaration); default: if (!isFromObjectTypeDeclaration(contextToken)) { @@ -125463,16 +125597,20 @@ var ts; } function getImportCompletionNode(contextToken) { var candidate = getCandidate(); - return candidate && ts.rangeIsOnSingleLine(candidate, candidate.getSourceFile()) ? candidate : undefined; + return candidate === 153 /* FromKeyword */ || candidate && ts.rangeIsOnSingleLine(candidate, candidate.getSourceFile()) ? candidate : undefined; function getCandidate() { var parent = contextToken.parent; if (ts.isImportEqualsDeclaration(parent)) { return isModuleSpecifierMissingOrEmpty(parent.moduleReference) ? parent : undefined; } if (ts.isNamedImports(parent) || ts.isNamespaceImport(parent)) { - return isModuleSpecifierMissingOrEmpty(parent.parent.parent.moduleSpecifier) && (ts.isNamespaceImport(parent) || parent.elements.length < 2) && !parent.parent.name - ? parent.parent.parent - : undefined; + if (isModuleSpecifierMissingOrEmpty(parent.parent.parent.moduleSpecifier) && (ts.isNamespaceImport(parent) || parent.elements.length < 2) && !parent.parent.name) { + // At `import { ... } |` or `import * as Foo |`, the only possible completion is `from` + return contextToken.kind === 19 /* CloseBraceToken */ || contextToken.kind === 78 /* Identifier */ + ? 153 /* FromKeyword */ + : parent.parent.parent; + } + return undefined; } if (ts.isImportKeyword(contextToken) && ts.isSourceFile(parent)) { // A lone import keyword with nothing following it does not parse as a statement at all @@ -126209,7 +126347,7 @@ var ts; } } break; - case 78 /* Identifier */: + case 78 /* Identifier */: // for 'const x = require("y"); break; // TODO: GH#23879 case 261 /* ImportEqualsDeclaration */: handleNamespaceImport(direct, direct.name, ts.hasSyntacticModifier(direct, 1 /* Export */), /*alreadyAddedDirect*/ false); @@ -130864,9 +131002,11 @@ var ts; return ts.isFunctionExpression(node) || ts.isFunctionDeclaration(node) || ts.isVariableDeclaration(node); } var bAssignmentDeclarationKind = ts.isBinaryExpression(b.node) || ts.isCallExpression(b.node) ? - ts.getAssignmentDeclarationKind(b.node) : 0 /* None */; + ts.getAssignmentDeclarationKind(b.node) : + 0 /* None */; var aAssignmentDeclarationKind = ts.isBinaryExpression(a.node) || ts.isCallExpression(a.node) ? - ts.getAssignmentDeclarationKind(a.node) : 0 /* None */; + ts.getAssignmentDeclarationKind(a.node) : + 0 /* None */; // We treat this as an es5 class and merge the nodes in in one of several cases if ((isEs5ClassMember[bAssignmentDeclarationKind] && isEs5ClassMember[aAssignmentDeclarationKind]) // merge two class elements || (isPossibleConstructor(a.node) && isEs5ClassMember[bAssignmentDeclarationKind]) // ctor function & member @@ -132169,7 +132309,8 @@ var ts; return ts.min(a, b, compareMatches); } function compareMatches(a, b) { - return a === undefined ? 1 /* GreaterThan */ : b === undefined ? -1 /* LessThan */ : ts.compareValues(a.kind, b.kind) || ts.compareBooleans(!a.isCaseSensitive, !b.isCaseSensitive); + return a === undefined ? 1 /* GreaterThan */ : b === undefined ? -1 /* LessThan */ + : ts.compareValues(a.kind, b.kind) || ts.compareBooleans(!a.isCaseSensitive, !b.isCaseSensitive); } function partStartsWith(candidate, candidateSpan, pattern, ignoreCase, patternSpan) { if (patternSpan === void 0) { patternSpan = { start: 0, length: pattern.length }; } @@ -134202,7 +134343,8 @@ var ts; } var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol); if (flags & 32 /* Class */) { - return ts.getDeclarationOfKind(symbol, 222 /* ClassExpression */) ? "local class" /* localClassElement */ : "class" /* classElement */; + return ts.getDeclarationOfKind(symbol, 222 /* ClassExpression */) ? + "local class" /* localClassElement */ : "class" /* classElement */; } if (flags & 384 /* Enum */) return "enum" /* enumElement */; @@ -134305,7 +134447,8 @@ var ts; var _a = symbol.declarations, declaration = _a[0], declarations = _a.slice(1); // omit deprecated flag if some declarations are not deprecated var excludeFlags = ts.length(declarations) && isDeprecatedDeclaration(declaration) && ts.some(declarations, function (d) { return !isDeprecatedDeclaration(d); }) - ? 8192 /* Deprecated */ : 0 /* None */; + ? 8192 /* Deprecated */ + : 0 /* None */; var modifiers = ts.getNodeModifiers(declaration, excludeFlags); if (modifiers) { return modifiers.split(","); @@ -135186,7 +135329,8 @@ var ts; shouldRescanTemplateToken(n) ? 3 /* RescanTemplateToken */ : shouldRescanJsxIdentifier(n) ? 4 /* RescanJsxIdentifier */ : shouldRescanJsxText(n) ? 5 /* RescanJsxText */ : - shouldRescanJsxAttributeValue(n) ? 6 /* RescanJsxAttributeValue */ : 0 /* Scan */; + shouldRescanJsxAttributeValue(n) ? 6 /* RescanJsxAttributeValue */ : + 0 /* Scan */; if (lastTokenInfo && expectedScanAction === lastScanAction) { // readTokenInfo was called before with the same expected scan action. // No need to re-scan text, return existing 'lastTokenInfo' @@ -135367,14 +135511,8 @@ var ts; var binaryKeywordOperators = [100 /* InKeyword */, 101 /* InstanceOfKeyword */, 157 /* OfKeyword */, 126 /* AsKeyword */, 137 /* IsKeyword */]; var unaryPrefixOperators = [45 /* PlusPlusToken */, 46 /* MinusMinusToken */, 54 /* TildeToken */, 53 /* ExclamationToken */]; var unaryPrefixExpressions = [ - 8 /* NumericLiteral */, - 9 /* BigIntLiteral */, - 78 /* Identifier */, - 20 /* OpenParenToken */, - 22 /* OpenBracketToken */, - 18 /* OpenBraceToken */, - 107 /* ThisKeyword */, - 102 /* NewKeyword */ + 8 /* NumericLiteral */, 9 /* BigIntLiteral */, 78 /* Identifier */, 20 /* OpenParenToken */, + 22 /* OpenBracketToken */, 18 /* OpenBraceToken */, 107 /* ThisKeyword */, 102 /* NewKeyword */ ]; var unaryPreincrementExpressions = [78 /* Identifier */, 20 /* OpenParenToken */, 107 /* ThisKeyword */, 102 /* NewKeyword */]; var unaryPostincrementExpressions = [78 /* Identifier */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 102 /* NewKeyword */]; @@ -135805,7 +135943,7 @@ var ts; // case SyntaxKind.SimpleArrowFunctionExpression: // case SyntaxKind.ParenthesizedArrowFunctionExpression: // falls through - case 254 /* InterfaceDeclaration */: + case 254 /* InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one return true; } return false; @@ -136695,7 +136833,7 @@ var ts; // if there are any tokens that logically belong to node and interleave child nodes // such tokens will be consumed in processChildNode for the child that follows them ts.forEachChild(node, function (child) { - processChildNode(child, -1 /* Unknown */, node, nodeDynamicIndentation, nodeStartLine, undecoratedNodeStartLine, /*isListItem*/ false); + processChildNode(child, /*inheritedIndentation*/ -1 /* Unknown */, node, nodeDynamicIndentation, nodeStartLine, undecoratedNodeStartLine, /*isListItem*/ false); }, function (nodes) { processChildNodes(nodes, node, nodeStartLine, nodeDynamicIndentation); }); @@ -136866,7 +137004,8 @@ var ts; } if (indentToken) { var tokenIndentation = (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) ? - dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind, container, !!isListEndToken) : -1 /* Unknown */; + dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind, container, !!isListEndToken) : + -1 /* Unknown */; var indentNextTokenOrTrivia = true; if (currentTokenInfo.leadingTrivia) { var commentIndentation_1 = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation, container); @@ -140694,7 +140833,7 @@ var ts; // do not produce a transformed statement for a null argument break; case 202 /* PropertyAccessExpression */: - case 78 /* Identifier */: + case 78 /* Identifier */: // identifier includes undefined if (!argName) { // undefined was argument passed to promise handler break; @@ -162565,7 +162704,8 @@ var ts; } function directoryHasPackageJson(directory) { return packageJsons.has(ts.combinePaths(directory, "package.json")) ? -1 /* True */ : - directoriesWithoutPackageJson.has(directory) ? 0 /* False */ : 3 /* Maybe */; + directoriesWithoutPackageJson.has(directory) ? 0 /* False */ : + 3 /* Maybe */; } } server.createPackageJsonCache = createPackageJsonCache; diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index b57f7c3ca2326..677cd7f8ff2f9 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -290,7 +290,7 @@ var ts; // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types - ts.version = "4.3.1-rc"; + ts.version = "4.3.2"; /* @internal */ var Comparison; (function (Comparison) { @@ -1847,7 +1847,8 @@ var ts; return a === b ? 0 /* EqualTo */ : a === undefined ? -1 /* LessThan */ : b === undefined ? 1 /* GreaterThan */ : - a < b ? -1 /* LessThan */ : 1 /* GreaterThan */; + a < b ? -1 /* LessThan */ : + 1 /* GreaterThan */; } /** * Compare two numeric values for their order relative to each other. @@ -7862,7 +7863,8 @@ var ts; if (ts.sys && ts.sys.getEnvironmentVariable) { setCustomPollingValues(ts.sys); ts.Debug.setAssertionLevel(/^development$/i.test(ts.sys.getEnvironmentVariable("NODE_ENV")) - ? 1 /* Normal */ : 0 /* None */); + ? 1 /* Normal */ + : 0 /* None */); } if (ts.sys && ts.sys.debugMode) { ts.Debug.isDebugging = true; @@ -7881,7 +7883,7 @@ var ts; Identifier_expected: diag(1003, ts.DiagnosticCategory.Error, "Identifier_expected_1003", "Identifier expected."), _0_expected: diag(1005, ts.DiagnosticCategory.Error, "_0_expected_1005", "'{0}' expected."), A_file_cannot_have_a_reference_to_itself: diag(1006, ts.DiagnosticCategory.Error, "A_file_cannot_have_a_reference_to_itself_1006", "A file cannot have a reference to itself."), - The_parser_expected_to_find_a_1_to_match_the_0_token_here: diag(1007, ts.DiagnosticCategory.Error, "The_parser_expected_to_find_a_1_to_match_the_0_token_here_1007", "The parser expected to find a '{1}' to match the '{0}' token here."), + The_parser_expected_to_find_a_to_match_the_token_here: diag(1007, ts.DiagnosticCategory.Error, "The_parser_expected_to_find_a_to_match_the_token_here_1007", "The parser expected to find a '}' to match the '{' token here."), Trailing_comma_not_allowed: diag(1009, ts.DiagnosticCategory.Error, "Trailing_comma_not_allowed_1009", "Trailing comma not allowed."), Asterisk_Slash_expected: diag(1010, ts.DiagnosticCategory.Error, "Asterisk_Slash_expected_1010", "'*/' expected."), An_element_access_expression_should_take_an_argument: diag(1011, ts.DiagnosticCategory.Error, "An_element_access_expression_should_take_an_argument_1011", "An element access expression should take an argument."), @@ -13202,7 +13204,7 @@ var ts; case 105 /* SuperKeyword */: case 226 /* NonNullExpression */: case 227 /* MetaProperty */: - case 99 /* ImportKeyword */: + case 99 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression return true; default: return false; @@ -16275,7 +16277,8 @@ var ts; case 217 /* BinaryExpression */: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? - binaryOperator === 62 /* EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* Definite */ : 2 /* Compound */ : 0 /* None */; + binaryOperator === 62 /* EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* Definite */ : 2 /* Compound */ : + 0 /* None */; case 215 /* PrefixUnaryExpression */: case 216 /* PostfixUnaryExpression */: var unaryOperator = parent.operator; @@ -18700,7 +18703,8 @@ var ts; if (getCheckFlags(s) & 6 /* Synthetic */) { var checkFlags = s.checkFlags; var accessModifier = checkFlags & 1024 /* ContainsPrivate */ ? 8 /* Private */ : - checkFlags & 256 /* ContainsPublic */ ? 4 /* Public */ : 16 /* Protected */; + checkFlags & 256 /* ContainsPublic */ ? 4 /* Public */ : + 16 /* Protected */; var staticModifier = checkFlags & 2048 /* ContainsStatic */ ? 32 /* Static */ : 0; return accessModifier | staticModifier; } @@ -19232,7 +19236,8 @@ var ts; } function compareDiagnostics(d1, d2) { return compareDiagnosticsSkipRelatedInformation(d1, d2) || - compareRelatedInformation(d1, d2) || 0 /* EqualTo */; + compareRelatedInformation(d1, d2) || + 0 /* EqualTo */; } ts.compareDiagnostics = compareDiagnostics; function compareDiagnosticsSkipRelatedInformation(d1, d2) { @@ -19240,7 +19245,8 @@ var ts; ts.compareValues(d1.start, d2.start) || ts.compareValues(d1.length, d2.length) || ts.compareValues(d1.code, d2.code) || - compareMessageText(d1.messageText, d2.messageText) || 0 /* EqualTo */; + compareMessageText(d1.messageText, d2.messageText) || + 0 /* EqualTo */; } ts.compareDiagnosticsSkipRelatedInformation = compareDiagnosticsSkipRelatedInformation; function compareRelatedInformation(d1, d2) { @@ -20092,15 +20098,15 @@ var ts; var log2Base; switch (stringValue.charCodeAt(1)) { // "x" in "0x123" case 98 /* b */: - case 66 /* B */: + case 66 /* B */: // 0b or 0B log2Base = 1; break; case 111 /* o */: - case 79 /* O */: + case 79 /* O */: // 0o or 0O log2Base = 3; break; case 120 /* x */: - case 88 /* X */: + case 88 /* X */: // 0x or 0X log2Base = 4; break; default: // already in decimal; omit trailing "n" @@ -21767,7 +21773,8 @@ var ts; case 129 /* AsyncKeyword */: // 'async' modifier is ES2017 (async functions) or ES2018 (async generators) transformFlags = - 128 /* ContainsES2017 */ | 64 /* ContainsES2018 */; + 128 /* ContainsES2017 */ | + 64 /* ContainsES2018 */; break; case 122 /* PublicKeyword */: case 120 /* PrivateKeyword */: @@ -21787,7 +21794,7 @@ var ts; case 148 /* SymbolKeyword */: case 113 /* VoidKeyword */: case 152 /* UnknownKeyword */: - case 150 /* UndefinedKeyword */: + case 150 /* UndefinedKeyword */: // `undefined` is an Identifier in the expression case. transformFlags = 1 /* ContainsTypeScript */; break; case 123 /* StaticKeyword */: @@ -21900,7 +21907,9 @@ var ts; var node = createBaseNode(159 /* ComputedPropertyName */); node.expression = parenthesizerRules().parenthesizeExpressionOfComputedPropertyName(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 512 /* ContainsES2015 */ | 65536 /* ContainsComputedPropertyName */; + propagateChildFlags(node.expression) | + 512 /* ContainsES2015 */ | + 65536 /* ContainsComputedPropertyName */; return node; } // @api @@ -21968,7 +21977,9 @@ var ts; var node = createBaseNode(162 /* Decorator */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */ | 4096 /* ContainsTypeScriptClassSyntax */; + propagateChildFlags(node.expression) | + 1 /* ContainsTypeScript */ | + 4096 /* ContainsTypeScriptClassSyntax */; return node; } // @api @@ -22005,7 +22016,8 @@ var ts; node.exclamationToken = questionOrExclamationToken && ts.isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.transformFlags |= propagateChildFlags(node.questionToken) | - propagateChildFlags(node.exclamationToken) | 8388608 /* ContainsClassFields */; + propagateChildFlags(node.exclamationToken) | + 8388608 /* ContainsClassFields */; if (ts.isComputedPropertyName(node.name) || (ts.hasStaticModifier(node) && node.initializer)) { node.transformFlags |= 4096 /* ContainsTypeScriptClassSyntax */; } @@ -22052,7 +22064,8 @@ var ts; node.questionToken = questionToken; node.transformFlags |= propagateChildFlags(node.asteriskToken) | - propagateChildFlags(node.questionToken) | 512 /* ContainsES2015 */; + propagateChildFlags(node.questionToken) | + 512 /* ContainsES2015 */; if (questionToken) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -22580,10 +22593,13 @@ var ts; var node = createBaseNode(197 /* ObjectBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= - propagateChildrenFlags(node.elements) | 512 /* ContainsES2015 */ | 262144 /* ContainsBindingPattern */; + propagateChildrenFlags(node.elements) | + 512 /* ContainsES2015 */ | + 262144 /* ContainsBindingPattern */; if (node.transformFlags & 16384 /* ContainsRestOrSpread */) { node.transformFlags |= - 64 /* ContainsES2018 */ | 32768 /* ContainsObjectRestOrSpread */; + 64 /* ContainsES2018 */ | + 32768 /* ContainsObjectRestOrSpread */; } return node; } @@ -22598,7 +22614,9 @@ var ts; var node = createBaseNode(198 /* ArrayBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= - propagateChildrenFlags(node.elements) | 512 /* ContainsES2015 */ | 262144 /* ContainsBindingPattern */; + propagateChildrenFlags(node.elements) | + 512 /* ContainsES2015 */ | + 262144 /* ContainsBindingPattern */; return node; } // @api @@ -22615,7 +22633,8 @@ var ts; node.propertyName = asName(propertyName); node.dotDotDotToken = dotDotDotToken; node.transformFlags |= - propagateChildFlags(node.dotDotDotToken) | 512 /* ContainsES2015 */; + propagateChildFlags(node.dotDotDotToken) | + 512 /* ContainsES2015 */; if (node.propertyName) { node.transformFlags |= ts.isIdentifier(node.propertyName) ? propagateIdentifierNameFlags(node.propertyName) : @@ -22684,7 +22703,8 @@ var ts; // super method calls require a lexical 'this' // super method calls require 'super' hoisting in ES2017 and ES2018 async functions and async generators node.transformFlags |= - 128 /* ContainsES2017 */ | 64 /* ContainsES2018 */; + 128 /* ContainsES2017 */ | + 64 /* ContainsES2018 */; } return node; } @@ -22737,7 +22757,8 @@ var ts; // super method calls require a lexical 'this' // super method calls require 'super' hoisting in ES2017 and ES2018 async functions and async generators node.transformFlags |= - 128 /* ContainsES2017 */ | 64 /* ContainsES2018 */; + 128 /* ContainsES2017 */ | + 64 /* ContainsES2018 */; } return node; } @@ -22761,7 +22782,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.questionDotToken) | - propagateChildFlags(node.argumentExpression) | 16 /* ContainsES2020 */; + propagateChildFlags(node.argumentExpression) | + 16 /* ContainsES2020 */; return node; } // @api @@ -22819,7 +22841,8 @@ var ts; propagateChildFlags(node.expression) | propagateChildFlags(node.questionDotToken) | propagateChildrenFlags(node.typeArguments) | - propagateChildrenFlags(node.arguments) | 16 /* ContainsES2020 */; + propagateChildrenFlags(node.arguments) | + 16 /* ContainsES2020 */; if (node.typeArguments) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -22847,7 +22870,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.expression) | propagateChildrenFlags(node.typeArguments) | - propagateChildrenFlags(node.arguments) | 16 /* ContainsES2020 */; + propagateChildrenFlags(node.arguments) | + 16 /* ContainsES2020 */; if (node.typeArguments) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -22870,7 +22894,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.tag) | propagateChildrenFlags(node.typeArguments) | - propagateChildFlags(node.template) | 512 /* ContainsES2015 */; + propagateChildFlags(node.template) | + 512 /* ContainsES2015 */; if (node.typeArguments) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -22894,7 +22919,8 @@ var ts; node.type = type; node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildFlags(node.type) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.type) | + 1 /* ContainsTypeScript */; return node; } // @api @@ -22958,7 +22984,8 @@ var ts; /*name*/ undefined, typeParameters, parameters, type, parenthesizerRules().parenthesizeConciseBodyOfArrowFunction(body)); node.equalsGreaterThanToken = equalsGreaterThanToken !== null && equalsGreaterThanToken !== void 0 ? equalsGreaterThanToken : createToken(38 /* EqualsGreaterThanToken */); node.transformFlags |= - propagateChildFlags(node.equalsGreaterThanToken) | 512 /* ContainsES2015 */; + propagateChildFlags(node.equalsGreaterThanToken) | + 512 /* ContainsES2015 */; if (ts.modifiersToFlags(node.modifiers) & 256 /* Async */) { node.transformFlags |= 128 /* ContainsES2017 */; } @@ -23019,7 +23046,10 @@ var ts; var node = createBaseExpression(214 /* AwaitExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 128 /* ContainsES2017 */ | 64 /* ContainsES2018 */ | 1048576 /* ContainsAwait */; + propagateChildFlags(node.expression) | + 128 /* ContainsES2017 */ | + 64 /* ContainsES2018 */ | + 1048576 /* ContainsAwait */; return node; } // @api @@ -23074,12 +23104,15 @@ var ts; else if (operatorKind === 62 /* EqualsToken */) { if (ts.isObjectLiteralExpression(node.left)) { node.transformFlags |= - 512 /* ContainsES2015 */ | 64 /* ContainsES2018 */ | 2048 /* ContainsDestructuringAssignment */ | + 512 /* ContainsES2015 */ | + 64 /* ContainsES2018 */ | + 2048 /* ContainsDestructuringAssignment */ | propagateAssignmentPatternFlags(node.left); } else if (ts.isArrayLiteralExpression(node.left)) { node.transformFlags |= - 512 /* ContainsES2015 */ | 2048 /* ContainsDestructuringAssignment */ | + 512 /* ContainsES2015 */ | + 2048 /* ContainsDestructuringAssignment */ | propagateAssignmentPatternFlags(node.left); } } @@ -23155,7 +23188,8 @@ var ts; node.templateSpans = createNodeArray(templateSpans); node.transformFlags |= propagateChildFlags(node.head) | - propagateChildrenFlags(node.templateSpans) | 512 /* ContainsES2015 */; + propagateChildrenFlags(node.templateSpans) | + 512 /* ContainsES2015 */; return node; } // @api @@ -23224,7 +23258,10 @@ var ts; node.asteriskToken = asteriskToken; node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildFlags(node.asteriskToken) | 512 /* ContainsES2015 */ | 64 /* ContainsES2018 */ | 524288 /* ContainsYield */; + propagateChildFlags(node.asteriskToken) | + 512 /* ContainsES2015 */ | + 64 /* ContainsES2018 */ | + 524288 /* ContainsYield */; return node; } // @api @@ -23239,7 +23276,9 @@ var ts; var node = createBaseExpression(221 /* SpreadElement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 512 /* ContainsES2015 */ | 16384 /* ContainsRestOrSpread */; + propagateChildFlags(node.expression) | + 512 /* ContainsES2015 */ | + 16384 /* ContainsRestOrSpread */; return node; } // @api @@ -23276,7 +23315,8 @@ var ts; node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildrenFlags(node.typeArguments) | 512 /* ContainsES2015 */; + propagateChildrenFlags(node.typeArguments) | + 512 /* ContainsES2015 */; return node; } // @api @@ -23293,7 +23333,8 @@ var ts; node.type = type; node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildFlags(node.type) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.type) | + 1 /* ContainsTypeScript */; return node; } // @api @@ -23308,7 +23349,8 @@ var ts; var node = createBaseExpression(226 /* NonNullExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.expression) | + 1 /* ContainsTypeScript */; return node; } // @api @@ -23326,7 +23368,8 @@ var ts; node.flags |= 32 /* OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.expression) | + 1 /* ContainsTypeScript */; return node; } // @api @@ -23370,7 +23413,8 @@ var ts; node.literal = literal; node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildFlags(node.literal) | 512 /* ContainsES2015 */; + propagateChildFlags(node.literal) | + 512 /* ContainsES2015 */; return node; } // @api @@ -23546,7 +23590,8 @@ var ts; propagateChildFlags(node.awaitModifier) | propagateChildFlags(node.initializer) | propagateChildFlags(node.expression) | - propagateChildFlags(node.statement) | 512 /* ContainsES2015 */; + propagateChildFlags(node.statement) | + 512 /* ContainsES2015 */; if (awaitModifier) node.transformFlags |= 64 /* ContainsES2018 */; return node; @@ -23565,7 +23610,8 @@ var ts; var node = createBaseNode(241 /* ContinueStatement */); node.label = asName(label); node.transformFlags |= - propagateChildFlags(node.label) | 2097152 /* ContainsHoistedDeclarationOrCompletion */; + propagateChildFlags(node.label) | + 2097152 /* ContainsHoistedDeclarationOrCompletion */; return node; } // @api @@ -23579,7 +23625,8 @@ var ts; var node = createBaseNode(242 /* BreakStatement */); node.label = asName(label); node.transformFlags |= - propagateChildFlags(node.label) | 2097152 /* ContainsHoistedDeclarationOrCompletion */; + propagateChildFlags(node.label) | + 2097152 /* ContainsHoistedDeclarationOrCompletion */; return node; } // @api @@ -23594,7 +23641,9 @@ var ts; node.expression = expression; // return in an ES2018 async generator must be awaited node.transformFlags |= - propagateChildFlags(node.expression) | 64 /* ContainsES2018 */ | 2097152 /* ContainsHoistedDeclarationOrCompletion */; + propagateChildFlags(node.expression) | + 64 /* ContainsES2018 */ | + 2097152 /* ContainsHoistedDeclarationOrCompletion */; return node; } // @api @@ -23719,10 +23768,12 @@ var ts; node.flags |= flags & 3 /* BlockScoped */; node.declarations = createNodeArray(declarations); node.transformFlags |= - propagateChildrenFlags(node.declarations) | 2097152 /* ContainsHoistedDeclarationOrCompletion */; + propagateChildrenFlags(node.declarations) | + 2097152 /* ContainsHoistedDeclarationOrCompletion */; if (flags & 3 /* BlockScoped */) { node.transformFlags |= - 512 /* ContainsES2015 */ | 131072 /* ContainsBlockScopedBinding */; + 512 /* ContainsES2015 */ | + 131072 /* ContainsBlockScopedBinding */; } return node; } @@ -23741,7 +23792,8 @@ var ts; } else { node.transformFlags |= - propagateChildFlags(node.asteriskToken) | 2097152 /* ContainsHoistedDeclarationOrCompletion */; + propagateChildFlags(node.asteriskToken) | + 2097152 /* ContainsHoistedDeclarationOrCompletion */; if (ts.modifiersToFlags(node.modifiers) & 256 /* Async */) { if (node.asteriskToken) { node.transformFlags |= 64 /* ContainsES2018 */; @@ -23834,7 +23886,8 @@ var ts; var node = createBaseNamedDeclaration(256 /* EnumDeclaration */, decorators, modifiers, name); node.members = createNodeArray(members); node.transformFlags |= - propagateChildrenFlags(node.members) | 1 /* ContainsTypeScript */; + propagateChildrenFlags(node.members) | + 1 /* ContainsTypeScript */; node.transformFlags &= ~16777216 /* ContainsPossibleTopLevelAwait */; // Enum declarations cannot contain `await` return node; } @@ -23860,7 +23913,8 @@ var ts; else { node.transformFlags |= propagateChildFlags(node.name) | - propagateChildFlags(node.body) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.body) | + 1 /* ContainsTypeScript */; } node.transformFlags &= ~16777216 /* ContainsPossibleTopLevelAwait */; // Module declarations cannot contain `await`. return node; @@ -23997,7 +24051,8 @@ var ts; var node = createBaseNode(270 /* NamespaceExport */); node.name = name; node.transformFlags |= - propagateChildFlags(node.name) | 4 /* ContainsESNext */; + propagateChildFlags(node.name) | + 4 /* ContainsESNext */; node.transformFlags &= ~16777216 /* ContainsPossibleTopLevelAwait */; // always parsed in an Await context return node; } @@ -24503,7 +24558,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.openingElement) | propagateChildrenFlags(node.children) | - propagateChildFlags(node.closingElement) | 2 /* ContainsJsx */; + propagateChildFlags(node.closingElement) | + 2 /* ContainsJsx */; return node; } // @api @@ -24523,7 +24579,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.tagName) | propagateChildrenFlags(node.typeArguments) | - propagateChildFlags(node.attributes) | 2 /* ContainsJsx */; + propagateChildFlags(node.attributes) | + 2 /* ContainsJsx */; if (node.typeArguments) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -24546,7 +24603,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.tagName) | propagateChildrenFlags(node.typeArguments) | - propagateChildFlags(node.attributes) | 2 /* ContainsJsx */; + propagateChildFlags(node.attributes) | + 2 /* ContainsJsx */; if (typeArguments) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -24565,7 +24623,8 @@ var ts; var node = createBaseNode(277 /* JsxClosingElement */); node.tagName = tagName; node.transformFlags |= - propagateChildFlags(node.tagName) | 2 /* ContainsJsx */; + propagateChildFlags(node.tagName) | + 2 /* ContainsJsx */; return node; } // @api @@ -24583,7 +24642,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.openingFragment) | propagateChildrenFlags(node.children) | - propagateChildFlags(node.closingFragment) | 2 /* ContainsJsx */; + propagateChildFlags(node.closingFragment) | + 2 /* ContainsJsx */; return node; } // @api @@ -24628,7 +24688,8 @@ var ts; node.initializer = initializer; node.transformFlags |= propagateChildFlags(node.name) | - propagateChildFlags(node.initializer) | 2 /* ContainsJsx */; + propagateChildFlags(node.initializer) | + 2 /* ContainsJsx */; return node; } // @api @@ -24643,7 +24704,8 @@ var ts; var node = createBaseNode(282 /* JsxAttributes */); node.properties = createNodeArray(properties); node.transformFlags |= - propagateChildrenFlags(node.properties) | 2 /* ContainsJsx */; + propagateChildrenFlags(node.properties) | + 2 /* ContainsJsx */; return node; } // @api @@ -24657,7 +24719,8 @@ var ts; var node = createBaseNode(283 /* JsxSpreadAttribute */); node.expression = expression; node.transformFlags |= - propagateChildFlags(node.expression) | 2 /* ContainsJsx */; + propagateChildFlags(node.expression) | + 2 /* ContainsJsx */; return node; } // @api @@ -24673,7 +24736,8 @@ var ts; node.expression = expression; node.transformFlags |= propagateChildFlags(node.dotDotDotToken) | - propagateChildFlags(node.expression) | 2 /* ContainsJsx */; + propagateChildFlags(node.expression) | + 2 /* ContainsJsx */; return node; } // @api @@ -24802,7 +24866,8 @@ var ts; /*modifiers*/ undefined, name); node.objectAssignmentInitializer = objectAssignmentInitializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(objectAssignmentInitializer); node.transformFlags |= - propagateChildFlags(node.objectAssignmentInitializer) | 512 /* ContainsES2015 */; + propagateChildFlags(node.objectAssignmentInitializer) | + 512 /* ContainsES2015 */; return node; } function finishUpdateShorthandPropertyAssignment(updated, original) { @@ -24831,7 +24896,9 @@ var ts; var node = createBaseNode(291 /* SpreadAssignment */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 64 /* ContainsES2018 */ | 32768 /* ContainsObjectRestOrSpread */; + propagateChildFlags(node.expression) | + 64 /* ContainsES2018 */ | + 32768 /* ContainsObjectRestOrSpread */; return node; } // @api @@ -24850,7 +24917,8 @@ var ts; node.initializer = initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= propagateChildFlags(node.name) | - propagateChildFlags(node.initializer) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.initializer) | + 1 /* ContainsTypeScript */; return node; } // @api @@ -25026,7 +25094,8 @@ var ts; node.expression = expression; node.original = original; node.transformFlags |= - propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.expression) | + 1 /* ContainsTypeScript */; ts.setTextRange(node, original); return node; } @@ -30155,23 +30224,20 @@ var ts; return inContext(32768 /* AwaitContext */); } function parseErrorAtCurrentToken(message, arg0) { - return parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0); + parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0); } function parseErrorAtPosition(start, length, message, arg0) { // Don't report another error if it would just be at the same position as the last error. var lastError = ts.lastOrUndefined(parseDiagnostics); - var result; if (!lastError || start !== lastError.start) { - result = ts.createDetachedDiagnostic(fileName, start, length, message, arg0); - parseDiagnostics.push(result); + parseDiagnostics.push(ts.createDetachedDiagnostic(fileName, start, length, message, arg0)); } // Mark that we've encountered an error. We'll set an appropriate bit on the next // node we finish so that it can't be reused incrementally. parseErrorBeforeNextFinishedNode = true; - return result; } function parseErrorAt(start, end, message, arg0) { - return parseErrorAtPosition(start, end - start, message, arg0); + parseErrorAtPosition(start, end - start, message, arg0); } function parseErrorAtRange(range, message, arg0) { parseErrorAt(range.pos, range.end, message, arg0); @@ -30328,16 +30394,6 @@ var ts; parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind)); return false; } - function parseExpectedMatchingBrackets(openKind, closeKind, openPosition) { - if (token() === closeKind) { - nextToken(); - return; - } - var lastError = parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(closeKind)); - if (lastError) { - ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openPosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, ts.tokenToString(openKind), ts.tokenToString(closeKind))); - } - } function parseOptional(t) { if (token() === t) { nextToken(); @@ -30626,7 +30682,7 @@ var ts; case 22 /* OpenBracketToken */: case 41 /* AsteriskToken */: case 25 /* DotDotDotToken */: - case 24 /* DotToken */: + case 24 /* DotToken */: // Not an object literal member, but don't want to close the object (see `tests/cases/fourslash/completionsDotInObjectLiteral.ts`) return true; default: return isLiteralPropertyName(); @@ -30659,7 +30715,7 @@ var ts; case 15 /* ArrayLiteralMembers */: switch (token()) { case 27 /* CommaToken */: - case 24 /* DotToken */: + case 24 /* DotToken */: // Not an array literal member, but don't want to close the array (see `tests/cases/fourslash/completionsDotInArrayLiteralInObjectLiteral.ts`) return true; } // falls through @@ -33621,7 +33677,7 @@ var ts; case 50 /* AmpersandToken */: // foo & case 51 /* BarToken */: // foo | case 19 /* CloseBraceToken */: // foo } - case 1 /* EndOfFileToken */: + case 1 /* EndOfFileToken */: // foo // these cases can't legally follow a type arg list. However, they're not legal // expressions either. The user is probably in the middle of a generic type. So // treat it as such. @@ -33705,11 +33761,10 @@ var ts; } function parseArrayLiteralExpression() { var pos = getNodePos(); - var openBracketPosition = scanner.getTokenPos(); parseExpected(22 /* OpenBracketToken */); var multiLine = scanner.hasPrecedingLineBreak(); var elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement); - parseExpectedMatchingBrackets(22 /* OpenBracketToken */, 23 /* CloseBracketToken */, openBracketPosition); + parseExpected(23 /* CloseBracketToken */); return finishNode(factory.createArrayLiteralExpression(elements, multiLine), pos); } function parseObjectLiteralElement() { @@ -33769,7 +33824,12 @@ var ts; parseExpected(18 /* OpenBraceToken */); var multiLine = scanner.hasPrecedingLineBreak(); var properties = parseDelimitedList(12 /* ObjectLiteralMembers */, parseObjectLiteralElement, /*considerSemicolonAsDelimiter*/ true); - parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBracePosition); + if (!parseExpected(19 /* CloseBraceToken */)) { + var lastError = ts.lastOrUndefined(parseDiagnostics); + if (lastError && lastError.code === ts.Diagnostics._0_expected.code) { + ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here)); + } + } return finishNode(factory.createObjectLiteralExpression(properties, multiLine), pos); } function parseFunctionExpression() { @@ -33843,7 +33903,12 @@ var ts; if (parseExpected(18 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { var multiLine = scanner.hasPrecedingLineBreak(); var statements = parseList(1 /* BlockStatements */, parseStatement); - parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBracePosition); + if (!parseExpected(19 /* CloseBraceToken */)) { + var lastError = ts.lastOrUndefined(parseDiagnostics); + if (lastError && lastError.code === ts.Diagnostics._0_expected.code) { + ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here)); + } + } var result = withJSDoc(finishNode(factory.createBlock(statements, multiLine), pos), hasJSDoc); if (token() === 62 /* EqualsToken */) { parseErrorAtCurrentToken(ts.Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses); @@ -33888,10 +33953,9 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(98 /* IfKeyword */); - var openParenPosition = scanner.getTokenPos(); parseExpected(20 /* OpenParenToken */); var expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition); + parseExpected(21 /* CloseParenToken */); var thenStatement = parseStatement(); var elseStatement = parseOptional(90 /* ElseKeyword */) ? parseStatement() : undefined; return withJSDoc(finishNode(factory.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc); @@ -33902,10 +33966,9 @@ var ts; parseExpected(89 /* DoKeyword */); var statement = parseStatement(); parseExpected(114 /* WhileKeyword */); - var openParenPosition = scanner.getTokenPos(); parseExpected(20 /* OpenParenToken */); var expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition); + parseExpected(21 /* CloseParenToken */); // From: https://mail.mozilla.org/pipermail/es-discuss/2011-August/016188.html // 157 min --- All allen at wirfs-brock.com CONF --- "do{;}while(false)false" prohibited in // spec but allowed in consensus reality. Approved -- this is the de-facto standard whereby @@ -33917,10 +33980,9 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(114 /* WhileKeyword */); - var openParenPosition = scanner.getTokenPos(); parseExpected(20 /* OpenParenToken */); var expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition); + parseExpected(21 /* CloseParenToken */); var statement = parseStatement(); return withJSDoc(finishNode(factory.createWhileStatement(expression, statement), pos), hasJSDoc); } @@ -33987,10 +34049,9 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(115 /* WithKeyword */); - var openParenPosition = scanner.getTokenPos(); parseExpected(20 /* OpenParenToken */); var expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition); + parseExpected(21 /* CloseParenToken */); var statement = doInsideOfContext(16777216 /* InWithStatement */, parseStatement); return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc); } @@ -34693,7 +34754,7 @@ var ts; case 53 /* ExclamationToken */: // Non-null assertion on property name case 58 /* ColonToken */: // Type Annotation for declaration case 62 /* EqualsToken */: // Initializer for declaration - case 57 /* QuestionToken */: + case 57 /* QuestionToken */: // Not valid, but permitted so that it gets caught later on. return true; default: // Covers @@ -35981,7 +36042,8 @@ var ts; hasChildren = true; if (child.kind === 333 /* JSDocTypeTag */) { if (childTypeTag) { - var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); + parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); + var lastError = ts.lastOrUndefined(parseDiagnostics); if (lastError) { ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, 0, 0, ts.Diagnostics.The_tag_was_first_specified_here)); } @@ -43233,7 +43295,8 @@ var ts; // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = prop.kind === 289 /* PropertyAssignment */ || prop.kind === 290 /* ShorthandPropertyAssignment */ || prop.kind === 166 /* MethodDeclaration */ - ? 1 /* Property */ : 2 /* Accessor */; + ? 1 /* Property */ + : 2 /* Accessor */; var existingKind = seen.get(identifier.escapedText); if (!existingKind) { seen.set(identifier.escapedText, currentKind); @@ -43754,7 +43817,7 @@ var ts; case 252 /* FunctionDeclaration */: return bindFunctionDeclaration(node); case 167 /* Constructor */: - return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, 0 /* None */); + return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); case 168 /* GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 46015 /* GetAccessorExcludes */); case 169 /* SetAccessor */: @@ -43847,7 +43910,8 @@ var ts; case 337 /* JSDocPropertyTag */: var propTag = node; var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 308 /* JSDocOptionalType */ ? - 4 /* Property */ | 16777216 /* Optional */ : 4 /* Property */; + 4 /* Property */ | 16777216 /* Optional */ : + 4 /* Property */; return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* PropertyExcludes */); case 335 /* JSDocTypedefTag */: case 328 /* JSDocCallbackTag */: @@ -43885,9 +43949,9 @@ var ts; else { var flags = ts.exportAssignmentIsAlias(node) // An export default clause with an EntityNameExpression or a class expression exports all meanings of that identifier or expression; - ? 2097152 /* Alias */ - // An export default clause with any other expression exports a value - : 4 /* Property */; + ? 2097152 /* Alias */ + // An export default clause with any other expression exports a value + : 4 /* Property */; // If there is an `export default x;` alias declaration, can't `export default` anything else. // (In contrast, you can still have `export default function f() {}` and `export default interface I {}`.) var symbol = declareSymbol(container.symbol.exports, container.symbol, node, flags, 67108863 /* All */); @@ -43996,7 +44060,8 @@ var ts; } // 'module.exports = expr' assignment var flags = ts.exportAssignmentIsAlias(node) - ? 2097152 /* Alias */ : 4 /* Property */ | 1048576 /* ExportValue */ | 512 /* ValueModule */; + ? 2097152 /* Alias */ + : 4 /* Property */ | 1048576 /* ExportValue */ | 512 /* ValueModule */; var symbol = declareSymbol(file.symbol.exports, file.symbol, node, flags | 67108864 /* Assignment */, 0 /* None */); ts.setValueDeclaration(symbol, node); } @@ -46781,7 +46846,7 @@ var ts; case 254 /* InterfaceDeclaration */: case 256 /* EnumDeclaration */: case 255 /* TypeAliasDeclaration */: - case 257 /* ModuleDeclaration */: + case 257 /* ModuleDeclaration */: // For `namespace N { N; }` return true; default: return false; @@ -50706,7 +50771,8 @@ var ts; // A Class + Property merge is made for a `module.exports.Member = class {}`, and it doesn't serialize well as either a class _or_ a property symbol - in fact, _it behaves like an alias!_ // `var` is `FunctionScopedVariable`, `const` and `let` are `BlockScopedVariable`, and `module.exports.thing =` is `Property` var flags = !(symbol.flags & 2 /* BlockScopedVariable */) ? undefined - : isConstVariable(symbol) ? 2 /* Const */ : 1 /* Let */; + : isConstVariable(symbol) ? 2 /* Const */ + : 1 /* Let */; var name = (needsPostExportDefault || !(symbol.flags & 4 /* Property */)) ? localName : getUnusedName(localName, symbol); var textRange = symbol.declarations && ts.find(symbol.declarations, function (d) { return ts.isVariableDeclaration(d); }); if (textRange && ts.isVariableDeclarationList(textRange.parent) && textRange.parent.declarations.length === 1) { @@ -51346,7 +51412,9 @@ var ts; ], 2 /* Const */)); // Inlined JSON types exported with [module.]exports= will already emit an export=, so should use `declare`. // Otherwise, the type itself should be exported. - addResult(statement, target && target.flags & 4 /* Property */ && target.escapedName === "export=" /* ExportEquals */ ? 2 /* Ambient */ : name === varName ? 1 /* Export */ : 0 /* None */); + addResult(statement, target && target.flags & 4 /* Property */ && target.escapedName === "export=" /* ExportEquals */ ? 2 /* Ambient */ + : name === varName ? 1 /* Export */ + : 0 /* None */); } if (isExportAssignmentCompatibleSymbolName) { results.push(ts.factory.createExportAssignment( @@ -56808,7 +56876,8 @@ var ts; return getRestTypeElementFlags(node); case 193 /* NamedTupleMember */: return node.questionToken ? 2 /* Optional */ : - node.dotDotDotToken ? getRestTypeElementFlags(node) : 1 /* Required */; + node.dotDotDotToken ? getRestTypeElementFlags(node) : + 1 /* Required */; default: return 1 /* Required */; } @@ -57385,7 +57454,7 @@ var ts; } function createUnionType(types, aliasSymbol, aliasTypeArguments, origin) { var result = createType(1048576 /* Union */); - result.objectFlags = getPropagatingFlagsOfTypes(types, 98304 /* Nullable */); + result.objectFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 98304 /* Nullable */); result.types = types; result.origin = origin; result.aliasSymbol = aliasSymbol; @@ -57573,7 +57642,7 @@ var ts; } function createIntersectionType(types, aliasSymbol, aliasTypeArguments) { var result = createType(2097152 /* Intersection */); - result.objectFlags = getPropagatingFlagsOfTypes(types, 98304 /* Nullable */); + result.objectFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 98304 /* Nullable */); result.types = types; result.aliasSymbol = aliasSymbol; result.aliasTypeArguments = aliasTypeArguments; @@ -59596,7 +59665,7 @@ var ts; case 209 /* FunctionExpression */: case 210 /* ArrowFunction */: case 166 /* MethodDeclaration */: - case 252 /* FunctionDeclaration */: + case 252 /* FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type return isContextSensitiveFunctionLikeDeclaration(node); case 201 /* ObjectLiteralExpression */: return ts.some(node.properties, isContextSensitive); @@ -60320,7 +60389,8 @@ var ts; } } var related = source.type === target.type ? -1 /* True */ : - source.type && target.type ? compareTypes(source.type, target.type, reportErrors) : 0 /* False */; + source.type && target.type ? compareTypes(source.type, target.type, reportErrors) : + 0 /* False */; if (related === 0 /* False */ && reportErrors) { errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); } @@ -62393,8 +62463,10 @@ var ts; } var sourceIsJSConstructor = source.symbol && isJSConstructor(source.symbol.valueDeclaration); var targetIsJSConstructor = target.symbol && isJSConstructor(target.symbol.valueDeclaration); - var sourceSignatures = getSignaturesOfType(source, (sourceIsJSConstructor && kind === 1 /* Construct */) ? 0 /* Call */ : kind); - var targetSignatures = getSignaturesOfType(target, (targetIsJSConstructor && kind === 1 /* Construct */) ? 0 /* Call */ : kind); + var sourceSignatures = getSignaturesOfType(source, (sourceIsJSConstructor && kind === 1 /* Construct */) ? + 0 /* Call */ : kind); + var targetSignatures = getSignaturesOfType(target, (targetIsJSConstructor && kind === 1 /* Construct */) ? + 0 /* Call */ : kind); if (kind === 1 /* Construct */ && sourceSignatures.length && targetSignatures.length) { var sourceIsAbstract = !!(sourceSignatures[0].flags & 4 /* Abstract */); var targetIsAbstract = !!(targetSignatures[0].flags & 4 /* Abstract */); @@ -63076,7 +63148,8 @@ var ts; function compareTypePredicatesIdentical(source, target, compareTypes) { return !(source && target && typePredicateKindsMatch(source, target)) ? 0 /* False */ : source.type === target.type ? -1 /* True */ : - source.type && target.type ? compareTypes(source.type, target.type) : 0 /* False */; + source.type && target.type ? compareTypes(source.type, target.type) : + 0 /* False */; } function literalTypesWithSameBaseType(types) { var commonBaseType; @@ -64515,7 +64588,9 @@ var ts; // We assign a lower priority to inferences made from types containing non-inferrable // types because we may only have a partial result (i.e. we may have failed to make // reverse inferences for some properties). - inferWithPriority(inferredType, inference.typeParameter, ts.getObjectFlags(source) & 524288 /* NonInferrableType */ ? 16 /* PartialHomomorphicMappedType */ : 8 /* HomomorphicMappedType */); + inferWithPriority(inferredType, inference.typeParameter, ts.getObjectFlags(source) & 524288 /* NonInferrableType */ ? + 16 /* PartialHomomorphicMappedType */ : + 8 /* HomomorphicMappedType */); } } return true; @@ -66962,7 +67037,7 @@ var ts; return !!ts.findAncestor(location, function (e) { return e.parent && ts.isExportAssignment(e.parent) && e.parent.expression === e && ts.isEntityNameExpression(e); }); } function markAliasReferenced(symbol, location) { - if (isNonLocalAlias(symbol, 111551 /* Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) { + if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) { var target = resolveAlias(symbol); if (target.flags & 111551 /* Value */) { // An alias resolving to a const enum cannot be elided if (1) 'isolatedModules' is enabled @@ -70365,7 +70440,8 @@ var ts; } var effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType; var accessFlags = ts.isAssignmentTarget(node) ? - 2 /* Writing */ | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 1 /* NoIndexSignatures */ : 0) : 0 /* None */; + 2 /* Writing */ | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 1 /* NoIndexSignatures */ : 0) : + 0 /* None */; var indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, /*noUncheckedIndexedAccessCandidate*/ undefined, node, accessFlags | 16 /* ExpressionPosition */) || errorType; return checkIndexedAccessIndexType(getFlowTypeOfAccessExpression(node, getNodeLinks(node).resolvedSymbol, indexedAccessType, indexExpression, checkMode), node); } @@ -71275,14 +71351,14 @@ var ts; var i_1 = 0; var _loop_22 = function (c) { var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); }; - var diags_3 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* Normal */, /*reportErrors*/ true, chain_2); - if (diags_3) { - if (diags_3.length <= min_3) { - min_3 = diags_3.length; + var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* Normal */, /*reportErrors*/ true, chain_2); + if (diags_2) { + if (diags_2.length <= min_3) { + min_3 = diags_2.length; minIndex = i_1; } - max = Math.max(max, diags_3.length); - allDiagnostics.push(diags_3); + max = Math.max(max, diags_2.length); + allDiagnostics.push(diags_2); } else { ts.Debug.fail("No error for 3 or fewer overload signatures"); @@ -71293,15 +71369,15 @@ var ts; var c = candidatesForArgumentError_1[_a]; _loop_22(c); } - var diags_2 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics); - ts.Debug.assert(diags_2.length > 0, "No errors reported for 3 or fewer overload signatures"); - var chain = ts.chainDiagnosticMessages(ts.map(diags_2, function (d) { return typeof d.messageText === "string" ? d : d.messageText; }), ts.Diagnostics.No_overload_matches_this_call); + var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics); + ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures"); + var chain = ts.chainDiagnosticMessages(ts.map(diags_3, function (d) { return typeof d.messageText === "string" ? d : d.messageText; }), ts.Diagnostics.No_overload_matches_this_call); // The below is a spread to guarantee we get a new (mutable) array - our `flatMap` helper tries to do "smart" optimizations where it reuses input // arrays and the emptyArray singleton where possible, which is decidedly not what we want while we're still constructing this diagnostic - var related = __spreadArray([], ts.flatMap(diags_2, function (d) { return d.relatedInformation; })); + var related = __spreadArray([], ts.flatMap(diags_3, function (d) { return d.relatedInformation; })); var diag = void 0; - if (ts.every(diags_2, function (d) { return d.start === diags_2[0].start && d.length === diags_2[0].length && d.file === diags_2[0].file; })) { - var _b = diags_2[0], file = _b.file, start = _b.start, length_7 = _b.length; + if (ts.every(diags_3, function (d) { return d.start === diags_3[0].start && d.length === diags_3[0].length && d.file === diags_3[0].file; })) { + var _b = diags_3[0], file = _b.file, start = _b.start, length_7 = _b.length; diag = { file: file, start: start, length: length_7, code: chain.code, category: chain.category, messageText: chain, relatedInformation: related }; } else { @@ -71563,7 +71639,8 @@ var ts; if (ts.isCallChain(node)) { var nonOptionalType = getOptionalExpressionType(funcType, node.expression); callChainFlags = nonOptionalType === funcType ? 0 /* None */ : - ts.isOutermostOptionalChain(node) ? 16 /* IsOuterCallChain */ : 8 /* IsInnerCallChain */; + ts.isOutermostOptionalChain(node) ? 16 /* IsOuterCallChain */ : + 8 /* IsInnerCallChain */; funcType = nonOptionalType; } else { @@ -72340,8 +72417,10 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 /* Function */ - ? 252 /* FunctionDeclaration */ : resolvedRequire.flags & 3 /* Variable */ - ? 250 /* VariableDeclaration */ : 0 /* Unknown */; + ? 252 /* FunctionDeclaration */ + : resolvedRequire.flags & 3 /* Variable */ + ? 250 /* VariableDeclaration */ + : 0 /* Unknown */; if (targetDeclarationKind !== 0 /* Unknown */) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); // function/variable declaration should be ambient @@ -75999,7 +76078,7 @@ var ts; case 199 /* BindingElement */: case 252 /* FunctionDeclaration */: case 266 /* ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 - case 78 /* Identifier */: + case 78 /* Identifier */: // https://github.com/microsoft/TypeScript/issues/36098 // Identifiers are used as declarations of assignment declarations whose parents may be // SyntaxKind.CallExpression - `Object.defineProperty(thing, "aField", {value: 42});` // SyntaxKind.ElementAccessExpression - `thing["aField"] = 42;` or `thing["aField"];` (with a doc comment on it) @@ -77275,7 +77354,12 @@ var ts; if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) { return false; } - var interestingFlags = 8 /* Private */ | 16 /* Protected */ | 256 /* Async */ | 128 /* Abstract */ | 64 /* Readonly */ | 32 /* Static */; + var interestingFlags = 8 /* Private */ | + 16 /* Protected */ | + 256 /* Async */ | + 128 /* Abstract */ | + 64 /* Readonly */ | + 32 /* Static */; return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags); } function checkVariableDeclaration(node) { @@ -78996,9 +79080,9 @@ var ts; ts.forEach(properties, function (p) { seen.set(p.escapedName, p); }); for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { var base = baseTypes_2[_i]; - var properties_4 = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)); - for (var _a = 0, properties_5 = properties_4; _a < properties_5.length; _a++) { - var prop = properties_5[_a]; + var properties_5 = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)); + for (var _a = 0, properties_4 = properties_5; _a < properties_4.length; _a++) { + var prop = properties_4[_a]; var existing = seen.get(prop.escapedName); if (existing && !isPropertyIdenticalTo(existing, prop)) { seen.delete(prop.escapedName); @@ -80701,7 +80785,7 @@ var ts; } } if (name.parent.kind === 173 /* TypePredicate */) { - return resolveEntityName(name, 1 /* FunctionScopedVariable */); + return resolveEntityName(name, /*meaning*/ 1 /* FunctionScopedVariable */); } return undefined; } @@ -81090,7 +81174,7 @@ var ts; var symbol = getReferencedValueSymbol(node); // We should only get the declaration of an alias if there isn't a local value // declaration for the symbol - if (isNonLocalAlias(symbol, 111551 /* Value */) && !getTypeOnlyAliasDeclaration(symbol)) { + if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* Value */) && !getTypeOnlyAliasDeclaration(symbol)) { return getDeclarationOfAliasSymbol(symbol); } } @@ -88643,7 +88727,9 @@ var ts; } function visitPrefixUnaryExpression(node) { if (shouldTransformPrivateElements && ts.isPrivateIdentifierPropertyAccessExpression(node.operand)) { - var operator = node.operator === 45 /* PlusPlusToken */ ? 39 /* PlusToken */ : node.operator === 46 /* MinusMinusToken */ ? 40 /* MinusToken */ : undefined; + var operator = node.operator === 45 /* PlusPlusToken */ ? + 39 /* PlusToken */ : node.operator === 46 /* MinusMinusToken */ ? + 40 /* MinusToken */ : undefined; var info = void 0; if (operator && (info = accessPrivateIdentifier(node.operand.name))) { var receiver = ts.visitNode(node.operand.expression, visitor, ts.isExpression); @@ -88656,7 +88742,9 @@ var ts; } function visitPostfixUnaryExpression(node, valueIsDiscarded) { if (shouldTransformPrivateElements && ts.isPrivateIdentifierPropertyAccessExpression(node.operand)) { - var operator = node.operator === 45 /* PlusPlusToken */ ? 39 /* PlusToken */ : node.operator === 46 /* MinusMinusToken */ ? 40 /* MinusToken */ : undefined; + var operator = node.operator === 45 /* PlusPlusToken */ ? + 39 /* PlusToken */ : node.operator === 46 /* MinusMinusToken */ ? + 40 /* MinusToken */ : undefined; var info = void 0; if (operator && (info = accessPrivateIdentifier(node.operand.name))) { var receiver = ts.visitNode(node.operand.expression, visitor, ts.isExpression); @@ -88796,10 +88884,11 @@ var ts; return ts.visitEachChild(node, visitor, context); } var staticProperties = ts.getProperties(node, /*requireInitializer*/ false, /*isStatic*/ true); + var pendingPrivateStateAssignment; if (shouldTransformPrivateElements && ts.some(node.members, function (m) { return ts.hasStaticModifier(m) && !!m.name && ts.isPrivateIdentifier(m.name); })) { var temp = factory.createTempVariable(hoistVariableDeclaration, /* reservedInNestedScopes */ true); getPrivateIdentifierEnvironment().classConstructor = factory.cloneNode(temp); - getPendingExpressions().push(factory.createAssignment(temp, factory.getInternalName(node))); + pendingPrivateStateAssignment = factory.createAssignment(temp, factory.getInternalName(node)); } var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 103 /* NullKeyword */); @@ -88808,6 +88897,9 @@ var ts; /*decorators*/ undefined, node.modifiers, node.name, /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)) ]; + if (pendingPrivateStateAssignment) { + getPendingExpressions().unshift(pendingPrivateStateAssignment); + } // Write any pending expressions from elided or moved computed property names if (ts.some(pendingExpressions)) { statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))); @@ -90371,7 +90463,9 @@ var ts; return ts.visitEachChild(node, expressionResultIsUnused ? visitorWithUnusedExpressionResult : visitor, context); } function visitSourceFile(node) { - var ancestorFacts = enterSubtree(2 /* SourceFileExcludes */, ts.isEffectiveStrictModeSourceFile(node, compilerOptions) ? 0 /* StrictModeSourceFileIncludes */ : 1 /* SourceFileIncludes */); + var ancestorFacts = enterSubtree(2 /* SourceFileExcludes */, ts.isEffectiveStrictModeSourceFile(node, compilerOptions) ? + 0 /* StrictModeSourceFileIncludes */ : + 1 /* SourceFileIncludes */); exportedVariableStatement = false; var visited = ts.visitEachChild(node, visitor, context); var statement = ts.concatenate(visited.statements, taggedTemplateStringDeclarations && [ @@ -101289,7 +101383,13 @@ var ts; }); } ts.isInternalDeclaration = isInternalDeclaration; - var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */; + var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | + 2048 /* WriteClassExpressionAsTypeLiteral */ | + 4096 /* UseTypeOfFunction */ | + 8 /* UseStructuralFallback */ | + 524288 /* AllowEmptyTuple */ | + 4 /* GenerateNamesForShadowedTypeParams */ | + 1 /* NoTruncation */; /** * Transforms a ts file into a .d.ts file * This process requires type information, which is retrieved through the emit resolver. Because of this, @@ -102190,7 +102290,7 @@ var ts; } var previousNeedsDeclare = needsDeclare; switch (input.kind) { - case 255 /* TypeAliasDeclaration */: + case 255 /* TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all return cleanup(factory.updateTypeAliasDeclaration(input, /*decorators*/ undefined, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); case 254 /* InterfaceDeclaration */: { @@ -103278,8 +103378,11 @@ var ts; if (configFile.options.emitDeclarationOnly) return undefined; var isJsonFile = ts.fileExtensionIs(inputFileName, ".json" /* Json */); - var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory), isJsonFile ? ".json" /* Json */ : - configFile.options.jsx === 1 /* Preserve */ && (ts.fileExtensionIs(inputFileName, ".tsx" /* Tsx */) || ts.fileExtensionIs(inputFileName, ".jsx" /* Jsx */)) ? ".jsx" /* Jsx */ : ".js" /* Js */); + var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory), isJsonFile ? + ".json" /* Json */ : + configFile.options.jsx === 1 /* Preserve */ && (ts.fileExtensionIs(inputFileName, ".tsx" /* Tsx */) || ts.fileExtensionIs(inputFileName, ".jsx" /* Jsx */)) ? + ".jsx" /* Jsx */ : + ".js" /* Js */); return !isJsonFile || ts.comparePaths(inputFileName, outputFileName, ts.Debug.checkDefined(configFile.options.configFilePath), ignoreCase) !== 0 /* EqualTo */ ? outputFileName : undefined; @@ -104846,7 +104949,9 @@ var ts; var pos = getTextPosWithWriteLine(); writeUnparsedNode(unparsed); if (bundleFileInfo) { - updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 295 /* UnparsedText */ ? "text" /* Text */ : "internal" /* Internal */); + updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 295 /* UnparsedText */ ? + "text" /* Text */ : + "internal" /* Internal */); } } // SyntaxKind.UnparsedSyntheticReference @@ -114368,7 +114473,8 @@ var ts; return { relativePreference: importModuleSpecifierPreference === "relative" ? 0 /* Relative */ : importModuleSpecifierPreference === "non-relative" ? 1 /* NonRelative */ : - importModuleSpecifierPreference === "project-relative" ? 3 /* ExternalNonRelative */ : 2 /* Shortest */, + importModuleSpecifierPreference === "project-relative" ? 3 /* ExternalNonRelative */ : + 2 /* Shortest */, ending: getEnding(), }; function getEnding() { @@ -114376,14 +114482,16 @@ var ts; case "minimal": return 0 /* Minimal */; case "index": return 1 /* Index */; case "js": return 2 /* JsExtension */; - default: return usesJsExtensionOnImports(importingSourceFile) ? 2 /* JsExtension */ : ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeJs ? 1 /* Index */ : 0 /* Minimal */; + default: return usesJsExtensionOnImports(importingSourceFile) ? 2 /* JsExtension */ + : ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeJs ? 1 /* Index */ : 0 /* Minimal */; } } } function getPreferencesForUpdate(compilerOptions, oldImportSpecifier) { return { relativePreference: ts.isExternalModuleNameRelative(oldImportSpecifier) ? 0 /* Relative */ : 1 /* NonRelative */, - ending: ts.hasJSFileExtension(oldImportSpecifier) ? 2 /* JsExtension */ : + ending: ts.hasJSFileExtension(oldImportSpecifier) ? + 2 /* JsExtension */ : ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeJs || ts.endsWith(oldImportSpecifier, "index") ? 1 /* Index */ : 0 /* Minimal */, }; } @@ -118863,8 +118971,10 @@ var ts; } function getKindOfVariableDeclaration(v) { return ts.isVarConst(v) - ? "const" /* constElement */ : ts.isLet(v) - ? "let" /* letElement */ : "var" /* variableElement */; + ? "const" /* constElement */ + : ts.isLet(v) + ? "let" /* letElement */ + : "var" /* variableElement */; } } ts.getNodeKind = getNodeKind; @@ -120798,10 +120908,10 @@ var ts; var delta = 0; var lastPos = -1; for (var _i = 0, edits_1 = edits; _i < edits_1.length; _i++) { - var _a = edits_1[_i], fileName = _a.fileName, textChanges_1 = _a.textChanges; + var _a = edits_1[_i], fileName = _a.fileName, textChanges_2 = _a.textChanges; ts.Debug.assert(fileName === renameFilename); - for (var _b = 0, textChanges_2 = textChanges_1; _b < textChanges_2.length; _b++) { - var change = textChanges_2[_b]; + for (var _b = 0, textChanges_1 = textChanges_2; _b < textChanges_1.length; _b++) { + var change = textChanges_1[_b]; var span = change.span, newText = change.newText; var index = indexInTextChange(newText, name); if (index !== -1) { @@ -123624,6 +123734,8 @@ var ts; return jsdocCompletionInfo(ts.JsDoc.getJSDocTagCompletions()); case 3 /* JsDocParameterName */: return jsdocCompletionInfo(ts.JsDoc.getJSDocParameterNameCompletions(completionData.tag)); + case 4 /* Keywords */: + return specificKeywordCompletionInfo(completionData.keywords); default: return ts.Debug.assertNever(completionData); } @@ -123632,6 +123744,19 @@ var ts; function jsdocCompletionInfo(entries) { return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries }; } + function specificKeywordCompletionInfo(keywords) { + return { + isGlobalCompletion: false, + isMemberCompletion: false, + isNewIdentifierLocation: false, + entries: keywords.map(function (k) { return ({ + name: ts.tokenToString(k), + kind: "keyword" /* keyword */, + kindModifiers: "" /* none */, + sortText: SortText.GlobalsOrKeywords, + }); }), + }; + } function getOptionalReplacementSpan(location) { // StringLiteralLike locations are handled separately in stringCompletions.ts return (location === null || location === void 0 ? void 0 : location.kind) === 78 /* Identifier */ ? ts.createTextSpanFromNode(location) : undefined; @@ -123858,7 +123983,8 @@ var ts; var replacementSpan = ts.createTextSpanFromNode(importCompletionNode, sourceFile); var quotedModuleSpecifier = ts.quote(sourceFile, preferences, origin.moduleSpecifier); var exportKind = origin.isDefaultExport ? 1 /* Default */ : - origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : 0 /* Named */; + origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : + 0 /* Named */; var tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : ""; var importKind = ts.codefix.getImportKind(sourceFile, exportKind, options); var suffix = useSemicolons ? ";" : ""; @@ -124055,6 +124181,8 @@ var ts; return ts.JsDoc.getJSDocTagCompletionDetails(name); case 3 /* JsDocParameterName */: return ts.JsDoc.getJSDocParameterNameCompletionDetails(name); + case 4 /* Keywords */: + return request.keywords.indexOf(ts.stringToToken(name)) > -1 ? createSimpleDetails(name, "keyword" /* keyword */, ts.SymbolDisplayPartKind.keyword) : undefined; default: return ts.Debug.assertNever(request); } @@ -124113,6 +124241,7 @@ var ts; CompletionDataKind[CompletionDataKind["JsDocTagName"] = 1] = "JsDocTagName"; CompletionDataKind[CompletionDataKind["JsDocTag"] = 2] = "JsDocTag"; CompletionDataKind[CompletionDataKind["JsDocParameterName"] = 3] = "JsDocParameterName"; + CompletionDataKind[CompletionDataKind["Keywords"] = 4] = "Keywords"; })(CompletionDataKind || (CompletionDataKind = {})); var CompletionKind; (function (CompletionKind) { @@ -124167,7 +124296,7 @@ var ts; } } function getFirstSymbolInChain(symbol, enclosingDeclaration, checker) { - var chain = checker.getAccessibleSymbolChain(symbol, enclosingDeclaration, 67108863 /* All */, /*useOnlyExternalAliasing*/ false); + var chain = checker.getAccessibleSymbolChain(symbol, enclosingDeclaration, /*meaning*/ 67108863 /* All */, /*useOnlyExternalAliasing*/ false); if (chain) return ts.first(chain); return symbol.parent && (isModuleSymbol(symbol.parent) ? symbol : getFirstSymbolInChain(symbol.parent, enclosingDeclaration, checker)); @@ -124273,13 +124402,17 @@ var ts; var importCompletionNode; var location = ts.getTouchingPropertyName(sourceFile, position); if (contextToken) { + var importCompletionCandidate = getImportCompletionNode(contextToken); + if (importCompletionCandidate === 153 /* FromKeyword */) { + return { kind: 4 /* Keywords */, keywords: [153 /* FromKeyword */] }; + } // Import statement completions use `insertText`, and also require the `data` property of `CompletionEntryIdentifier` // added in TypeScript 4.3 to be sent back from the client during `getCompletionEntryDetails`. Since this feature // is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients // to opt in with the `includeCompletionsForImportStatements` user preference. - importCompletionNode = preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText - ? getImportCompletionNode(contextToken) - : undefined; + if (importCompletionCandidate && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) { + importCompletionNode = importCompletionCandidate; + } // Bail out if this is a known invalid completion location if (!importCompletionNode && isCompletionListBlocker(contextToken)) { log("Returning an empty list because completion was requested in an invalid position."); @@ -124755,7 +124888,8 @@ var ts; collectAutoImports(/*resolveModuleSpecifier*/ false); if (isTypeOnly) { keywordFilters = contextToken && ts.isAssertionExpression(contextToken.parent) - ? 6 /* TypeAssertionKeywords */ : 7 /* TypeKeywords */; + ? 6 /* TypeAssertionKeywords */ + : 7 /* TypeKeywords */; } } function shouldOfferImportCompletions() { @@ -124986,7 +125120,7 @@ var ts; || containingNodeKind === 172 /* IndexSignature */ // [ | : string ] || containingNodeKind === 159 /* ComputedPropertyName */; // [ | /* this can become an index signature */ case 139 /* ModuleKeyword */: // module | - case 140 /* NamespaceKeyword */: + case 140 /* NamespaceKeyword */: // namespace | return true; case 24 /* DotToken */: return containingNodeKind === 257 /* ModuleDeclaration */; // module A.| @@ -125235,7 +125369,7 @@ var ts; var parent = contextToken.parent; switch (contextToken.kind) { case 18 /* OpenBraceToken */: // const x = { | - case 27 /* CommaToken */: + case 27 /* CommaToken */: // const x = { a: 0, | if (ts.isObjectLiteralExpression(parent) || ts.isObjectBindingPattern(parent)) { return parent; } @@ -125414,7 +125548,7 @@ var ts; case 118 /* LetKeyword */: case 84 /* ConstKeyword */: case 135 /* InferKeyword */: - case 149 /* TypeKeyword */: + case 149 /* TypeKeyword */: // type htm| return true; case 41 /* AsteriskToken */: return ts.isFunctionLike(contextToken.parent) && !ts.isMethodDeclaration(contextToken.parent); @@ -125707,7 +125841,7 @@ var ts; // TODO: GH#18169 return { name: JSON.stringify(name), needsConvertPropertyAccess: false }; case 2 /* PropertyAccess */: - case 1 /* Global */: + case 1 /* Global */: // For a 'this.' completion it will be in a global context, but may have a non-identifier name. // Don't add a completion for a name starting with a space. See https://github.com/Microsoft/TypeScript/pull/20547 return name.charCodeAt(0) === 32 /* space */ ? undefined : { name: name, needsConvertPropertyAccess: true }; case 5 /* None */: @@ -125903,16 +126037,16 @@ var ts; return ts.findAncestor(contextToken, ts.isClassLike); } switch (contextToken.kind) { - case 62 /* EqualsToken */: + case 62 /* EqualsToken */: // class c { public prop = | /* global completions */ } return undefined; case 26 /* SemicolonToken */: // class c {getValue(): number; | } - case 19 /* CloseBraceToken */: + case 19 /* CloseBraceToken */: // class c { method() { } | } // class c { method() { } b| } return isFromObjectTypeDeclaration(location) && location.parent.name === location ? location.parent.parent : ts.tryCast(location, ts.isObjectTypeDeclaration); case 18 /* OpenBraceToken */: // class c { | - case 27 /* CommaToken */: + case 27 /* CommaToken */: // class c {getValue(): number, | } return ts.tryCast(contextToken.parent, ts.isObjectTypeDeclaration); default: if (!isFromObjectTypeDeclaration(contextToken)) { @@ -126032,16 +126166,20 @@ var ts; } function getImportCompletionNode(contextToken) { var candidate = getCandidate(); - return candidate && ts.rangeIsOnSingleLine(candidate, candidate.getSourceFile()) ? candidate : undefined; + return candidate === 153 /* FromKeyword */ || candidate && ts.rangeIsOnSingleLine(candidate, candidate.getSourceFile()) ? candidate : undefined; function getCandidate() { var parent = contextToken.parent; if (ts.isImportEqualsDeclaration(parent)) { return isModuleSpecifierMissingOrEmpty(parent.moduleReference) ? parent : undefined; } if (ts.isNamedImports(parent) || ts.isNamespaceImport(parent)) { - return isModuleSpecifierMissingOrEmpty(parent.parent.parent.moduleSpecifier) && (ts.isNamespaceImport(parent) || parent.elements.length < 2) && !parent.parent.name - ? parent.parent.parent - : undefined; + if (isModuleSpecifierMissingOrEmpty(parent.parent.parent.moduleSpecifier) && (ts.isNamespaceImport(parent) || parent.elements.length < 2) && !parent.parent.name) { + // At `import { ... } |` or `import * as Foo |`, the only possible completion is `from` + return contextToken.kind === 19 /* CloseBraceToken */ || contextToken.kind === 78 /* Identifier */ + ? 153 /* FromKeyword */ + : parent.parent.parent; + } + return undefined; } if (ts.isImportKeyword(contextToken) && ts.isSourceFile(parent)) { // A lone import keyword with nothing following it does not parse as a statement at all @@ -126778,7 +126916,7 @@ var ts; } } break; - case 78 /* Identifier */: + case 78 /* Identifier */: // for 'const x = require("y"); break; // TODO: GH#23879 case 261 /* ImportEqualsDeclaration */: handleNamespaceImport(direct, direct.name, ts.hasSyntacticModifier(direct, 1 /* Export */), /*alreadyAddedDirect*/ false); @@ -131433,9 +131571,11 @@ var ts; return ts.isFunctionExpression(node) || ts.isFunctionDeclaration(node) || ts.isVariableDeclaration(node); } var bAssignmentDeclarationKind = ts.isBinaryExpression(b.node) || ts.isCallExpression(b.node) ? - ts.getAssignmentDeclarationKind(b.node) : 0 /* None */; + ts.getAssignmentDeclarationKind(b.node) : + 0 /* None */; var aAssignmentDeclarationKind = ts.isBinaryExpression(a.node) || ts.isCallExpression(a.node) ? - ts.getAssignmentDeclarationKind(a.node) : 0 /* None */; + ts.getAssignmentDeclarationKind(a.node) : + 0 /* None */; // We treat this as an es5 class and merge the nodes in in one of several cases if ((isEs5ClassMember[bAssignmentDeclarationKind] && isEs5ClassMember[aAssignmentDeclarationKind]) // merge two class elements || (isPossibleConstructor(a.node) && isEs5ClassMember[bAssignmentDeclarationKind]) // ctor function & member @@ -132738,7 +132878,8 @@ var ts; return ts.min(a, b, compareMatches); } function compareMatches(a, b) { - return a === undefined ? 1 /* GreaterThan */ : b === undefined ? -1 /* LessThan */ : ts.compareValues(a.kind, b.kind) || ts.compareBooleans(!a.isCaseSensitive, !b.isCaseSensitive); + return a === undefined ? 1 /* GreaterThan */ : b === undefined ? -1 /* LessThan */ + : ts.compareValues(a.kind, b.kind) || ts.compareBooleans(!a.isCaseSensitive, !b.isCaseSensitive); } function partStartsWith(candidate, candidateSpan, pattern, ignoreCase, patternSpan) { if (patternSpan === void 0) { patternSpan = { start: 0, length: pattern.length }; } @@ -134771,7 +134912,8 @@ var ts; } var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol); if (flags & 32 /* Class */) { - return ts.getDeclarationOfKind(symbol, 222 /* ClassExpression */) ? "local class" /* localClassElement */ : "class" /* classElement */; + return ts.getDeclarationOfKind(symbol, 222 /* ClassExpression */) ? + "local class" /* localClassElement */ : "class" /* classElement */; } if (flags & 384 /* Enum */) return "enum" /* enumElement */; @@ -134874,7 +135016,8 @@ var ts; var _a = symbol.declarations, declaration = _a[0], declarations = _a.slice(1); // omit deprecated flag if some declarations are not deprecated var excludeFlags = ts.length(declarations) && isDeprecatedDeclaration(declaration) && ts.some(declarations, function (d) { return !isDeprecatedDeclaration(d); }) - ? 8192 /* Deprecated */ : 0 /* None */; + ? 8192 /* Deprecated */ + : 0 /* None */; var modifiers = ts.getNodeModifiers(declaration, excludeFlags); if (modifiers) { return modifiers.split(","); @@ -135755,7 +135898,8 @@ var ts; shouldRescanTemplateToken(n) ? 3 /* RescanTemplateToken */ : shouldRescanJsxIdentifier(n) ? 4 /* RescanJsxIdentifier */ : shouldRescanJsxText(n) ? 5 /* RescanJsxText */ : - shouldRescanJsxAttributeValue(n) ? 6 /* RescanJsxAttributeValue */ : 0 /* Scan */; + shouldRescanJsxAttributeValue(n) ? 6 /* RescanJsxAttributeValue */ : + 0 /* Scan */; if (lastTokenInfo && expectedScanAction === lastScanAction) { // readTokenInfo was called before with the same expected scan action. // No need to re-scan text, return existing 'lastTokenInfo' @@ -135936,14 +136080,8 @@ var ts; var binaryKeywordOperators = [100 /* InKeyword */, 101 /* InstanceOfKeyword */, 157 /* OfKeyword */, 126 /* AsKeyword */, 137 /* IsKeyword */]; var unaryPrefixOperators = [45 /* PlusPlusToken */, 46 /* MinusMinusToken */, 54 /* TildeToken */, 53 /* ExclamationToken */]; var unaryPrefixExpressions = [ - 8 /* NumericLiteral */, - 9 /* BigIntLiteral */, - 78 /* Identifier */, - 20 /* OpenParenToken */, - 22 /* OpenBracketToken */, - 18 /* OpenBraceToken */, - 107 /* ThisKeyword */, - 102 /* NewKeyword */ + 8 /* NumericLiteral */, 9 /* BigIntLiteral */, 78 /* Identifier */, 20 /* OpenParenToken */, + 22 /* OpenBracketToken */, 18 /* OpenBraceToken */, 107 /* ThisKeyword */, 102 /* NewKeyword */ ]; var unaryPreincrementExpressions = [78 /* Identifier */, 20 /* OpenParenToken */, 107 /* ThisKeyword */, 102 /* NewKeyword */]; var unaryPostincrementExpressions = [78 /* Identifier */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 102 /* NewKeyword */]; @@ -136374,7 +136512,7 @@ var ts; // case SyntaxKind.SimpleArrowFunctionExpression: // case SyntaxKind.ParenthesizedArrowFunctionExpression: // falls through - case 254 /* InterfaceDeclaration */: + case 254 /* InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one return true; } return false; @@ -137264,7 +137402,7 @@ var ts; // if there are any tokens that logically belong to node and interleave child nodes // such tokens will be consumed in processChildNode for the child that follows them ts.forEachChild(node, function (child) { - processChildNode(child, -1 /* Unknown */, node, nodeDynamicIndentation, nodeStartLine, undecoratedNodeStartLine, /*isListItem*/ false); + processChildNode(child, /*inheritedIndentation*/ -1 /* Unknown */, node, nodeDynamicIndentation, nodeStartLine, undecoratedNodeStartLine, /*isListItem*/ false); }, function (nodes) { processChildNodes(nodes, node, nodeStartLine, nodeDynamicIndentation); }); @@ -137435,7 +137573,8 @@ var ts; } if (indentToken) { var tokenIndentation = (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) ? - dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind, container, !!isListEndToken) : -1 /* Unknown */; + dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind, container, !!isListEndToken) : + -1 /* Unknown */; var indentNextTokenOrTrivia = true; if (currentTokenInfo.leadingTrivia) { var commentIndentation_1 = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation, container); @@ -141263,7 +141402,7 @@ var ts; // do not produce a transformed statement for a null argument break; case 202 /* PropertyAccessExpression */: - case 78 /* Identifier */: + case 78 /* Identifier */: // identifier includes undefined if (!argName) { // undefined was argument passed to promise handler break; @@ -162759,7 +162898,8 @@ var ts; } function directoryHasPackageJson(directory) { return packageJsons.has(ts.combinePaths(directory, "package.json")) ? -1 /* True */ : - directoriesWithoutPackageJson.has(directory) ? 0 /* False */ : 3 /* Maybe */; + directoriesWithoutPackageJson.has(directory) ? 0 /* False */ : + 3 /* Maybe */; } } server.createPackageJsonCache = createPackageJsonCache; diff --git a/lib/typescript.js b/lib/typescript.js index 6f5f1ca180fe6..d1ed99912c034 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -290,7 +290,7 @@ var ts; // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types - ts.version = "4.3.1-rc"; + ts.version = "4.3.2"; /* @internal */ var Comparison; (function (Comparison) { @@ -1847,7 +1847,8 @@ var ts; return a === b ? 0 /* EqualTo */ : a === undefined ? -1 /* LessThan */ : b === undefined ? 1 /* GreaterThan */ : - a < b ? -1 /* LessThan */ : 1 /* GreaterThan */; + a < b ? -1 /* LessThan */ : + 1 /* GreaterThan */; } /** * Compare two numeric values for their order relative to each other. @@ -7862,7 +7863,8 @@ var ts; if (ts.sys && ts.sys.getEnvironmentVariable) { setCustomPollingValues(ts.sys); ts.Debug.setAssertionLevel(/^development$/i.test(ts.sys.getEnvironmentVariable("NODE_ENV")) - ? 1 /* Normal */ : 0 /* None */); + ? 1 /* Normal */ + : 0 /* None */); } if (ts.sys && ts.sys.debugMode) { ts.Debug.isDebugging = true; @@ -7881,7 +7883,7 @@ var ts; Identifier_expected: diag(1003, ts.DiagnosticCategory.Error, "Identifier_expected_1003", "Identifier expected."), _0_expected: diag(1005, ts.DiagnosticCategory.Error, "_0_expected_1005", "'{0}' expected."), A_file_cannot_have_a_reference_to_itself: diag(1006, ts.DiagnosticCategory.Error, "A_file_cannot_have_a_reference_to_itself_1006", "A file cannot have a reference to itself."), - The_parser_expected_to_find_a_1_to_match_the_0_token_here: diag(1007, ts.DiagnosticCategory.Error, "The_parser_expected_to_find_a_1_to_match_the_0_token_here_1007", "The parser expected to find a '{1}' to match the '{0}' token here."), + The_parser_expected_to_find_a_to_match_the_token_here: diag(1007, ts.DiagnosticCategory.Error, "The_parser_expected_to_find_a_to_match_the_token_here_1007", "The parser expected to find a '}' to match the '{' token here."), Trailing_comma_not_allowed: diag(1009, ts.DiagnosticCategory.Error, "Trailing_comma_not_allowed_1009", "Trailing comma not allowed."), Asterisk_Slash_expected: diag(1010, ts.DiagnosticCategory.Error, "Asterisk_Slash_expected_1010", "'*/' expected."), An_element_access_expression_should_take_an_argument: diag(1011, ts.DiagnosticCategory.Error, "An_element_access_expression_should_take_an_argument_1011", "An element access expression should take an argument."), @@ -13202,7 +13204,7 @@ var ts; case 105 /* SuperKeyword */: case 226 /* NonNullExpression */: case 227 /* MetaProperty */: - case 99 /* ImportKeyword */: + case 99 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression return true; default: return false; @@ -16275,7 +16277,8 @@ var ts; case 217 /* BinaryExpression */: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? - binaryOperator === 62 /* EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* Definite */ : 2 /* Compound */ : 0 /* None */; + binaryOperator === 62 /* EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* Definite */ : 2 /* Compound */ : + 0 /* None */; case 215 /* PrefixUnaryExpression */: case 216 /* PostfixUnaryExpression */: var unaryOperator = parent.operator; @@ -18700,7 +18703,8 @@ var ts; if (getCheckFlags(s) & 6 /* Synthetic */) { var checkFlags = s.checkFlags; var accessModifier = checkFlags & 1024 /* ContainsPrivate */ ? 8 /* Private */ : - checkFlags & 256 /* ContainsPublic */ ? 4 /* Public */ : 16 /* Protected */; + checkFlags & 256 /* ContainsPublic */ ? 4 /* Public */ : + 16 /* Protected */; var staticModifier = checkFlags & 2048 /* ContainsStatic */ ? 32 /* Static */ : 0; return accessModifier | staticModifier; } @@ -19232,7 +19236,8 @@ var ts; } function compareDiagnostics(d1, d2) { return compareDiagnosticsSkipRelatedInformation(d1, d2) || - compareRelatedInformation(d1, d2) || 0 /* EqualTo */; + compareRelatedInformation(d1, d2) || + 0 /* EqualTo */; } ts.compareDiagnostics = compareDiagnostics; function compareDiagnosticsSkipRelatedInformation(d1, d2) { @@ -19240,7 +19245,8 @@ var ts; ts.compareValues(d1.start, d2.start) || ts.compareValues(d1.length, d2.length) || ts.compareValues(d1.code, d2.code) || - compareMessageText(d1.messageText, d2.messageText) || 0 /* EqualTo */; + compareMessageText(d1.messageText, d2.messageText) || + 0 /* EqualTo */; } ts.compareDiagnosticsSkipRelatedInformation = compareDiagnosticsSkipRelatedInformation; function compareRelatedInformation(d1, d2) { @@ -20092,15 +20098,15 @@ var ts; var log2Base; switch (stringValue.charCodeAt(1)) { // "x" in "0x123" case 98 /* b */: - case 66 /* B */: + case 66 /* B */: // 0b or 0B log2Base = 1; break; case 111 /* o */: - case 79 /* O */: + case 79 /* O */: // 0o or 0O log2Base = 3; break; case 120 /* x */: - case 88 /* X */: + case 88 /* X */: // 0x or 0X log2Base = 4; break; default: // already in decimal; omit trailing "n" @@ -21767,7 +21773,8 @@ var ts; case 129 /* AsyncKeyword */: // 'async' modifier is ES2017 (async functions) or ES2018 (async generators) transformFlags = - 128 /* ContainsES2017 */ | 64 /* ContainsES2018 */; + 128 /* ContainsES2017 */ | + 64 /* ContainsES2018 */; break; case 122 /* PublicKeyword */: case 120 /* PrivateKeyword */: @@ -21787,7 +21794,7 @@ var ts; case 148 /* SymbolKeyword */: case 113 /* VoidKeyword */: case 152 /* UnknownKeyword */: - case 150 /* UndefinedKeyword */: + case 150 /* UndefinedKeyword */: // `undefined` is an Identifier in the expression case. transformFlags = 1 /* ContainsTypeScript */; break; case 123 /* StaticKeyword */: @@ -21900,7 +21907,9 @@ var ts; var node = createBaseNode(159 /* ComputedPropertyName */); node.expression = parenthesizerRules().parenthesizeExpressionOfComputedPropertyName(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 512 /* ContainsES2015 */ | 65536 /* ContainsComputedPropertyName */; + propagateChildFlags(node.expression) | + 512 /* ContainsES2015 */ | + 65536 /* ContainsComputedPropertyName */; return node; } // @api @@ -21968,7 +21977,9 @@ var ts; var node = createBaseNode(162 /* Decorator */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */ | 4096 /* ContainsTypeScriptClassSyntax */; + propagateChildFlags(node.expression) | + 1 /* ContainsTypeScript */ | + 4096 /* ContainsTypeScriptClassSyntax */; return node; } // @api @@ -22005,7 +22016,8 @@ var ts; node.exclamationToken = questionOrExclamationToken && ts.isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.transformFlags |= propagateChildFlags(node.questionToken) | - propagateChildFlags(node.exclamationToken) | 8388608 /* ContainsClassFields */; + propagateChildFlags(node.exclamationToken) | + 8388608 /* ContainsClassFields */; if (ts.isComputedPropertyName(node.name) || (ts.hasStaticModifier(node) && node.initializer)) { node.transformFlags |= 4096 /* ContainsTypeScriptClassSyntax */; } @@ -22052,7 +22064,8 @@ var ts; node.questionToken = questionToken; node.transformFlags |= propagateChildFlags(node.asteriskToken) | - propagateChildFlags(node.questionToken) | 512 /* ContainsES2015 */; + propagateChildFlags(node.questionToken) | + 512 /* ContainsES2015 */; if (questionToken) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -22580,10 +22593,13 @@ var ts; var node = createBaseNode(197 /* ObjectBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= - propagateChildrenFlags(node.elements) | 512 /* ContainsES2015 */ | 262144 /* ContainsBindingPattern */; + propagateChildrenFlags(node.elements) | + 512 /* ContainsES2015 */ | + 262144 /* ContainsBindingPattern */; if (node.transformFlags & 16384 /* ContainsRestOrSpread */) { node.transformFlags |= - 64 /* ContainsES2018 */ | 32768 /* ContainsObjectRestOrSpread */; + 64 /* ContainsES2018 */ | + 32768 /* ContainsObjectRestOrSpread */; } return node; } @@ -22598,7 +22614,9 @@ var ts; var node = createBaseNode(198 /* ArrayBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= - propagateChildrenFlags(node.elements) | 512 /* ContainsES2015 */ | 262144 /* ContainsBindingPattern */; + propagateChildrenFlags(node.elements) | + 512 /* ContainsES2015 */ | + 262144 /* ContainsBindingPattern */; return node; } // @api @@ -22615,7 +22633,8 @@ var ts; node.propertyName = asName(propertyName); node.dotDotDotToken = dotDotDotToken; node.transformFlags |= - propagateChildFlags(node.dotDotDotToken) | 512 /* ContainsES2015 */; + propagateChildFlags(node.dotDotDotToken) | + 512 /* ContainsES2015 */; if (node.propertyName) { node.transformFlags |= ts.isIdentifier(node.propertyName) ? propagateIdentifierNameFlags(node.propertyName) : @@ -22684,7 +22703,8 @@ var ts; // super method calls require a lexical 'this' // super method calls require 'super' hoisting in ES2017 and ES2018 async functions and async generators node.transformFlags |= - 128 /* ContainsES2017 */ | 64 /* ContainsES2018 */; + 128 /* ContainsES2017 */ | + 64 /* ContainsES2018 */; } return node; } @@ -22737,7 +22757,8 @@ var ts; // super method calls require a lexical 'this' // super method calls require 'super' hoisting in ES2017 and ES2018 async functions and async generators node.transformFlags |= - 128 /* ContainsES2017 */ | 64 /* ContainsES2018 */; + 128 /* ContainsES2017 */ | + 64 /* ContainsES2018 */; } return node; } @@ -22761,7 +22782,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.questionDotToken) | - propagateChildFlags(node.argumentExpression) | 16 /* ContainsES2020 */; + propagateChildFlags(node.argumentExpression) | + 16 /* ContainsES2020 */; return node; } // @api @@ -22819,7 +22841,8 @@ var ts; propagateChildFlags(node.expression) | propagateChildFlags(node.questionDotToken) | propagateChildrenFlags(node.typeArguments) | - propagateChildrenFlags(node.arguments) | 16 /* ContainsES2020 */; + propagateChildrenFlags(node.arguments) | + 16 /* ContainsES2020 */; if (node.typeArguments) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -22847,7 +22870,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.expression) | propagateChildrenFlags(node.typeArguments) | - propagateChildrenFlags(node.arguments) | 16 /* ContainsES2020 */; + propagateChildrenFlags(node.arguments) | + 16 /* ContainsES2020 */; if (node.typeArguments) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -22870,7 +22894,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.tag) | propagateChildrenFlags(node.typeArguments) | - propagateChildFlags(node.template) | 512 /* ContainsES2015 */; + propagateChildFlags(node.template) | + 512 /* ContainsES2015 */; if (node.typeArguments) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -22894,7 +22919,8 @@ var ts; node.type = type; node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildFlags(node.type) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.type) | + 1 /* ContainsTypeScript */; return node; } // @api @@ -22958,7 +22984,8 @@ var ts; /*name*/ undefined, typeParameters, parameters, type, parenthesizerRules().parenthesizeConciseBodyOfArrowFunction(body)); node.equalsGreaterThanToken = equalsGreaterThanToken !== null && equalsGreaterThanToken !== void 0 ? equalsGreaterThanToken : createToken(38 /* EqualsGreaterThanToken */); node.transformFlags |= - propagateChildFlags(node.equalsGreaterThanToken) | 512 /* ContainsES2015 */; + propagateChildFlags(node.equalsGreaterThanToken) | + 512 /* ContainsES2015 */; if (ts.modifiersToFlags(node.modifiers) & 256 /* Async */) { node.transformFlags |= 128 /* ContainsES2017 */; } @@ -23019,7 +23046,10 @@ var ts; var node = createBaseExpression(214 /* AwaitExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 128 /* ContainsES2017 */ | 64 /* ContainsES2018 */ | 1048576 /* ContainsAwait */; + propagateChildFlags(node.expression) | + 128 /* ContainsES2017 */ | + 64 /* ContainsES2018 */ | + 1048576 /* ContainsAwait */; return node; } // @api @@ -23074,12 +23104,15 @@ var ts; else if (operatorKind === 62 /* EqualsToken */) { if (ts.isObjectLiteralExpression(node.left)) { node.transformFlags |= - 512 /* ContainsES2015 */ | 64 /* ContainsES2018 */ | 2048 /* ContainsDestructuringAssignment */ | + 512 /* ContainsES2015 */ | + 64 /* ContainsES2018 */ | + 2048 /* ContainsDestructuringAssignment */ | propagateAssignmentPatternFlags(node.left); } else if (ts.isArrayLiteralExpression(node.left)) { node.transformFlags |= - 512 /* ContainsES2015 */ | 2048 /* ContainsDestructuringAssignment */ | + 512 /* ContainsES2015 */ | + 2048 /* ContainsDestructuringAssignment */ | propagateAssignmentPatternFlags(node.left); } } @@ -23155,7 +23188,8 @@ var ts; node.templateSpans = createNodeArray(templateSpans); node.transformFlags |= propagateChildFlags(node.head) | - propagateChildrenFlags(node.templateSpans) | 512 /* ContainsES2015 */; + propagateChildrenFlags(node.templateSpans) | + 512 /* ContainsES2015 */; return node; } // @api @@ -23224,7 +23258,10 @@ var ts; node.asteriskToken = asteriskToken; node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildFlags(node.asteriskToken) | 512 /* ContainsES2015 */ | 64 /* ContainsES2018 */ | 524288 /* ContainsYield */; + propagateChildFlags(node.asteriskToken) | + 512 /* ContainsES2015 */ | + 64 /* ContainsES2018 */ | + 524288 /* ContainsYield */; return node; } // @api @@ -23239,7 +23276,9 @@ var ts; var node = createBaseExpression(221 /* SpreadElement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 512 /* ContainsES2015 */ | 16384 /* ContainsRestOrSpread */; + propagateChildFlags(node.expression) | + 512 /* ContainsES2015 */ | + 16384 /* ContainsRestOrSpread */; return node; } // @api @@ -23276,7 +23315,8 @@ var ts; node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildrenFlags(node.typeArguments) | 512 /* ContainsES2015 */; + propagateChildrenFlags(node.typeArguments) | + 512 /* ContainsES2015 */; return node; } // @api @@ -23293,7 +23333,8 @@ var ts; node.type = type; node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildFlags(node.type) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.type) | + 1 /* ContainsTypeScript */; return node; } // @api @@ -23308,7 +23349,8 @@ var ts; var node = createBaseExpression(226 /* NonNullExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.expression) | + 1 /* ContainsTypeScript */; return node; } // @api @@ -23326,7 +23368,8 @@ var ts; node.flags |= 32 /* OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.expression) | + 1 /* ContainsTypeScript */; return node; } // @api @@ -23370,7 +23413,8 @@ var ts; node.literal = literal; node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildFlags(node.literal) | 512 /* ContainsES2015 */; + propagateChildFlags(node.literal) | + 512 /* ContainsES2015 */; return node; } // @api @@ -23546,7 +23590,8 @@ var ts; propagateChildFlags(node.awaitModifier) | propagateChildFlags(node.initializer) | propagateChildFlags(node.expression) | - propagateChildFlags(node.statement) | 512 /* ContainsES2015 */; + propagateChildFlags(node.statement) | + 512 /* ContainsES2015 */; if (awaitModifier) node.transformFlags |= 64 /* ContainsES2018 */; return node; @@ -23565,7 +23610,8 @@ var ts; var node = createBaseNode(241 /* ContinueStatement */); node.label = asName(label); node.transformFlags |= - propagateChildFlags(node.label) | 2097152 /* ContainsHoistedDeclarationOrCompletion */; + propagateChildFlags(node.label) | + 2097152 /* ContainsHoistedDeclarationOrCompletion */; return node; } // @api @@ -23579,7 +23625,8 @@ var ts; var node = createBaseNode(242 /* BreakStatement */); node.label = asName(label); node.transformFlags |= - propagateChildFlags(node.label) | 2097152 /* ContainsHoistedDeclarationOrCompletion */; + propagateChildFlags(node.label) | + 2097152 /* ContainsHoistedDeclarationOrCompletion */; return node; } // @api @@ -23594,7 +23641,9 @@ var ts; node.expression = expression; // return in an ES2018 async generator must be awaited node.transformFlags |= - propagateChildFlags(node.expression) | 64 /* ContainsES2018 */ | 2097152 /* ContainsHoistedDeclarationOrCompletion */; + propagateChildFlags(node.expression) | + 64 /* ContainsES2018 */ | + 2097152 /* ContainsHoistedDeclarationOrCompletion */; return node; } // @api @@ -23719,10 +23768,12 @@ var ts; node.flags |= flags & 3 /* BlockScoped */; node.declarations = createNodeArray(declarations); node.transformFlags |= - propagateChildrenFlags(node.declarations) | 2097152 /* ContainsHoistedDeclarationOrCompletion */; + propagateChildrenFlags(node.declarations) | + 2097152 /* ContainsHoistedDeclarationOrCompletion */; if (flags & 3 /* BlockScoped */) { node.transformFlags |= - 512 /* ContainsES2015 */ | 131072 /* ContainsBlockScopedBinding */; + 512 /* ContainsES2015 */ | + 131072 /* ContainsBlockScopedBinding */; } return node; } @@ -23741,7 +23792,8 @@ var ts; } else { node.transformFlags |= - propagateChildFlags(node.asteriskToken) | 2097152 /* ContainsHoistedDeclarationOrCompletion */; + propagateChildFlags(node.asteriskToken) | + 2097152 /* ContainsHoistedDeclarationOrCompletion */; if (ts.modifiersToFlags(node.modifiers) & 256 /* Async */) { if (node.asteriskToken) { node.transformFlags |= 64 /* ContainsES2018 */; @@ -23834,7 +23886,8 @@ var ts; var node = createBaseNamedDeclaration(256 /* EnumDeclaration */, decorators, modifiers, name); node.members = createNodeArray(members); node.transformFlags |= - propagateChildrenFlags(node.members) | 1 /* ContainsTypeScript */; + propagateChildrenFlags(node.members) | + 1 /* ContainsTypeScript */; node.transformFlags &= ~16777216 /* ContainsPossibleTopLevelAwait */; // Enum declarations cannot contain `await` return node; } @@ -23860,7 +23913,8 @@ var ts; else { node.transformFlags |= propagateChildFlags(node.name) | - propagateChildFlags(node.body) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.body) | + 1 /* ContainsTypeScript */; } node.transformFlags &= ~16777216 /* ContainsPossibleTopLevelAwait */; // Module declarations cannot contain `await`. return node; @@ -23997,7 +24051,8 @@ var ts; var node = createBaseNode(270 /* NamespaceExport */); node.name = name; node.transformFlags |= - propagateChildFlags(node.name) | 4 /* ContainsESNext */; + propagateChildFlags(node.name) | + 4 /* ContainsESNext */; node.transformFlags &= ~16777216 /* ContainsPossibleTopLevelAwait */; // always parsed in an Await context return node; } @@ -24503,7 +24558,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.openingElement) | propagateChildrenFlags(node.children) | - propagateChildFlags(node.closingElement) | 2 /* ContainsJsx */; + propagateChildFlags(node.closingElement) | + 2 /* ContainsJsx */; return node; } // @api @@ -24523,7 +24579,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.tagName) | propagateChildrenFlags(node.typeArguments) | - propagateChildFlags(node.attributes) | 2 /* ContainsJsx */; + propagateChildFlags(node.attributes) | + 2 /* ContainsJsx */; if (node.typeArguments) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -24546,7 +24603,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.tagName) | propagateChildrenFlags(node.typeArguments) | - propagateChildFlags(node.attributes) | 2 /* ContainsJsx */; + propagateChildFlags(node.attributes) | + 2 /* ContainsJsx */; if (typeArguments) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -24565,7 +24623,8 @@ var ts; var node = createBaseNode(277 /* JsxClosingElement */); node.tagName = tagName; node.transformFlags |= - propagateChildFlags(node.tagName) | 2 /* ContainsJsx */; + propagateChildFlags(node.tagName) | + 2 /* ContainsJsx */; return node; } // @api @@ -24583,7 +24642,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.openingFragment) | propagateChildrenFlags(node.children) | - propagateChildFlags(node.closingFragment) | 2 /* ContainsJsx */; + propagateChildFlags(node.closingFragment) | + 2 /* ContainsJsx */; return node; } // @api @@ -24628,7 +24688,8 @@ var ts; node.initializer = initializer; node.transformFlags |= propagateChildFlags(node.name) | - propagateChildFlags(node.initializer) | 2 /* ContainsJsx */; + propagateChildFlags(node.initializer) | + 2 /* ContainsJsx */; return node; } // @api @@ -24643,7 +24704,8 @@ var ts; var node = createBaseNode(282 /* JsxAttributes */); node.properties = createNodeArray(properties); node.transformFlags |= - propagateChildrenFlags(node.properties) | 2 /* ContainsJsx */; + propagateChildrenFlags(node.properties) | + 2 /* ContainsJsx */; return node; } // @api @@ -24657,7 +24719,8 @@ var ts; var node = createBaseNode(283 /* JsxSpreadAttribute */); node.expression = expression; node.transformFlags |= - propagateChildFlags(node.expression) | 2 /* ContainsJsx */; + propagateChildFlags(node.expression) | + 2 /* ContainsJsx */; return node; } // @api @@ -24673,7 +24736,8 @@ var ts; node.expression = expression; node.transformFlags |= propagateChildFlags(node.dotDotDotToken) | - propagateChildFlags(node.expression) | 2 /* ContainsJsx */; + propagateChildFlags(node.expression) | + 2 /* ContainsJsx */; return node; } // @api @@ -24802,7 +24866,8 @@ var ts; /*modifiers*/ undefined, name); node.objectAssignmentInitializer = objectAssignmentInitializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(objectAssignmentInitializer); node.transformFlags |= - propagateChildFlags(node.objectAssignmentInitializer) | 512 /* ContainsES2015 */; + propagateChildFlags(node.objectAssignmentInitializer) | + 512 /* ContainsES2015 */; return node; } function finishUpdateShorthandPropertyAssignment(updated, original) { @@ -24831,7 +24896,9 @@ var ts; var node = createBaseNode(291 /* SpreadAssignment */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 64 /* ContainsES2018 */ | 32768 /* ContainsObjectRestOrSpread */; + propagateChildFlags(node.expression) | + 64 /* ContainsES2018 */ | + 32768 /* ContainsObjectRestOrSpread */; return node; } // @api @@ -24850,7 +24917,8 @@ var ts; node.initializer = initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= propagateChildFlags(node.name) | - propagateChildFlags(node.initializer) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.initializer) | + 1 /* ContainsTypeScript */; return node; } // @api @@ -25026,7 +25094,8 @@ var ts; node.expression = expression; node.original = original; node.transformFlags |= - propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.expression) | + 1 /* ContainsTypeScript */; ts.setTextRange(node, original); return node; } @@ -30155,23 +30224,20 @@ var ts; return inContext(32768 /* AwaitContext */); } function parseErrorAtCurrentToken(message, arg0) { - return parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0); + parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0); } function parseErrorAtPosition(start, length, message, arg0) { // Don't report another error if it would just be at the same position as the last error. var lastError = ts.lastOrUndefined(parseDiagnostics); - var result; if (!lastError || start !== lastError.start) { - result = ts.createDetachedDiagnostic(fileName, start, length, message, arg0); - parseDiagnostics.push(result); + parseDiagnostics.push(ts.createDetachedDiagnostic(fileName, start, length, message, arg0)); } // Mark that we've encountered an error. We'll set an appropriate bit on the next // node we finish so that it can't be reused incrementally. parseErrorBeforeNextFinishedNode = true; - return result; } function parseErrorAt(start, end, message, arg0) { - return parseErrorAtPosition(start, end - start, message, arg0); + parseErrorAtPosition(start, end - start, message, arg0); } function parseErrorAtRange(range, message, arg0) { parseErrorAt(range.pos, range.end, message, arg0); @@ -30328,16 +30394,6 @@ var ts; parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind)); return false; } - function parseExpectedMatchingBrackets(openKind, closeKind, openPosition) { - if (token() === closeKind) { - nextToken(); - return; - } - var lastError = parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(closeKind)); - if (lastError) { - ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openPosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, ts.tokenToString(openKind), ts.tokenToString(closeKind))); - } - } function parseOptional(t) { if (token() === t) { nextToken(); @@ -30626,7 +30682,7 @@ var ts; case 22 /* OpenBracketToken */: case 41 /* AsteriskToken */: case 25 /* DotDotDotToken */: - case 24 /* DotToken */: + case 24 /* DotToken */: // Not an object literal member, but don't want to close the object (see `tests/cases/fourslash/completionsDotInObjectLiteral.ts`) return true; default: return isLiteralPropertyName(); @@ -30659,7 +30715,7 @@ var ts; case 15 /* ArrayLiteralMembers */: switch (token()) { case 27 /* CommaToken */: - case 24 /* DotToken */: + case 24 /* DotToken */: // Not an array literal member, but don't want to close the array (see `tests/cases/fourslash/completionsDotInArrayLiteralInObjectLiteral.ts`) return true; } // falls through @@ -33621,7 +33677,7 @@ var ts; case 50 /* AmpersandToken */: // foo & case 51 /* BarToken */: // foo | case 19 /* CloseBraceToken */: // foo } - case 1 /* EndOfFileToken */: + case 1 /* EndOfFileToken */: // foo // these cases can't legally follow a type arg list. However, they're not legal // expressions either. The user is probably in the middle of a generic type. So // treat it as such. @@ -33705,11 +33761,10 @@ var ts; } function parseArrayLiteralExpression() { var pos = getNodePos(); - var openBracketPosition = scanner.getTokenPos(); parseExpected(22 /* OpenBracketToken */); var multiLine = scanner.hasPrecedingLineBreak(); var elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement); - parseExpectedMatchingBrackets(22 /* OpenBracketToken */, 23 /* CloseBracketToken */, openBracketPosition); + parseExpected(23 /* CloseBracketToken */); return finishNode(factory.createArrayLiteralExpression(elements, multiLine), pos); } function parseObjectLiteralElement() { @@ -33769,7 +33824,12 @@ var ts; parseExpected(18 /* OpenBraceToken */); var multiLine = scanner.hasPrecedingLineBreak(); var properties = parseDelimitedList(12 /* ObjectLiteralMembers */, parseObjectLiteralElement, /*considerSemicolonAsDelimiter*/ true); - parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBracePosition); + if (!parseExpected(19 /* CloseBraceToken */)) { + var lastError = ts.lastOrUndefined(parseDiagnostics); + if (lastError && lastError.code === ts.Diagnostics._0_expected.code) { + ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here)); + } + } return finishNode(factory.createObjectLiteralExpression(properties, multiLine), pos); } function parseFunctionExpression() { @@ -33843,7 +33903,12 @@ var ts; if (parseExpected(18 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { var multiLine = scanner.hasPrecedingLineBreak(); var statements = parseList(1 /* BlockStatements */, parseStatement); - parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBracePosition); + if (!parseExpected(19 /* CloseBraceToken */)) { + var lastError = ts.lastOrUndefined(parseDiagnostics); + if (lastError && lastError.code === ts.Diagnostics._0_expected.code) { + ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here)); + } + } var result = withJSDoc(finishNode(factory.createBlock(statements, multiLine), pos), hasJSDoc); if (token() === 62 /* EqualsToken */) { parseErrorAtCurrentToken(ts.Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses); @@ -33888,10 +33953,9 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(98 /* IfKeyword */); - var openParenPosition = scanner.getTokenPos(); parseExpected(20 /* OpenParenToken */); var expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition); + parseExpected(21 /* CloseParenToken */); var thenStatement = parseStatement(); var elseStatement = parseOptional(90 /* ElseKeyword */) ? parseStatement() : undefined; return withJSDoc(finishNode(factory.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc); @@ -33902,10 +33966,9 @@ var ts; parseExpected(89 /* DoKeyword */); var statement = parseStatement(); parseExpected(114 /* WhileKeyword */); - var openParenPosition = scanner.getTokenPos(); parseExpected(20 /* OpenParenToken */); var expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition); + parseExpected(21 /* CloseParenToken */); // From: https://mail.mozilla.org/pipermail/es-discuss/2011-August/016188.html // 157 min --- All allen at wirfs-brock.com CONF --- "do{;}while(false)false" prohibited in // spec but allowed in consensus reality. Approved -- this is the de-facto standard whereby @@ -33917,10 +33980,9 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(114 /* WhileKeyword */); - var openParenPosition = scanner.getTokenPos(); parseExpected(20 /* OpenParenToken */); var expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition); + parseExpected(21 /* CloseParenToken */); var statement = parseStatement(); return withJSDoc(finishNode(factory.createWhileStatement(expression, statement), pos), hasJSDoc); } @@ -33987,10 +34049,9 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(115 /* WithKeyword */); - var openParenPosition = scanner.getTokenPos(); parseExpected(20 /* OpenParenToken */); var expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition); + parseExpected(21 /* CloseParenToken */); var statement = doInsideOfContext(16777216 /* InWithStatement */, parseStatement); return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc); } @@ -34693,7 +34754,7 @@ var ts; case 53 /* ExclamationToken */: // Non-null assertion on property name case 58 /* ColonToken */: // Type Annotation for declaration case 62 /* EqualsToken */: // Initializer for declaration - case 57 /* QuestionToken */: + case 57 /* QuestionToken */: // Not valid, but permitted so that it gets caught later on. return true; default: // Covers @@ -35981,7 +36042,8 @@ var ts; hasChildren = true; if (child.kind === 333 /* JSDocTypeTag */) { if (childTypeTag) { - var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); + parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); + var lastError = ts.lastOrUndefined(parseDiagnostics); if (lastError) { ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, 0, 0, ts.Diagnostics.The_tag_was_first_specified_here)); } @@ -43233,7 +43295,8 @@ var ts; // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = prop.kind === 289 /* PropertyAssignment */ || prop.kind === 290 /* ShorthandPropertyAssignment */ || prop.kind === 166 /* MethodDeclaration */ - ? 1 /* Property */ : 2 /* Accessor */; + ? 1 /* Property */ + : 2 /* Accessor */; var existingKind = seen.get(identifier.escapedText); if (!existingKind) { seen.set(identifier.escapedText, currentKind); @@ -43754,7 +43817,7 @@ var ts; case 252 /* FunctionDeclaration */: return bindFunctionDeclaration(node); case 167 /* Constructor */: - return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, 0 /* None */); + return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); case 168 /* GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 46015 /* GetAccessorExcludes */); case 169 /* SetAccessor */: @@ -43847,7 +43910,8 @@ var ts; case 337 /* JSDocPropertyTag */: var propTag = node; var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 308 /* JSDocOptionalType */ ? - 4 /* Property */ | 16777216 /* Optional */ : 4 /* Property */; + 4 /* Property */ | 16777216 /* Optional */ : + 4 /* Property */; return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* PropertyExcludes */); case 335 /* JSDocTypedefTag */: case 328 /* JSDocCallbackTag */: @@ -43885,9 +43949,9 @@ var ts; else { var flags = ts.exportAssignmentIsAlias(node) // An export default clause with an EntityNameExpression or a class expression exports all meanings of that identifier or expression; - ? 2097152 /* Alias */ - // An export default clause with any other expression exports a value - : 4 /* Property */; + ? 2097152 /* Alias */ + // An export default clause with any other expression exports a value + : 4 /* Property */; // If there is an `export default x;` alias declaration, can't `export default` anything else. // (In contrast, you can still have `export default function f() {}` and `export default interface I {}`.) var symbol = declareSymbol(container.symbol.exports, container.symbol, node, flags, 67108863 /* All */); @@ -43996,7 +44060,8 @@ var ts; } // 'module.exports = expr' assignment var flags = ts.exportAssignmentIsAlias(node) - ? 2097152 /* Alias */ : 4 /* Property */ | 1048576 /* ExportValue */ | 512 /* ValueModule */; + ? 2097152 /* Alias */ + : 4 /* Property */ | 1048576 /* ExportValue */ | 512 /* ValueModule */; var symbol = declareSymbol(file.symbol.exports, file.symbol, node, flags | 67108864 /* Assignment */, 0 /* None */); ts.setValueDeclaration(symbol, node); } @@ -46781,7 +46846,7 @@ var ts; case 254 /* InterfaceDeclaration */: case 256 /* EnumDeclaration */: case 255 /* TypeAliasDeclaration */: - case 257 /* ModuleDeclaration */: + case 257 /* ModuleDeclaration */: // For `namespace N { N; }` return true; default: return false; @@ -50706,7 +50771,8 @@ var ts; // A Class + Property merge is made for a `module.exports.Member = class {}`, and it doesn't serialize well as either a class _or_ a property symbol - in fact, _it behaves like an alias!_ // `var` is `FunctionScopedVariable`, `const` and `let` are `BlockScopedVariable`, and `module.exports.thing =` is `Property` var flags = !(symbol.flags & 2 /* BlockScopedVariable */) ? undefined - : isConstVariable(symbol) ? 2 /* Const */ : 1 /* Let */; + : isConstVariable(symbol) ? 2 /* Const */ + : 1 /* Let */; var name = (needsPostExportDefault || !(symbol.flags & 4 /* Property */)) ? localName : getUnusedName(localName, symbol); var textRange = symbol.declarations && ts.find(symbol.declarations, function (d) { return ts.isVariableDeclaration(d); }); if (textRange && ts.isVariableDeclarationList(textRange.parent) && textRange.parent.declarations.length === 1) { @@ -51346,7 +51412,9 @@ var ts; ], 2 /* Const */)); // Inlined JSON types exported with [module.]exports= will already emit an export=, so should use `declare`. // Otherwise, the type itself should be exported. - addResult(statement, target && target.flags & 4 /* Property */ && target.escapedName === "export=" /* ExportEquals */ ? 2 /* Ambient */ : name === varName ? 1 /* Export */ : 0 /* None */); + addResult(statement, target && target.flags & 4 /* Property */ && target.escapedName === "export=" /* ExportEquals */ ? 2 /* Ambient */ + : name === varName ? 1 /* Export */ + : 0 /* None */); } if (isExportAssignmentCompatibleSymbolName) { results.push(ts.factory.createExportAssignment( @@ -56808,7 +56876,8 @@ var ts; return getRestTypeElementFlags(node); case 193 /* NamedTupleMember */: return node.questionToken ? 2 /* Optional */ : - node.dotDotDotToken ? getRestTypeElementFlags(node) : 1 /* Required */; + node.dotDotDotToken ? getRestTypeElementFlags(node) : + 1 /* Required */; default: return 1 /* Required */; } @@ -57385,7 +57454,7 @@ var ts; } function createUnionType(types, aliasSymbol, aliasTypeArguments, origin) { var result = createType(1048576 /* Union */); - result.objectFlags = getPropagatingFlagsOfTypes(types, 98304 /* Nullable */); + result.objectFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 98304 /* Nullable */); result.types = types; result.origin = origin; result.aliasSymbol = aliasSymbol; @@ -57573,7 +57642,7 @@ var ts; } function createIntersectionType(types, aliasSymbol, aliasTypeArguments) { var result = createType(2097152 /* Intersection */); - result.objectFlags = getPropagatingFlagsOfTypes(types, 98304 /* Nullable */); + result.objectFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 98304 /* Nullable */); result.types = types; result.aliasSymbol = aliasSymbol; result.aliasTypeArguments = aliasTypeArguments; @@ -59596,7 +59665,7 @@ var ts; case 209 /* FunctionExpression */: case 210 /* ArrowFunction */: case 166 /* MethodDeclaration */: - case 252 /* FunctionDeclaration */: + case 252 /* FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type return isContextSensitiveFunctionLikeDeclaration(node); case 201 /* ObjectLiteralExpression */: return ts.some(node.properties, isContextSensitive); @@ -60320,7 +60389,8 @@ var ts; } } var related = source.type === target.type ? -1 /* True */ : - source.type && target.type ? compareTypes(source.type, target.type, reportErrors) : 0 /* False */; + source.type && target.type ? compareTypes(source.type, target.type, reportErrors) : + 0 /* False */; if (related === 0 /* False */ && reportErrors) { errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); } @@ -62393,8 +62463,10 @@ var ts; } var sourceIsJSConstructor = source.symbol && isJSConstructor(source.symbol.valueDeclaration); var targetIsJSConstructor = target.symbol && isJSConstructor(target.symbol.valueDeclaration); - var sourceSignatures = getSignaturesOfType(source, (sourceIsJSConstructor && kind === 1 /* Construct */) ? 0 /* Call */ : kind); - var targetSignatures = getSignaturesOfType(target, (targetIsJSConstructor && kind === 1 /* Construct */) ? 0 /* Call */ : kind); + var sourceSignatures = getSignaturesOfType(source, (sourceIsJSConstructor && kind === 1 /* Construct */) ? + 0 /* Call */ : kind); + var targetSignatures = getSignaturesOfType(target, (targetIsJSConstructor && kind === 1 /* Construct */) ? + 0 /* Call */ : kind); if (kind === 1 /* Construct */ && sourceSignatures.length && targetSignatures.length) { var sourceIsAbstract = !!(sourceSignatures[0].flags & 4 /* Abstract */); var targetIsAbstract = !!(targetSignatures[0].flags & 4 /* Abstract */); @@ -63076,7 +63148,8 @@ var ts; function compareTypePredicatesIdentical(source, target, compareTypes) { return !(source && target && typePredicateKindsMatch(source, target)) ? 0 /* False */ : source.type === target.type ? -1 /* True */ : - source.type && target.type ? compareTypes(source.type, target.type) : 0 /* False */; + source.type && target.type ? compareTypes(source.type, target.type) : + 0 /* False */; } function literalTypesWithSameBaseType(types) { var commonBaseType; @@ -64515,7 +64588,9 @@ var ts; // We assign a lower priority to inferences made from types containing non-inferrable // types because we may only have a partial result (i.e. we may have failed to make // reverse inferences for some properties). - inferWithPriority(inferredType, inference.typeParameter, ts.getObjectFlags(source) & 524288 /* NonInferrableType */ ? 16 /* PartialHomomorphicMappedType */ : 8 /* HomomorphicMappedType */); + inferWithPriority(inferredType, inference.typeParameter, ts.getObjectFlags(source) & 524288 /* NonInferrableType */ ? + 16 /* PartialHomomorphicMappedType */ : + 8 /* HomomorphicMappedType */); } } return true; @@ -66962,7 +67037,7 @@ var ts; return !!ts.findAncestor(location, function (e) { return e.parent && ts.isExportAssignment(e.parent) && e.parent.expression === e && ts.isEntityNameExpression(e); }); } function markAliasReferenced(symbol, location) { - if (isNonLocalAlias(symbol, 111551 /* Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) { + if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) { var target = resolveAlias(symbol); if (target.flags & 111551 /* Value */) { // An alias resolving to a const enum cannot be elided if (1) 'isolatedModules' is enabled @@ -70365,7 +70440,8 @@ var ts; } var effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType; var accessFlags = ts.isAssignmentTarget(node) ? - 2 /* Writing */ | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 1 /* NoIndexSignatures */ : 0) : 0 /* None */; + 2 /* Writing */ | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 1 /* NoIndexSignatures */ : 0) : + 0 /* None */; var indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, /*noUncheckedIndexedAccessCandidate*/ undefined, node, accessFlags | 16 /* ExpressionPosition */) || errorType; return checkIndexedAccessIndexType(getFlowTypeOfAccessExpression(node, getNodeLinks(node).resolvedSymbol, indexedAccessType, indexExpression, checkMode), node); } @@ -71275,14 +71351,14 @@ var ts; var i_1 = 0; var _loop_22 = function (c) { var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); }; - var diags_3 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* Normal */, /*reportErrors*/ true, chain_2); - if (diags_3) { - if (diags_3.length <= min_3) { - min_3 = diags_3.length; + var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* Normal */, /*reportErrors*/ true, chain_2); + if (diags_2) { + if (diags_2.length <= min_3) { + min_3 = diags_2.length; minIndex = i_1; } - max = Math.max(max, diags_3.length); - allDiagnostics.push(diags_3); + max = Math.max(max, diags_2.length); + allDiagnostics.push(diags_2); } else { ts.Debug.fail("No error for 3 or fewer overload signatures"); @@ -71293,15 +71369,15 @@ var ts; var c = candidatesForArgumentError_1[_a]; _loop_22(c); } - var diags_2 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics); - ts.Debug.assert(diags_2.length > 0, "No errors reported for 3 or fewer overload signatures"); - var chain = ts.chainDiagnosticMessages(ts.map(diags_2, function (d) { return typeof d.messageText === "string" ? d : d.messageText; }), ts.Diagnostics.No_overload_matches_this_call); + var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics); + ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures"); + var chain = ts.chainDiagnosticMessages(ts.map(diags_3, function (d) { return typeof d.messageText === "string" ? d : d.messageText; }), ts.Diagnostics.No_overload_matches_this_call); // The below is a spread to guarantee we get a new (mutable) array - our `flatMap` helper tries to do "smart" optimizations where it reuses input // arrays and the emptyArray singleton where possible, which is decidedly not what we want while we're still constructing this diagnostic - var related = __spreadArray([], ts.flatMap(diags_2, function (d) { return d.relatedInformation; })); + var related = __spreadArray([], ts.flatMap(diags_3, function (d) { return d.relatedInformation; })); var diag = void 0; - if (ts.every(diags_2, function (d) { return d.start === diags_2[0].start && d.length === diags_2[0].length && d.file === diags_2[0].file; })) { - var _b = diags_2[0], file = _b.file, start = _b.start, length_7 = _b.length; + if (ts.every(diags_3, function (d) { return d.start === diags_3[0].start && d.length === diags_3[0].length && d.file === diags_3[0].file; })) { + var _b = diags_3[0], file = _b.file, start = _b.start, length_7 = _b.length; diag = { file: file, start: start, length: length_7, code: chain.code, category: chain.category, messageText: chain, relatedInformation: related }; } else { @@ -71563,7 +71639,8 @@ var ts; if (ts.isCallChain(node)) { var nonOptionalType = getOptionalExpressionType(funcType, node.expression); callChainFlags = nonOptionalType === funcType ? 0 /* None */ : - ts.isOutermostOptionalChain(node) ? 16 /* IsOuterCallChain */ : 8 /* IsInnerCallChain */; + ts.isOutermostOptionalChain(node) ? 16 /* IsOuterCallChain */ : + 8 /* IsInnerCallChain */; funcType = nonOptionalType; } else { @@ -72340,8 +72417,10 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 /* Function */ - ? 252 /* FunctionDeclaration */ : resolvedRequire.flags & 3 /* Variable */ - ? 250 /* VariableDeclaration */ : 0 /* Unknown */; + ? 252 /* FunctionDeclaration */ + : resolvedRequire.flags & 3 /* Variable */ + ? 250 /* VariableDeclaration */ + : 0 /* Unknown */; if (targetDeclarationKind !== 0 /* Unknown */) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); // function/variable declaration should be ambient @@ -75999,7 +76078,7 @@ var ts; case 199 /* BindingElement */: case 252 /* FunctionDeclaration */: case 266 /* ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 - case 78 /* Identifier */: + case 78 /* Identifier */: // https://github.com/microsoft/TypeScript/issues/36098 // Identifiers are used as declarations of assignment declarations whose parents may be // SyntaxKind.CallExpression - `Object.defineProperty(thing, "aField", {value: 42});` // SyntaxKind.ElementAccessExpression - `thing["aField"] = 42;` or `thing["aField"];` (with a doc comment on it) @@ -77275,7 +77354,12 @@ var ts; if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) { return false; } - var interestingFlags = 8 /* Private */ | 16 /* Protected */ | 256 /* Async */ | 128 /* Abstract */ | 64 /* Readonly */ | 32 /* Static */; + var interestingFlags = 8 /* Private */ | + 16 /* Protected */ | + 256 /* Async */ | + 128 /* Abstract */ | + 64 /* Readonly */ | + 32 /* Static */; return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags); } function checkVariableDeclaration(node) { @@ -78996,9 +79080,9 @@ var ts; ts.forEach(properties, function (p) { seen.set(p.escapedName, p); }); for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { var base = baseTypes_2[_i]; - var properties_4 = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)); - for (var _a = 0, properties_5 = properties_4; _a < properties_5.length; _a++) { - var prop = properties_5[_a]; + var properties_5 = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)); + for (var _a = 0, properties_4 = properties_5; _a < properties_4.length; _a++) { + var prop = properties_4[_a]; var existing = seen.get(prop.escapedName); if (existing && !isPropertyIdenticalTo(existing, prop)) { seen.delete(prop.escapedName); @@ -80701,7 +80785,7 @@ var ts; } } if (name.parent.kind === 173 /* TypePredicate */) { - return resolveEntityName(name, 1 /* FunctionScopedVariable */); + return resolveEntityName(name, /*meaning*/ 1 /* FunctionScopedVariable */); } return undefined; } @@ -81090,7 +81174,7 @@ var ts; var symbol = getReferencedValueSymbol(node); // We should only get the declaration of an alias if there isn't a local value // declaration for the symbol - if (isNonLocalAlias(symbol, 111551 /* Value */) && !getTypeOnlyAliasDeclaration(symbol)) { + if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* Value */) && !getTypeOnlyAliasDeclaration(symbol)) { return getDeclarationOfAliasSymbol(symbol); } } @@ -88643,7 +88727,9 @@ var ts; } function visitPrefixUnaryExpression(node) { if (shouldTransformPrivateElements && ts.isPrivateIdentifierPropertyAccessExpression(node.operand)) { - var operator = node.operator === 45 /* PlusPlusToken */ ? 39 /* PlusToken */ : node.operator === 46 /* MinusMinusToken */ ? 40 /* MinusToken */ : undefined; + var operator = node.operator === 45 /* PlusPlusToken */ ? + 39 /* PlusToken */ : node.operator === 46 /* MinusMinusToken */ ? + 40 /* MinusToken */ : undefined; var info = void 0; if (operator && (info = accessPrivateIdentifier(node.operand.name))) { var receiver = ts.visitNode(node.operand.expression, visitor, ts.isExpression); @@ -88656,7 +88742,9 @@ var ts; } function visitPostfixUnaryExpression(node, valueIsDiscarded) { if (shouldTransformPrivateElements && ts.isPrivateIdentifierPropertyAccessExpression(node.operand)) { - var operator = node.operator === 45 /* PlusPlusToken */ ? 39 /* PlusToken */ : node.operator === 46 /* MinusMinusToken */ ? 40 /* MinusToken */ : undefined; + var operator = node.operator === 45 /* PlusPlusToken */ ? + 39 /* PlusToken */ : node.operator === 46 /* MinusMinusToken */ ? + 40 /* MinusToken */ : undefined; var info = void 0; if (operator && (info = accessPrivateIdentifier(node.operand.name))) { var receiver = ts.visitNode(node.operand.expression, visitor, ts.isExpression); @@ -88796,10 +88884,11 @@ var ts; return ts.visitEachChild(node, visitor, context); } var staticProperties = ts.getProperties(node, /*requireInitializer*/ false, /*isStatic*/ true); + var pendingPrivateStateAssignment; if (shouldTransformPrivateElements && ts.some(node.members, function (m) { return ts.hasStaticModifier(m) && !!m.name && ts.isPrivateIdentifier(m.name); })) { var temp = factory.createTempVariable(hoistVariableDeclaration, /* reservedInNestedScopes */ true); getPrivateIdentifierEnvironment().classConstructor = factory.cloneNode(temp); - getPendingExpressions().push(factory.createAssignment(temp, factory.getInternalName(node))); + pendingPrivateStateAssignment = factory.createAssignment(temp, factory.getInternalName(node)); } var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 103 /* NullKeyword */); @@ -88808,6 +88897,9 @@ var ts; /*decorators*/ undefined, node.modifiers, node.name, /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)) ]; + if (pendingPrivateStateAssignment) { + getPendingExpressions().unshift(pendingPrivateStateAssignment); + } // Write any pending expressions from elided or moved computed property names if (ts.some(pendingExpressions)) { statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))); @@ -90371,7 +90463,9 @@ var ts; return ts.visitEachChild(node, expressionResultIsUnused ? visitorWithUnusedExpressionResult : visitor, context); } function visitSourceFile(node) { - var ancestorFacts = enterSubtree(2 /* SourceFileExcludes */, ts.isEffectiveStrictModeSourceFile(node, compilerOptions) ? 0 /* StrictModeSourceFileIncludes */ : 1 /* SourceFileIncludes */); + var ancestorFacts = enterSubtree(2 /* SourceFileExcludes */, ts.isEffectiveStrictModeSourceFile(node, compilerOptions) ? + 0 /* StrictModeSourceFileIncludes */ : + 1 /* SourceFileIncludes */); exportedVariableStatement = false; var visited = ts.visitEachChild(node, visitor, context); var statement = ts.concatenate(visited.statements, taggedTemplateStringDeclarations && [ @@ -101289,7 +101383,13 @@ var ts; }); } ts.isInternalDeclaration = isInternalDeclaration; - var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */; + var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | + 2048 /* WriteClassExpressionAsTypeLiteral */ | + 4096 /* UseTypeOfFunction */ | + 8 /* UseStructuralFallback */ | + 524288 /* AllowEmptyTuple */ | + 4 /* GenerateNamesForShadowedTypeParams */ | + 1 /* NoTruncation */; /** * Transforms a ts file into a .d.ts file * This process requires type information, which is retrieved through the emit resolver. Because of this, @@ -102190,7 +102290,7 @@ var ts; } var previousNeedsDeclare = needsDeclare; switch (input.kind) { - case 255 /* TypeAliasDeclaration */: + case 255 /* TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all return cleanup(factory.updateTypeAliasDeclaration(input, /*decorators*/ undefined, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); case 254 /* InterfaceDeclaration */: { @@ -103278,8 +103378,11 @@ var ts; if (configFile.options.emitDeclarationOnly) return undefined; var isJsonFile = ts.fileExtensionIs(inputFileName, ".json" /* Json */); - var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory), isJsonFile ? ".json" /* Json */ : - configFile.options.jsx === 1 /* Preserve */ && (ts.fileExtensionIs(inputFileName, ".tsx" /* Tsx */) || ts.fileExtensionIs(inputFileName, ".jsx" /* Jsx */)) ? ".jsx" /* Jsx */ : ".js" /* Js */); + var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory), isJsonFile ? + ".json" /* Json */ : + configFile.options.jsx === 1 /* Preserve */ && (ts.fileExtensionIs(inputFileName, ".tsx" /* Tsx */) || ts.fileExtensionIs(inputFileName, ".jsx" /* Jsx */)) ? + ".jsx" /* Jsx */ : + ".js" /* Js */); return !isJsonFile || ts.comparePaths(inputFileName, outputFileName, ts.Debug.checkDefined(configFile.options.configFilePath), ignoreCase) !== 0 /* EqualTo */ ? outputFileName : undefined; @@ -104846,7 +104949,9 @@ var ts; var pos = getTextPosWithWriteLine(); writeUnparsedNode(unparsed); if (bundleFileInfo) { - updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 295 /* UnparsedText */ ? "text" /* Text */ : "internal" /* Internal */); + updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 295 /* UnparsedText */ ? + "text" /* Text */ : + "internal" /* Internal */); } } // SyntaxKind.UnparsedSyntheticReference @@ -114368,7 +114473,8 @@ var ts; return { relativePreference: importModuleSpecifierPreference === "relative" ? 0 /* Relative */ : importModuleSpecifierPreference === "non-relative" ? 1 /* NonRelative */ : - importModuleSpecifierPreference === "project-relative" ? 3 /* ExternalNonRelative */ : 2 /* Shortest */, + importModuleSpecifierPreference === "project-relative" ? 3 /* ExternalNonRelative */ : + 2 /* Shortest */, ending: getEnding(), }; function getEnding() { @@ -114376,14 +114482,16 @@ var ts; case "minimal": return 0 /* Minimal */; case "index": return 1 /* Index */; case "js": return 2 /* JsExtension */; - default: return usesJsExtensionOnImports(importingSourceFile) ? 2 /* JsExtension */ : ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeJs ? 1 /* Index */ : 0 /* Minimal */; + default: return usesJsExtensionOnImports(importingSourceFile) ? 2 /* JsExtension */ + : ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeJs ? 1 /* Index */ : 0 /* Minimal */; } } } function getPreferencesForUpdate(compilerOptions, oldImportSpecifier) { return { relativePreference: ts.isExternalModuleNameRelative(oldImportSpecifier) ? 0 /* Relative */ : 1 /* NonRelative */, - ending: ts.hasJSFileExtension(oldImportSpecifier) ? 2 /* JsExtension */ : + ending: ts.hasJSFileExtension(oldImportSpecifier) ? + 2 /* JsExtension */ : ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeJs || ts.endsWith(oldImportSpecifier, "index") ? 1 /* Index */ : 0 /* Minimal */, }; } @@ -118863,8 +118971,10 @@ var ts; } function getKindOfVariableDeclaration(v) { return ts.isVarConst(v) - ? "const" /* constElement */ : ts.isLet(v) - ? "let" /* letElement */ : "var" /* variableElement */; + ? "const" /* constElement */ + : ts.isLet(v) + ? "let" /* letElement */ + : "var" /* variableElement */; } } ts.getNodeKind = getNodeKind; @@ -120798,10 +120908,10 @@ var ts; var delta = 0; var lastPos = -1; for (var _i = 0, edits_1 = edits; _i < edits_1.length; _i++) { - var _a = edits_1[_i], fileName = _a.fileName, textChanges_1 = _a.textChanges; + var _a = edits_1[_i], fileName = _a.fileName, textChanges_2 = _a.textChanges; ts.Debug.assert(fileName === renameFilename); - for (var _b = 0, textChanges_2 = textChanges_1; _b < textChanges_2.length; _b++) { - var change = textChanges_2[_b]; + for (var _b = 0, textChanges_1 = textChanges_2; _b < textChanges_1.length; _b++) { + var change = textChanges_1[_b]; var span = change.span, newText = change.newText; var index = indexInTextChange(newText, name); if (index !== -1) { @@ -123624,6 +123734,8 @@ var ts; return jsdocCompletionInfo(ts.JsDoc.getJSDocTagCompletions()); case 3 /* JsDocParameterName */: return jsdocCompletionInfo(ts.JsDoc.getJSDocParameterNameCompletions(completionData.tag)); + case 4 /* Keywords */: + return specificKeywordCompletionInfo(completionData.keywords); default: return ts.Debug.assertNever(completionData); } @@ -123632,6 +123744,19 @@ var ts; function jsdocCompletionInfo(entries) { return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries }; } + function specificKeywordCompletionInfo(keywords) { + return { + isGlobalCompletion: false, + isMemberCompletion: false, + isNewIdentifierLocation: false, + entries: keywords.map(function (k) { return ({ + name: ts.tokenToString(k), + kind: "keyword" /* keyword */, + kindModifiers: "" /* none */, + sortText: SortText.GlobalsOrKeywords, + }); }), + }; + } function getOptionalReplacementSpan(location) { // StringLiteralLike locations are handled separately in stringCompletions.ts return (location === null || location === void 0 ? void 0 : location.kind) === 78 /* Identifier */ ? ts.createTextSpanFromNode(location) : undefined; @@ -123858,7 +123983,8 @@ var ts; var replacementSpan = ts.createTextSpanFromNode(importCompletionNode, sourceFile); var quotedModuleSpecifier = ts.quote(sourceFile, preferences, origin.moduleSpecifier); var exportKind = origin.isDefaultExport ? 1 /* Default */ : - origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : 0 /* Named */; + origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : + 0 /* Named */; var tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : ""; var importKind = ts.codefix.getImportKind(sourceFile, exportKind, options); var suffix = useSemicolons ? ";" : ""; @@ -124055,6 +124181,8 @@ var ts; return ts.JsDoc.getJSDocTagCompletionDetails(name); case 3 /* JsDocParameterName */: return ts.JsDoc.getJSDocParameterNameCompletionDetails(name); + case 4 /* Keywords */: + return request.keywords.indexOf(ts.stringToToken(name)) > -1 ? createSimpleDetails(name, "keyword" /* keyword */, ts.SymbolDisplayPartKind.keyword) : undefined; default: return ts.Debug.assertNever(request); } @@ -124113,6 +124241,7 @@ var ts; CompletionDataKind[CompletionDataKind["JsDocTagName"] = 1] = "JsDocTagName"; CompletionDataKind[CompletionDataKind["JsDocTag"] = 2] = "JsDocTag"; CompletionDataKind[CompletionDataKind["JsDocParameterName"] = 3] = "JsDocParameterName"; + CompletionDataKind[CompletionDataKind["Keywords"] = 4] = "Keywords"; })(CompletionDataKind || (CompletionDataKind = {})); var CompletionKind; (function (CompletionKind) { @@ -124167,7 +124296,7 @@ var ts; } } function getFirstSymbolInChain(symbol, enclosingDeclaration, checker) { - var chain = checker.getAccessibleSymbolChain(symbol, enclosingDeclaration, 67108863 /* All */, /*useOnlyExternalAliasing*/ false); + var chain = checker.getAccessibleSymbolChain(symbol, enclosingDeclaration, /*meaning*/ 67108863 /* All */, /*useOnlyExternalAliasing*/ false); if (chain) return ts.first(chain); return symbol.parent && (isModuleSymbol(symbol.parent) ? symbol : getFirstSymbolInChain(symbol.parent, enclosingDeclaration, checker)); @@ -124273,13 +124402,17 @@ var ts; var importCompletionNode; var location = ts.getTouchingPropertyName(sourceFile, position); if (contextToken) { + var importCompletionCandidate = getImportCompletionNode(contextToken); + if (importCompletionCandidate === 153 /* FromKeyword */) { + return { kind: 4 /* Keywords */, keywords: [153 /* FromKeyword */] }; + } // Import statement completions use `insertText`, and also require the `data` property of `CompletionEntryIdentifier` // added in TypeScript 4.3 to be sent back from the client during `getCompletionEntryDetails`. Since this feature // is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients // to opt in with the `includeCompletionsForImportStatements` user preference. - importCompletionNode = preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText - ? getImportCompletionNode(contextToken) - : undefined; + if (importCompletionCandidate && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) { + importCompletionNode = importCompletionCandidate; + } // Bail out if this is a known invalid completion location if (!importCompletionNode && isCompletionListBlocker(contextToken)) { log("Returning an empty list because completion was requested in an invalid position."); @@ -124755,7 +124888,8 @@ var ts; collectAutoImports(/*resolveModuleSpecifier*/ false); if (isTypeOnly) { keywordFilters = contextToken && ts.isAssertionExpression(contextToken.parent) - ? 6 /* TypeAssertionKeywords */ : 7 /* TypeKeywords */; + ? 6 /* TypeAssertionKeywords */ + : 7 /* TypeKeywords */; } } function shouldOfferImportCompletions() { @@ -124986,7 +125120,7 @@ var ts; || containingNodeKind === 172 /* IndexSignature */ // [ | : string ] || containingNodeKind === 159 /* ComputedPropertyName */; // [ | /* this can become an index signature */ case 139 /* ModuleKeyword */: // module | - case 140 /* NamespaceKeyword */: + case 140 /* NamespaceKeyword */: // namespace | return true; case 24 /* DotToken */: return containingNodeKind === 257 /* ModuleDeclaration */; // module A.| @@ -125235,7 +125369,7 @@ var ts; var parent = contextToken.parent; switch (contextToken.kind) { case 18 /* OpenBraceToken */: // const x = { | - case 27 /* CommaToken */: + case 27 /* CommaToken */: // const x = { a: 0, | if (ts.isObjectLiteralExpression(parent) || ts.isObjectBindingPattern(parent)) { return parent; } @@ -125414,7 +125548,7 @@ var ts; case 118 /* LetKeyword */: case 84 /* ConstKeyword */: case 135 /* InferKeyword */: - case 149 /* TypeKeyword */: + case 149 /* TypeKeyword */: // type htm| return true; case 41 /* AsteriskToken */: return ts.isFunctionLike(contextToken.parent) && !ts.isMethodDeclaration(contextToken.parent); @@ -125707,7 +125841,7 @@ var ts; // TODO: GH#18169 return { name: JSON.stringify(name), needsConvertPropertyAccess: false }; case 2 /* PropertyAccess */: - case 1 /* Global */: + case 1 /* Global */: // For a 'this.' completion it will be in a global context, but may have a non-identifier name. // Don't add a completion for a name starting with a space. See https://github.com/Microsoft/TypeScript/pull/20547 return name.charCodeAt(0) === 32 /* space */ ? undefined : { name: name, needsConvertPropertyAccess: true }; case 5 /* None */: @@ -125903,16 +126037,16 @@ var ts; return ts.findAncestor(contextToken, ts.isClassLike); } switch (contextToken.kind) { - case 62 /* EqualsToken */: + case 62 /* EqualsToken */: // class c { public prop = | /* global completions */ } return undefined; case 26 /* SemicolonToken */: // class c {getValue(): number; | } - case 19 /* CloseBraceToken */: + case 19 /* CloseBraceToken */: // class c { method() { } | } // class c { method() { } b| } return isFromObjectTypeDeclaration(location) && location.parent.name === location ? location.parent.parent : ts.tryCast(location, ts.isObjectTypeDeclaration); case 18 /* OpenBraceToken */: // class c { | - case 27 /* CommaToken */: + case 27 /* CommaToken */: // class c {getValue(): number, | } return ts.tryCast(contextToken.parent, ts.isObjectTypeDeclaration); default: if (!isFromObjectTypeDeclaration(contextToken)) { @@ -126032,16 +126166,20 @@ var ts; } function getImportCompletionNode(contextToken) { var candidate = getCandidate(); - return candidate && ts.rangeIsOnSingleLine(candidate, candidate.getSourceFile()) ? candidate : undefined; + return candidate === 153 /* FromKeyword */ || candidate && ts.rangeIsOnSingleLine(candidate, candidate.getSourceFile()) ? candidate : undefined; function getCandidate() { var parent = contextToken.parent; if (ts.isImportEqualsDeclaration(parent)) { return isModuleSpecifierMissingOrEmpty(parent.moduleReference) ? parent : undefined; } if (ts.isNamedImports(parent) || ts.isNamespaceImport(parent)) { - return isModuleSpecifierMissingOrEmpty(parent.parent.parent.moduleSpecifier) && (ts.isNamespaceImport(parent) || parent.elements.length < 2) && !parent.parent.name - ? parent.parent.parent - : undefined; + if (isModuleSpecifierMissingOrEmpty(parent.parent.parent.moduleSpecifier) && (ts.isNamespaceImport(parent) || parent.elements.length < 2) && !parent.parent.name) { + // At `import { ... } |` or `import * as Foo |`, the only possible completion is `from` + return contextToken.kind === 19 /* CloseBraceToken */ || contextToken.kind === 78 /* Identifier */ + ? 153 /* FromKeyword */ + : parent.parent.parent; + } + return undefined; } if (ts.isImportKeyword(contextToken) && ts.isSourceFile(parent)) { // A lone import keyword with nothing following it does not parse as a statement at all @@ -126778,7 +126916,7 @@ var ts; } } break; - case 78 /* Identifier */: + case 78 /* Identifier */: // for 'const x = require("y"); break; // TODO: GH#23879 case 261 /* ImportEqualsDeclaration */: handleNamespaceImport(direct, direct.name, ts.hasSyntacticModifier(direct, 1 /* Export */), /*alreadyAddedDirect*/ false); @@ -131433,9 +131571,11 @@ var ts; return ts.isFunctionExpression(node) || ts.isFunctionDeclaration(node) || ts.isVariableDeclaration(node); } var bAssignmentDeclarationKind = ts.isBinaryExpression(b.node) || ts.isCallExpression(b.node) ? - ts.getAssignmentDeclarationKind(b.node) : 0 /* None */; + ts.getAssignmentDeclarationKind(b.node) : + 0 /* None */; var aAssignmentDeclarationKind = ts.isBinaryExpression(a.node) || ts.isCallExpression(a.node) ? - ts.getAssignmentDeclarationKind(a.node) : 0 /* None */; + ts.getAssignmentDeclarationKind(a.node) : + 0 /* None */; // We treat this as an es5 class and merge the nodes in in one of several cases if ((isEs5ClassMember[bAssignmentDeclarationKind] && isEs5ClassMember[aAssignmentDeclarationKind]) // merge two class elements || (isPossibleConstructor(a.node) && isEs5ClassMember[bAssignmentDeclarationKind]) // ctor function & member @@ -132738,7 +132878,8 @@ var ts; return ts.min(a, b, compareMatches); } function compareMatches(a, b) { - return a === undefined ? 1 /* GreaterThan */ : b === undefined ? -1 /* LessThan */ : ts.compareValues(a.kind, b.kind) || ts.compareBooleans(!a.isCaseSensitive, !b.isCaseSensitive); + return a === undefined ? 1 /* GreaterThan */ : b === undefined ? -1 /* LessThan */ + : ts.compareValues(a.kind, b.kind) || ts.compareBooleans(!a.isCaseSensitive, !b.isCaseSensitive); } function partStartsWith(candidate, candidateSpan, pattern, ignoreCase, patternSpan) { if (patternSpan === void 0) { patternSpan = { start: 0, length: pattern.length }; } @@ -134771,7 +134912,8 @@ var ts; } var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol); if (flags & 32 /* Class */) { - return ts.getDeclarationOfKind(symbol, 222 /* ClassExpression */) ? "local class" /* localClassElement */ : "class" /* classElement */; + return ts.getDeclarationOfKind(symbol, 222 /* ClassExpression */) ? + "local class" /* localClassElement */ : "class" /* classElement */; } if (flags & 384 /* Enum */) return "enum" /* enumElement */; @@ -134874,7 +135016,8 @@ var ts; var _a = symbol.declarations, declaration = _a[0], declarations = _a.slice(1); // omit deprecated flag if some declarations are not deprecated var excludeFlags = ts.length(declarations) && isDeprecatedDeclaration(declaration) && ts.some(declarations, function (d) { return !isDeprecatedDeclaration(d); }) - ? 8192 /* Deprecated */ : 0 /* None */; + ? 8192 /* Deprecated */ + : 0 /* None */; var modifiers = ts.getNodeModifiers(declaration, excludeFlags); if (modifiers) { return modifiers.split(","); @@ -135755,7 +135898,8 @@ var ts; shouldRescanTemplateToken(n) ? 3 /* RescanTemplateToken */ : shouldRescanJsxIdentifier(n) ? 4 /* RescanJsxIdentifier */ : shouldRescanJsxText(n) ? 5 /* RescanJsxText */ : - shouldRescanJsxAttributeValue(n) ? 6 /* RescanJsxAttributeValue */ : 0 /* Scan */; + shouldRescanJsxAttributeValue(n) ? 6 /* RescanJsxAttributeValue */ : + 0 /* Scan */; if (lastTokenInfo && expectedScanAction === lastScanAction) { // readTokenInfo was called before with the same expected scan action. // No need to re-scan text, return existing 'lastTokenInfo' @@ -135936,14 +136080,8 @@ var ts; var binaryKeywordOperators = [100 /* InKeyword */, 101 /* InstanceOfKeyword */, 157 /* OfKeyword */, 126 /* AsKeyword */, 137 /* IsKeyword */]; var unaryPrefixOperators = [45 /* PlusPlusToken */, 46 /* MinusMinusToken */, 54 /* TildeToken */, 53 /* ExclamationToken */]; var unaryPrefixExpressions = [ - 8 /* NumericLiteral */, - 9 /* BigIntLiteral */, - 78 /* Identifier */, - 20 /* OpenParenToken */, - 22 /* OpenBracketToken */, - 18 /* OpenBraceToken */, - 107 /* ThisKeyword */, - 102 /* NewKeyword */ + 8 /* NumericLiteral */, 9 /* BigIntLiteral */, 78 /* Identifier */, 20 /* OpenParenToken */, + 22 /* OpenBracketToken */, 18 /* OpenBraceToken */, 107 /* ThisKeyword */, 102 /* NewKeyword */ ]; var unaryPreincrementExpressions = [78 /* Identifier */, 20 /* OpenParenToken */, 107 /* ThisKeyword */, 102 /* NewKeyword */]; var unaryPostincrementExpressions = [78 /* Identifier */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 102 /* NewKeyword */]; @@ -136374,7 +136512,7 @@ var ts; // case SyntaxKind.SimpleArrowFunctionExpression: // case SyntaxKind.ParenthesizedArrowFunctionExpression: // falls through - case 254 /* InterfaceDeclaration */: + case 254 /* InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one return true; } return false; @@ -137264,7 +137402,7 @@ var ts; // if there are any tokens that logically belong to node and interleave child nodes // such tokens will be consumed in processChildNode for the child that follows them ts.forEachChild(node, function (child) { - processChildNode(child, -1 /* Unknown */, node, nodeDynamicIndentation, nodeStartLine, undecoratedNodeStartLine, /*isListItem*/ false); + processChildNode(child, /*inheritedIndentation*/ -1 /* Unknown */, node, nodeDynamicIndentation, nodeStartLine, undecoratedNodeStartLine, /*isListItem*/ false); }, function (nodes) { processChildNodes(nodes, node, nodeStartLine, nodeDynamicIndentation); }); @@ -137435,7 +137573,8 @@ var ts; } if (indentToken) { var tokenIndentation = (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) ? - dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind, container, !!isListEndToken) : -1 /* Unknown */; + dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind, container, !!isListEndToken) : + -1 /* Unknown */; var indentNextTokenOrTrivia = true; if (currentTokenInfo.leadingTrivia) { var commentIndentation_1 = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation, container); @@ -141263,7 +141402,7 @@ var ts; // do not produce a transformed statement for a null argument break; case 202 /* PropertyAccessExpression */: - case 78 /* Identifier */: + case 78 /* Identifier */: // identifier includes undefined if (!argName) { // undefined was argument passed to promise handler break; diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index 958c98542437b..4655fac07d1c5 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -290,7 +290,7 @@ var ts; // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types - ts.version = "4.3.1-rc"; + ts.version = "4.3.2"; /* @internal */ var Comparison; (function (Comparison) { @@ -1847,7 +1847,8 @@ var ts; return a === b ? 0 /* EqualTo */ : a === undefined ? -1 /* LessThan */ : b === undefined ? 1 /* GreaterThan */ : - a < b ? -1 /* LessThan */ : 1 /* GreaterThan */; + a < b ? -1 /* LessThan */ : + 1 /* GreaterThan */; } /** * Compare two numeric values for their order relative to each other. @@ -7862,7 +7863,8 @@ var ts; if (ts.sys && ts.sys.getEnvironmentVariable) { setCustomPollingValues(ts.sys); ts.Debug.setAssertionLevel(/^development$/i.test(ts.sys.getEnvironmentVariable("NODE_ENV")) - ? 1 /* Normal */ : 0 /* None */); + ? 1 /* Normal */ + : 0 /* None */); } if (ts.sys && ts.sys.debugMode) { ts.Debug.isDebugging = true; @@ -7881,7 +7883,7 @@ var ts; Identifier_expected: diag(1003, ts.DiagnosticCategory.Error, "Identifier_expected_1003", "Identifier expected."), _0_expected: diag(1005, ts.DiagnosticCategory.Error, "_0_expected_1005", "'{0}' expected."), A_file_cannot_have_a_reference_to_itself: diag(1006, ts.DiagnosticCategory.Error, "A_file_cannot_have_a_reference_to_itself_1006", "A file cannot have a reference to itself."), - The_parser_expected_to_find_a_1_to_match_the_0_token_here: diag(1007, ts.DiagnosticCategory.Error, "The_parser_expected_to_find_a_1_to_match_the_0_token_here_1007", "The parser expected to find a '{1}' to match the '{0}' token here."), + The_parser_expected_to_find_a_to_match_the_token_here: diag(1007, ts.DiagnosticCategory.Error, "The_parser_expected_to_find_a_to_match_the_token_here_1007", "The parser expected to find a '}' to match the '{' token here."), Trailing_comma_not_allowed: diag(1009, ts.DiagnosticCategory.Error, "Trailing_comma_not_allowed_1009", "Trailing comma not allowed."), Asterisk_Slash_expected: diag(1010, ts.DiagnosticCategory.Error, "Asterisk_Slash_expected_1010", "'*/' expected."), An_element_access_expression_should_take_an_argument: diag(1011, ts.DiagnosticCategory.Error, "An_element_access_expression_should_take_an_argument_1011", "An element access expression should take an argument."), @@ -13202,7 +13204,7 @@ var ts; case 105 /* SuperKeyword */: case 226 /* NonNullExpression */: case 227 /* MetaProperty */: - case 99 /* ImportKeyword */: + case 99 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression return true; default: return false; @@ -16275,7 +16277,8 @@ var ts; case 217 /* BinaryExpression */: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? - binaryOperator === 62 /* EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* Definite */ : 2 /* Compound */ : 0 /* None */; + binaryOperator === 62 /* EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* Definite */ : 2 /* Compound */ : + 0 /* None */; case 215 /* PrefixUnaryExpression */: case 216 /* PostfixUnaryExpression */: var unaryOperator = parent.operator; @@ -18700,7 +18703,8 @@ var ts; if (getCheckFlags(s) & 6 /* Synthetic */) { var checkFlags = s.checkFlags; var accessModifier = checkFlags & 1024 /* ContainsPrivate */ ? 8 /* Private */ : - checkFlags & 256 /* ContainsPublic */ ? 4 /* Public */ : 16 /* Protected */; + checkFlags & 256 /* ContainsPublic */ ? 4 /* Public */ : + 16 /* Protected */; var staticModifier = checkFlags & 2048 /* ContainsStatic */ ? 32 /* Static */ : 0; return accessModifier | staticModifier; } @@ -19232,7 +19236,8 @@ var ts; } function compareDiagnostics(d1, d2) { return compareDiagnosticsSkipRelatedInformation(d1, d2) || - compareRelatedInformation(d1, d2) || 0 /* EqualTo */; + compareRelatedInformation(d1, d2) || + 0 /* EqualTo */; } ts.compareDiagnostics = compareDiagnostics; function compareDiagnosticsSkipRelatedInformation(d1, d2) { @@ -19240,7 +19245,8 @@ var ts; ts.compareValues(d1.start, d2.start) || ts.compareValues(d1.length, d2.length) || ts.compareValues(d1.code, d2.code) || - compareMessageText(d1.messageText, d2.messageText) || 0 /* EqualTo */; + compareMessageText(d1.messageText, d2.messageText) || + 0 /* EqualTo */; } ts.compareDiagnosticsSkipRelatedInformation = compareDiagnosticsSkipRelatedInformation; function compareRelatedInformation(d1, d2) { @@ -20092,15 +20098,15 @@ var ts; var log2Base; switch (stringValue.charCodeAt(1)) { // "x" in "0x123" case 98 /* b */: - case 66 /* B */: + case 66 /* B */: // 0b or 0B log2Base = 1; break; case 111 /* o */: - case 79 /* O */: + case 79 /* O */: // 0o or 0O log2Base = 3; break; case 120 /* x */: - case 88 /* X */: + case 88 /* X */: // 0x or 0X log2Base = 4; break; default: // already in decimal; omit trailing "n" @@ -21767,7 +21773,8 @@ var ts; case 129 /* AsyncKeyword */: // 'async' modifier is ES2017 (async functions) or ES2018 (async generators) transformFlags = - 128 /* ContainsES2017 */ | 64 /* ContainsES2018 */; + 128 /* ContainsES2017 */ | + 64 /* ContainsES2018 */; break; case 122 /* PublicKeyword */: case 120 /* PrivateKeyword */: @@ -21787,7 +21794,7 @@ var ts; case 148 /* SymbolKeyword */: case 113 /* VoidKeyword */: case 152 /* UnknownKeyword */: - case 150 /* UndefinedKeyword */: + case 150 /* UndefinedKeyword */: // `undefined` is an Identifier in the expression case. transformFlags = 1 /* ContainsTypeScript */; break; case 123 /* StaticKeyword */: @@ -21900,7 +21907,9 @@ var ts; var node = createBaseNode(159 /* ComputedPropertyName */); node.expression = parenthesizerRules().parenthesizeExpressionOfComputedPropertyName(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 512 /* ContainsES2015 */ | 65536 /* ContainsComputedPropertyName */; + propagateChildFlags(node.expression) | + 512 /* ContainsES2015 */ | + 65536 /* ContainsComputedPropertyName */; return node; } // @api @@ -21968,7 +21977,9 @@ var ts; var node = createBaseNode(162 /* Decorator */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */ | 4096 /* ContainsTypeScriptClassSyntax */; + propagateChildFlags(node.expression) | + 1 /* ContainsTypeScript */ | + 4096 /* ContainsTypeScriptClassSyntax */; return node; } // @api @@ -22005,7 +22016,8 @@ var ts; node.exclamationToken = questionOrExclamationToken && ts.isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.transformFlags |= propagateChildFlags(node.questionToken) | - propagateChildFlags(node.exclamationToken) | 8388608 /* ContainsClassFields */; + propagateChildFlags(node.exclamationToken) | + 8388608 /* ContainsClassFields */; if (ts.isComputedPropertyName(node.name) || (ts.hasStaticModifier(node) && node.initializer)) { node.transformFlags |= 4096 /* ContainsTypeScriptClassSyntax */; } @@ -22052,7 +22064,8 @@ var ts; node.questionToken = questionToken; node.transformFlags |= propagateChildFlags(node.asteriskToken) | - propagateChildFlags(node.questionToken) | 512 /* ContainsES2015 */; + propagateChildFlags(node.questionToken) | + 512 /* ContainsES2015 */; if (questionToken) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -22580,10 +22593,13 @@ var ts; var node = createBaseNode(197 /* ObjectBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= - propagateChildrenFlags(node.elements) | 512 /* ContainsES2015 */ | 262144 /* ContainsBindingPattern */; + propagateChildrenFlags(node.elements) | + 512 /* ContainsES2015 */ | + 262144 /* ContainsBindingPattern */; if (node.transformFlags & 16384 /* ContainsRestOrSpread */) { node.transformFlags |= - 64 /* ContainsES2018 */ | 32768 /* ContainsObjectRestOrSpread */; + 64 /* ContainsES2018 */ | + 32768 /* ContainsObjectRestOrSpread */; } return node; } @@ -22598,7 +22614,9 @@ var ts; var node = createBaseNode(198 /* ArrayBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= - propagateChildrenFlags(node.elements) | 512 /* ContainsES2015 */ | 262144 /* ContainsBindingPattern */; + propagateChildrenFlags(node.elements) | + 512 /* ContainsES2015 */ | + 262144 /* ContainsBindingPattern */; return node; } // @api @@ -22615,7 +22633,8 @@ var ts; node.propertyName = asName(propertyName); node.dotDotDotToken = dotDotDotToken; node.transformFlags |= - propagateChildFlags(node.dotDotDotToken) | 512 /* ContainsES2015 */; + propagateChildFlags(node.dotDotDotToken) | + 512 /* ContainsES2015 */; if (node.propertyName) { node.transformFlags |= ts.isIdentifier(node.propertyName) ? propagateIdentifierNameFlags(node.propertyName) : @@ -22684,7 +22703,8 @@ var ts; // super method calls require a lexical 'this' // super method calls require 'super' hoisting in ES2017 and ES2018 async functions and async generators node.transformFlags |= - 128 /* ContainsES2017 */ | 64 /* ContainsES2018 */; + 128 /* ContainsES2017 */ | + 64 /* ContainsES2018 */; } return node; } @@ -22737,7 +22757,8 @@ var ts; // super method calls require a lexical 'this' // super method calls require 'super' hoisting in ES2017 and ES2018 async functions and async generators node.transformFlags |= - 128 /* ContainsES2017 */ | 64 /* ContainsES2018 */; + 128 /* ContainsES2017 */ | + 64 /* ContainsES2018 */; } return node; } @@ -22761,7 +22782,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.questionDotToken) | - propagateChildFlags(node.argumentExpression) | 16 /* ContainsES2020 */; + propagateChildFlags(node.argumentExpression) | + 16 /* ContainsES2020 */; return node; } // @api @@ -22819,7 +22841,8 @@ var ts; propagateChildFlags(node.expression) | propagateChildFlags(node.questionDotToken) | propagateChildrenFlags(node.typeArguments) | - propagateChildrenFlags(node.arguments) | 16 /* ContainsES2020 */; + propagateChildrenFlags(node.arguments) | + 16 /* ContainsES2020 */; if (node.typeArguments) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -22847,7 +22870,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.expression) | propagateChildrenFlags(node.typeArguments) | - propagateChildrenFlags(node.arguments) | 16 /* ContainsES2020 */; + propagateChildrenFlags(node.arguments) | + 16 /* ContainsES2020 */; if (node.typeArguments) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -22870,7 +22894,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.tag) | propagateChildrenFlags(node.typeArguments) | - propagateChildFlags(node.template) | 512 /* ContainsES2015 */; + propagateChildFlags(node.template) | + 512 /* ContainsES2015 */; if (node.typeArguments) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -22894,7 +22919,8 @@ var ts; node.type = type; node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildFlags(node.type) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.type) | + 1 /* ContainsTypeScript */; return node; } // @api @@ -22958,7 +22984,8 @@ var ts; /*name*/ undefined, typeParameters, parameters, type, parenthesizerRules().parenthesizeConciseBodyOfArrowFunction(body)); node.equalsGreaterThanToken = equalsGreaterThanToken !== null && equalsGreaterThanToken !== void 0 ? equalsGreaterThanToken : createToken(38 /* EqualsGreaterThanToken */); node.transformFlags |= - propagateChildFlags(node.equalsGreaterThanToken) | 512 /* ContainsES2015 */; + propagateChildFlags(node.equalsGreaterThanToken) | + 512 /* ContainsES2015 */; if (ts.modifiersToFlags(node.modifiers) & 256 /* Async */) { node.transformFlags |= 128 /* ContainsES2017 */; } @@ -23019,7 +23046,10 @@ var ts; var node = createBaseExpression(214 /* AwaitExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 128 /* ContainsES2017 */ | 64 /* ContainsES2018 */ | 1048576 /* ContainsAwait */; + propagateChildFlags(node.expression) | + 128 /* ContainsES2017 */ | + 64 /* ContainsES2018 */ | + 1048576 /* ContainsAwait */; return node; } // @api @@ -23074,12 +23104,15 @@ var ts; else if (operatorKind === 62 /* EqualsToken */) { if (ts.isObjectLiteralExpression(node.left)) { node.transformFlags |= - 512 /* ContainsES2015 */ | 64 /* ContainsES2018 */ | 2048 /* ContainsDestructuringAssignment */ | + 512 /* ContainsES2015 */ | + 64 /* ContainsES2018 */ | + 2048 /* ContainsDestructuringAssignment */ | propagateAssignmentPatternFlags(node.left); } else if (ts.isArrayLiteralExpression(node.left)) { node.transformFlags |= - 512 /* ContainsES2015 */ | 2048 /* ContainsDestructuringAssignment */ | + 512 /* ContainsES2015 */ | + 2048 /* ContainsDestructuringAssignment */ | propagateAssignmentPatternFlags(node.left); } } @@ -23155,7 +23188,8 @@ var ts; node.templateSpans = createNodeArray(templateSpans); node.transformFlags |= propagateChildFlags(node.head) | - propagateChildrenFlags(node.templateSpans) | 512 /* ContainsES2015 */; + propagateChildrenFlags(node.templateSpans) | + 512 /* ContainsES2015 */; return node; } // @api @@ -23224,7 +23258,10 @@ var ts; node.asteriskToken = asteriskToken; node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildFlags(node.asteriskToken) | 512 /* ContainsES2015 */ | 64 /* ContainsES2018 */ | 524288 /* ContainsYield */; + propagateChildFlags(node.asteriskToken) | + 512 /* ContainsES2015 */ | + 64 /* ContainsES2018 */ | + 524288 /* ContainsYield */; return node; } // @api @@ -23239,7 +23276,9 @@ var ts; var node = createBaseExpression(221 /* SpreadElement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 512 /* ContainsES2015 */ | 16384 /* ContainsRestOrSpread */; + propagateChildFlags(node.expression) | + 512 /* ContainsES2015 */ | + 16384 /* ContainsRestOrSpread */; return node; } // @api @@ -23276,7 +23315,8 @@ var ts; node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildrenFlags(node.typeArguments) | 512 /* ContainsES2015 */; + propagateChildrenFlags(node.typeArguments) | + 512 /* ContainsES2015 */; return node; } // @api @@ -23293,7 +23333,8 @@ var ts; node.type = type; node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildFlags(node.type) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.type) | + 1 /* ContainsTypeScript */; return node; } // @api @@ -23308,7 +23349,8 @@ var ts; var node = createBaseExpression(226 /* NonNullExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.expression) | + 1 /* ContainsTypeScript */; return node; } // @api @@ -23326,7 +23368,8 @@ var ts; node.flags |= 32 /* OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.expression) | + 1 /* ContainsTypeScript */; return node; } // @api @@ -23370,7 +23413,8 @@ var ts; node.literal = literal; node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildFlags(node.literal) | 512 /* ContainsES2015 */; + propagateChildFlags(node.literal) | + 512 /* ContainsES2015 */; return node; } // @api @@ -23546,7 +23590,8 @@ var ts; propagateChildFlags(node.awaitModifier) | propagateChildFlags(node.initializer) | propagateChildFlags(node.expression) | - propagateChildFlags(node.statement) | 512 /* ContainsES2015 */; + propagateChildFlags(node.statement) | + 512 /* ContainsES2015 */; if (awaitModifier) node.transformFlags |= 64 /* ContainsES2018 */; return node; @@ -23565,7 +23610,8 @@ var ts; var node = createBaseNode(241 /* ContinueStatement */); node.label = asName(label); node.transformFlags |= - propagateChildFlags(node.label) | 2097152 /* ContainsHoistedDeclarationOrCompletion */; + propagateChildFlags(node.label) | + 2097152 /* ContainsHoistedDeclarationOrCompletion */; return node; } // @api @@ -23579,7 +23625,8 @@ var ts; var node = createBaseNode(242 /* BreakStatement */); node.label = asName(label); node.transformFlags |= - propagateChildFlags(node.label) | 2097152 /* ContainsHoistedDeclarationOrCompletion */; + propagateChildFlags(node.label) | + 2097152 /* ContainsHoistedDeclarationOrCompletion */; return node; } // @api @@ -23594,7 +23641,9 @@ var ts; node.expression = expression; // return in an ES2018 async generator must be awaited node.transformFlags |= - propagateChildFlags(node.expression) | 64 /* ContainsES2018 */ | 2097152 /* ContainsHoistedDeclarationOrCompletion */; + propagateChildFlags(node.expression) | + 64 /* ContainsES2018 */ | + 2097152 /* ContainsHoistedDeclarationOrCompletion */; return node; } // @api @@ -23719,10 +23768,12 @@ var ts; node.flags |= flags & 3 /* BlockScoped */; node.declarations = createNodeArray(declarations); node.transformFlags |= - propagateChildrenFlags(node.declarations) | 2097152 /* ContainsHoistedDeclarationOrCompletion */; + propagateChildrenFlags(node.declarations) | + 2097152 /* ContainsHoistedDeclarationOrCompletion */; if (flags & 3 /* BlockScoped */) { node.transformFlags |= - 512 /* ContainsES2015 */ | 131072 /* ContainsBlockScopedBinding */; + 512 /* ContainsES2015 */ | + 131072 /* ContainsBlockScopedBinding */; } return node; } @@ -23741,7 +23792,8 @@ var ts; } else { node.transformFlags |= - propagateChildFlags(node.asteriskToken) | 2097152 /* ContainsHoistedDeclarationOrCompletion */; + propagateChildFlags(node.asteriskToken) | + 2097152 /* ContainsHoistedDeclarationOrCompletion */; if (ts.modifiersToFlags(node.modifiers) & 256 /* Async */) { if (node.asteriskToken) { node.transformFlags |= 64 /* ContainsES2018 */; @@ -23834,7 +23886,8 @@ var ts; var node = createBaseNamedDeclaration(256 /* EnumDeclaration */, decorators, modifiers, name); node.members = createNodeArray(members); node.transformFlags |= - propagateChildrenFlags(node.members) | 1 /* ContainsTypeScript */; + propagateChildrenFlags(node.members) | + 1 /* ContainsTypeScript */; node.transformFlags &= ~16777216 /* ContainsPossibleTopLevelAwait */; // Enum declarations cannot contain `await` return node; } @@ -23860,7 +23913,8 @@ var ts; else { node.transformFlags |= propagateChildFlags(node.name) | - propagateChildFlags(node.body) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.body) | + 1 /* ContainsTypeScript */; } node.transformFlags &= ~16777216 /* ContainsPossibleTopLevelAwait */; // Module declarations cannot contain `await`. return node; @@ -23997,7 +24051,8 @@ var ts; var node = createBaseNode(270 /* NamespaceExport */); node.name = name; node.transformFlags |= - propagateChildFlags(node.name) | 4 /* ContainsESNext */; + propagateChildFlags(node.name) | + 4 /* ContainsESNext */; node.transformFlags &= ~16777216 /* ContainsPossibleTopLevelAwait */; // always parsed in an Await context return node; } @@ -24503,7 +24558,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.openingElement) | propagateChildrenFlags(node.children) | - propagateChildFlags(node.closingElement) | 2 /* ContainsJsx */; + propagateChildFlags(node.closingElement) | + 2 /* ContainsJsx */; return node; } // @api @@ -24523,7 +24579,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.tagName) | propagateChildrenFlags(node.typeArguments) | - propagateChildFlags(node.attributes) | 2 /* ContainsJsx */; + propagateChildFlags(node.attributes) | + 2 /* ContainsJsx */; if (node.typeArguments) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -24546,7 +24603,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.tagName) | propagateChildrenFlags(node.typeArguments) | - propagateChildFlags(node.attributes) | 2 /* ContainsJsx */; + propagateChildFlags(node.attributes) | + 2 /* ContainsJsx */; if (typeArguments) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -24565,7 +24623,8 @@ var ts; var node = createBaseNode(277 /* JsxClosingElement */); node.tagName = tagName; node.transformFlags |= - propagateChildFlags(node.tagName) | 2 /* ContainsJsx */; + propagateChildFlags(node.tagName) | + 2 /* ContainsJsx */; return node; } // @api @@ -24583,7 +24642,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.openingFragment) | propagateChildrenFlags(node.children) | - propagateChildFlags(node.closingFragment) | 2 /* ContainsJsx */; + propagateChildFlags(node.closingFragment) | + 2 /* ContainsJsx */; return node; } // @api @@ -24628,7 +24688,8 @@ var ts; node.initializer = initializer; node.transformFlags |= propagateChildFlags(node.name) | - propagateChildFlags(node.initializer) | 2 /* ContainsJsx */; + propagateChildFlags(node.initializer) | + 2 /* ContainsJsx */; return node; } // @api @@ -24643,7 +24704,8 @@ var ts; var node = createBaseNode(282 /* JsxAttributes */); node.properties = createNodeArray(properties); node.transformFlags |= - propagateChildrenFlags(node.properties) | 2 /* ContainsJsx */; + propagateChildrenFlags(node.properties) | + 2 /* ContainsJsx */; return node; } // @api @@ -24657,7 +24719,8 @@ var ts; var node = createBaseNode(283 /* JsxSpreadAttribute */); node.expression = expression; node.transformFlags |= - propagateChildFlags(node.expression) | 2 /* ContainsJsx */; + propagateChildFlags(node.expression) | + 2 /* ContainsJsx */; return node; } // @api @@ -24673,7 +24736,8 @@ var ts; node.expression = expression; node.transformFlags |= propagateChildFlags(node.dotDotDotToken) | - propagateChildFlags(node.expression) | 2 /* ContainsJsx */; + propagateChildFlags(node.expression) | + 2 /* ContainsJsx */; return node; } // @api @@ -24802,7 +24866,8 @@ var ts; /*modifiers*/ undefined, name); node.objectAssignmentInitializer = objectAssignmentInitializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(objectAssignmentInitializer); node.transformFlags |= - propagateChildFlags(node.objectAssignmentInitializer) | 512 /* ContainsES2015 */; + propagateChildFlags(node.objectAssignmentInitializer) | + 512 /* ContainsES2015 */; return node; } function finishUpdateShorthandPropertyAssignment(updated, original) { @@ -24831,7 +24896,9 @@ var ts; var node = createBaseNode(291 /* SpreadAssignment */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 64 /* ContainsES2018 */ | 32768 /* ContainsObjectRestOrSpread */; + propagateChildFlags(node.expression) | + 64 /* ContainsES2018 */ | + 32768 /* ContainsObjectRestOrSpread */; return node; } // @api @@ -24850,7 +24917,8 @@ var ts; node.initializer = initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= propagateChildFlags(node.name) | - propagateChildFlags(node.initializer) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.initializer) | + 1 /* ContainsTypeScript */; return node; } // @api @@ -25026,7 +25094,8 @@ var ts; node.expression = expression; node.original = original; node.transformFlags |= - propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.expression) | + 1 /* ContainsTypeScript */; ts.setTextRange(node, original); return node; } @@ -30155,23 +30224,20 @@ var ts; return inContext(32768 /* AwaitContext */); } function parseErrorAtCurrentToken(message, arg0) { - return parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0); + parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0); } function parseErrorAtPosition(start, length, message, arg0) { // Don't report another error if it would just be at the same position as the last error. var lastError = ts.lastOrUndefined(parseDiagnostics); - var result; if (!lastError || start !== lastError.start) { - result = ts.createDetachedDiagnostic(fileName, start, length, message, arg0); - parseDiagnostics.push(result); + parseDiagnostics.push(ts.createDetachedDiagnostic(fileName, start, length, message, arg0)); } // Mark that we've encountered an error. We'll set an appropriate bit on the next // node we finish so that it can't be reused incrementally. parseErrorBeforeNextFinishedNode = true; - return result; } function parseErrorAt(start, end, message, arg0) { - return parseErrorAtPosition(start, end - start, message, arg0); + parseErrorAtPosition(start, end - start, message, arg0); } function parseErrorAtRange(range, message, arg0) { parseErrorAt(range.pos, range.end, message, arg0); @@ -30328,16 +30394,6 @@ var ts; parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind)); return false; } - function parseExpectedMatchingBrackets(openKind, closeKind, openPosition) { - if (token() === closeKind) { - nextToken(); - return; - } - var lastError = parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(closeKind)); - if (lastError) { - ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openPosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, ts.tokenToString(openKind), ts.tokenToString(closeKind))); - } - } function parseOptional(t) { if (token() === t) { nextToken(); @@ -30626,7 +30682,7 @@ var ts; case 22 /* OpenBracketToken */: case 41 /* AsteriskToken */: case 25 /* DotDotDotToken */: - case 24 /* DotToken */: + case 24 /* DotToken */: // Not an object literal member, but don't want to close the object (see `tests/cases/fourslash/completionsDotInObjectLiteral.ts`) return true; default: return isLiteralPropertyName(); @@ -30659,7 +30715,7 @@ var ts; case 15 /* ArrayLiteralMembers */: switch (token()) { case 27 /* CommaToken */: - case 24 /* DotToken */: + case 24 /* DotToken */: // Not an array literal member, but don't want to close the array (see `tests/cases/fourslash/completionsDotInArrayLiteralInObjectLiteral.ts`) return true; } // falls through @@ -33621,7 +33677,7 @@ var ts; case 50 /* AmpersandToken */: // foo & case 51 /* BarToken */: // foo | case 19 /* CloseBraceToken */: // foo } - case 1 /* EndOfFileToken */: + case 1 /* EndOfFileToken */: // foo // these cases can't legally follow a type arg list. However, they're not legal // expressions either. The user is probably in the middle of a generic type. So // treat it as such. @@ -33705,11 +33761,10 @@ var ts; } function parseArrayLiteralExpression() { var pos = getNodePos(); - var openBracketPosition = scanner.getTokenPos(); parseExpected(22 /* OpenBracketToken */); var multiLine = scanner.hasPrecedingLineBreak(); var elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement); - parseExpectedMatchingBrackets(22 /* OpenBracketToken */, 23 /* CloseBracketToken */, openBracketPosition); + parseExpected(23 /* CloseBracketToken */); return finishNode(factory.createArrayLiteralExpression(elements, multiLine), pos); } function parseObjectLiteralElement() { @@ -33769,7 +33824,12 @@ var ts; parseExpected(18 /* OpenBraceToken */); var multiLine = scanner.hasPrecedingLineBreak(); var properties = parseDelimitedList(12 /* ObjectLiteralMembers */, parseObjectLiteralElement, /*considerSemicolonAsDelimiter*/ true); - parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBracePosition); + if (!parseExpected(19 /* CloseBraceToken */)) { + var lastError = ts.lastOrUndefined(parseDiagnostics); + if (lastError && lastError.code === ts.Diagnostics._0_expected.code) { + ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here)); + } + } return finishNode(factory.createObjectLiteralExpression(properties, multiLine), pos); } function parseFunctionExpression() { @@ -33843,7 +33903,12 @@ var ts; if (parseExpected(18 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { var multiLine = scanner.hasPrecedingLineBreak(); var statements = parseList(1 /* BlockStatements */, parseStatement); - parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBracePosition); + if (!parseExpected(19 /* CloseBraceToken */)) { + var lastError = ts.lastOrUndefined(parseDiagnostics); + if (lastError && lastError.code === ts.Diagnostics._0_expected.code) { + ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here)); + } + } var result = withJSDoc(finishNode(factory.createBlock(statements, multiLine), pos), hasJSDoc); if (token() === 62 /* EqualsToken */) { parseErrorAtCurrentToken(ts.Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses); @@ -33888,10 +33953,9 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(98 /* IfKeyword */); - var openParenPosition = scanner.getTokenPos(); parseExpected(20 /* OpenParenToken */); var expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition); + parseExpected(21 /* CloseParenToken */); var thenStatement = parseStatement(); var elseStatement = parseOptional(90 /* ElseKeyword */) ? parseStatement() : undefined; return withJSDoc(finishNode(factory.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc); @@ -33902,10 +33966,9 @@ var ts; parseExpected(89 /* DoKeyword */); var statement = parseStatement(); parseExpected(114 /* WhileKeyword */); - var openParenPosition = scanner.getTokenPos(); parseExpected(20 /* OpenParenToken */); var expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition); + parseExpected(21 /* CloseParenToken */); // From: https://mail.mozilla.org/pipermail/es-discuss/2011-August/016188.html // 157 min --- All allen at wirfs-brock.com CONF --- "do{;}while(false)false" prohibited in // spec but allowed in consensus reality. Approved -- this is the de-facto standard whereby @@ -33917,10 +33980,9 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(114 /* WhileKeyword */); - var openParenPosition = scanner.getTokenPos(); parseExpected(20 /* OpenParenToken */); var expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition); + parseExpected(21 /* CloseParenToken */); var statement = parseStatement(); return withJSDoc(finishNode(factory.createWhileStatement(expression, statement), pos), hasJSDoc); } @@ -33987,10 +34049,9 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(115 /* WithKeyword */); - var openParenPosition = scanner.getTokenPos(); parseExpected(20 /* OpenParenToken */); var expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition); + parseExpected(21 /* CloseParenToken */); var statement = doInsideOfContext(16777216 /* InWithStatement */, parseStatement); return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc); } @@ -34693,7 +34754,7 @@ var ts; case 53 /* ExclamationToken */: // Non-null assertion on property name case 58 /* ColonToken */: // Type Annotation for declaration case 62 /* EqualsToken */: // Initializer for declaration - case 57 /* QuestionToken */: + case 57 /* QuestionToken */: // Not valid, but permitted so that it gets caught later on. return true; default: // Covers @@ -35981,7 +36042,8 @@ var ts; hasChildren = true; if (child.kind === 333 /* JSDocTypeTag */) { if (childTypeTag) { - var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); + parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); + var lastError = ts.lastOrUndefined(parseDiagnostics); if (lastError) { ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, 0, 0, ts.Diagnostics.The_tag_was_first_specified_here)); } @@ -43233,7 +43295,8 @@ var ts; // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = prop.kind === 289 /* PropertyAssignment */ || prop.kind === 290 /* ShorthandPropertyAssignment */ || prop.kind === 166 /* MethodDeclaration */ - ? 1 /* Property */ : 2 /* Accessor */; + ? 1 /* Property */ + : 2 /* Accessor */; var existingKind = seen.get(identifier.escapedText); if (!existingKind) { seen.set(identifier.escapedText, currentKind); @@ -43754,7 +43817,7 @@ var ts; case 252 /* FunctionDeclaration */: return bindFunctionDeclaration(node); case 167 /* Constructor */: - return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, 0 /* None */); + return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); case 168 /* GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 46015 /* GetAccessorExcludes */); case 169 /* SetAccessor */: @@ -43847,7 +43910,8 @@ var ts; case 337 /* JSDocPropertyTag */: var propTag = node; var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 308 /* JSDocOptionalType */ ? - 4 /* Property */ | 16777216 /* Optional */ : 4 /* Property */; + 4 /* Property */ | 16777216 /* Optional */ : + 4 /* Property */; return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* PropertyExcludes */); case 335 /* JSDocTypedefTag */: case 328 /* JSDocCallbackTag */: @@ -43885,9 +43949,9 @@ var ts; else { var flags = ts.exportAssignmentIsAlias(node) // An export default clause with an EntityNameExpression or a class expression exports all meanings of that identifier or expression; - ? 2097152 /* Alias */ - // An export default clause with any other expression exports a value - : 4 /* Property */; + ? 2097152 /* Alias */ + // An export default clause with any other expression exports a value + : 4 /* Property */; // If there is an `export default x;` alias declaration, can't `export default` anything else. // (In contrast, you can still have `export default function f() {}` and `export default interface I {}`.) var symbol = declareSymbol(container.symbol.exports, container.symbol, node, flags, 67108863 /* All */); @@ -43996,7 +44060,8 @@ var ts; } // 'module.exports = expr' assignment var flags = ts.exportAssignmentIsAlias(node) - ? 2097152 /* Alias */ : 4 /* Property */ | 1048576 /* ExportValue */ | 512 /* ValueModule */; + ? 2097152 /* Alias */ + : 4 /* Property */ | 1048576 /* ExportValue */ | 512 /* ValueModule */; var symbol = declareSymbol(file.symbol.exports, file.symbol, node, flags | 67108864 /* Assignment */, 0 /* None */); ts.setValueDeclaration(symbol, node); } @@ -46781,7 +46846,7 @@ var ts; case 254 /* InterfaceDeclaration */: case 256 /* EnumDeclaration */: case 255 /* TypeAliasDeclaration */: - case 257 /* ModuleDeclaration */: + case 257 /* ModuleDeclaration */: // For `namespace N { N; }` return true; default: return false; @@ -50706,7 +50771,8 @@ var ts; // A Class + Property merge is made for a `module.exports.Member = class {}`, and it doesn't serialize well as either a class _or_ a property symbol - in fact, _it behaves like an alias!_ // `var` is `FunctionScopedVariable`, `const` and `let` are `BlockScopedVariable`, and `module.exports.thing =` is `Property` var flags = !(symbol.flags & 2 /* BlockScopedVariable */) ? undefined - : isConstVariable(symbol) ? 2 /* Const */ : 1 /* Let */; + : isConstVariable(symbol) ? 2 /* Const */ + : 1 /* Let */; var name = (needsPostExportDefault || !(symbol.flags & 4 /* Property */)) ? localName : getUnusedName(localName, symbol); var textRange = symbol.declarations && ts.find(symbol.declarations, function (d) { return ts.isVariableDeclaration(d); }); if (textRange && ts.isVariableDeclarationList(textRange.parent) && textRange.parent.declarations.length === 1) { @@ -51346,7 +51412,9 @@ var ts; ], 2 /* Const */)); // Inlined JSON types exported with [module.]exports= will already emit an export=, so should use `declare`. // Otherwise, the type itself should be exported. - addResult(statement, target && target.flags & 4 /* Property */ && target.escapedName === "export=" /* ExportEquals */ ? 2 /* Ambient */ : name === varName ? 1 /* Export */ : 0 /* None */); + addResult(statement, target && target.flags & 4 /* Property */ && target.escapedName === "export=" /* ExportEquals */ ? 2 /* Ambient */ + : name === varName ? 1 /* Export */ + : 0 /* None */); } if (isExportAssignmentCompatibleSymbolName) { results.push(ts.factory.createExportAssignment( @@ -56808,7 +56876,8 @@ var ts; return getRestTypeElementFlags(node); case 193 /* NamedTupleMember */: return node.questionToken ? 2 /* Optional */ : - node.dotDotDotToken ? getRestTypeElementFlags(node) : 1 /* Required */; + node.dotDotDotToken ? getRestTypeElementFlags(node) : + 1 /* Required */; default: return 1 /* Required */; } @@ -57385,7 +57454,7 @@ var ts; } function createUnionType(types, aliasSymbol, aliasTypeArguments, origin) { var result = createType(1048576 /* Union */); - result.objectFlags = getPropagatingFlagsOfTypes(types, 98304 /* Nullable */); + result.objectFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 98304 /* Nullable */); result.types = types; result.origin = origin; result.aliasSymbol = aliasSymbol; @@ -57573,7 +57642,7 @@ var ts; } function createIntersectionType(types, aliasSymbol, aliasTypeArguments) { var result = createType(2097152 /* Intersection */); - result.objectFlags = getPropagatingFlagsOfTypes(types, 98304 /* Nullable */); + result.objectFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 98304 /* Nullable */); result.types = types; result.aliasSymbol = aliasSymbol; result.aliasTypeArguments = aliasTypeArguments; @@ -59596,7 +59665,7 @@ var ts; case 209 /* FunctionExpression */: case 210 /* ArrowFunction */: case 166 /* MethodDeclaration */: - case 252 /* FunctionDeclaration */: + case 252 /* FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type return isContextSensitiveFunctionLikeDeclaration(node); case 201 /* ObjectLiteralExpression */: return ts.some(node.properties, isContextSensitive); @@ -60320,7 +60389,8 @@ var ts; } } var related = source.type === target.type ? -1 /* True */ : - source.type && target.type ? compareTypes(source.type, target.type, reportErrors) : 0 /* False */; + source.type && target.type ? compareTypes(source.type, target.type, reportErrors) : + 0 /* False */; if (related === 0 /* False */ && reportErrors) { errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); } @@ -62393,8 +62463,10 @@ var ts; } var sourceIsJSConstructor = source.symbol && isJSConstructor(source.symbol.valueDeclaration); var targetIsJSConstructor = target.symbol && isJSConstructor(target.symbol.valueDeclaration); - var sourceSignatures = getSignaturesOfType(source, (sourceIsJSConstructor && kind === 1 /* Construct */) ? 0 /* Call */ : kind); - var targetSignatures = getSignaturesOfType(target, (targetIsJSConstructor && kind === 1 /* Construct */) ? 0 /* Call */ : kind); + var sourceSignatures = getSignaturesOfType(source, (sourceIsJSConstructor && kind === 1 /* Construct */) ? + 0 /* Call */ : kind); + var targetSignatures = getSignaturesOfType(target, (targetIsJSConstructor && kind === 1 /* Construct */) ? + 0 /* Call */ : kind); if (kind === 1 /* Construct */ && sourceSignatures.length && targetSignatures.length) { var sourceIsAbstract = !!(sourceSignatures[0].flags & 4 /* Abstract */); var targetIsAbstract = !!(targetSignatures[0].flags & 4 /* Abstract */); @@ -63076,7 +63148,8 @@ var ts; function compareTypePredicatesIdentical(source, target, compareTypes) { return !(source && target && typePredicateKindsMatch(source, target)) ? 0 /* False */ : source.type === target.type ? -1 /* True */ : - source.type && target.type ? compareTypes(source.type, target.type) : 0 /* False */; + source.type && target.type ? compareTypes(source.type, target.type) : + 0 /* False */; } function literalTypesWithSameBaseType(types) { var commonBaseType; @@ -64515,7 +64588,9 @@ var ts; // We assign a lower priority to inferences made from types containing non-inferrable // types because we may only have a partial result (i.e. we may have failed to make // reverse inferences for some properties). - inferWithPriority(inferredType, inference.typeParameter, ts.getObjectFlags(source) & 524288 /* NonInferrableType */ ? 16 /* PartialHomomorphicMappedType */ : 8 /* HomomorphicMappedType */); + inferWithPriority(inferredType, inference.typeParameter, ts.getObjectFlags(source) & 524288 /* NonInferrableType */ ? + 16 /* PartialHomomorphicMappedType */ : + 8 /* HomomorphicMappedType */); } } return true; @@ -66962,7 +67037,7 @@ var ts; return !!ts.findAncestor(location, function (e) { return e.parent && ts.isExportAssignment(e.parent) && e.parent.expression === e && ts.isEntityNameExpression(e); }); } function markAliasReferenced(symbol, location) { - if (isNonLocalAlias(symbol, 111551 /* Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) { + if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) { var target = resolveAlias(symbol); if (target.flags & 111551 /* Value */) { // An alias resolving to a const enum cannot be elided if (1) 'isolatedModules' is enabled @@ -70365,7 +70440,8 @@ var ts; } var effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType; var accessFlags = ts.isAssignmentTarget(node) ? - 2 /* Writing */ | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 1 /* NoIndexSignatures */ : 0) : 0 /* None */; + 2 /* Writing */ | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 1 /* NoIndexSignatures */ : 0) : + 0 /* None */; var indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, /*noUncheckedIndexedAccessCandidate*/ undefined, node, accessFlags | 16 /* ExpressionPosition */) || errorType; return checkIndexedAccessIndexType(getFlowTypeOfAccessExpression(node, getNodeLinks(node).resolvedSymbol, indexedAccessType, indexExpression, checkMode), node); } @@ -71275,14 +71351,14 @@ var ts; var i_1 = 0; var _loop_22 = function (c) { var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); }; - var diags_3 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* Normal */, /*reportErrors*/ true, chain_2); - if (diags_3) { - if (diags_3.length <= min_3) { - min_3 = diags_3.length; + var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* Normal */, /*reportErrors*/ true, chain_2); + if (diags_2) { + if (diags_2.length <= min_3) { + min_3 = diags_2.length; minIndex = i_1; } - max = Math.max(max, diags_3.length); - allDiagnostics.push(diags_3); + max = Math.max(max, diags_2.length); + allDiagnostics.push(diags_2); } else { ts.Debug.fail("No error for 3 or fewer overload signatures"); @@ -71293,15 +71369,15 @@ var ts; var c = candidatesForArgumentError_1[_a]; _loop_22(c); } - var diags_2 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics); - ts.Debug.assert(diags_2.length > 0, "No errors reported for 3 or fewer overload signatures"); - var chain = ts.chainDiagnosticMessages(ts.map(diags_2, function (d) { return typeof d.messageText === "string" ? d : d.messageText; }), ts.Diagnostics.No_overload_matches_this_call); + var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics); + ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures"); + var chain = ts.chainDiagnosticMessages(ts.map(diags_3, function (d) { return typeof d.messageText === "string" ? d : d.messageText; }), ts.Diagnostics.No_overload_matches_this_call); // The below is a spread to guarantee we get a new (mutable) array - our `flatMap` helper tries to do "smart" optimizations where it reuses input // arrays and the emptyArray singleton where possible, which is decidedly not what we want while we're still constructing this diagnostic - var related = __spreadArray([], ts.flatMap(diags_2, function (d) { return d.relatedInformation; })); + var related = __spreadArray([], ts.flatMap(diags_3, function (d) { return d.relatedInformation; })); var diag = void 0; - if (ts.every(diags_2, function (d) { return d.start === diags_2[0].start && d.length === diags_2[0].length && d.file === diags_2[0].file; })) { - var _b = diags_2[0], file = _b.file, start = _b.start, length_7 = _b.length; + if (ts.every(diags_3, function (d) { return d.start === diags_3[0].start && d.length === diags_3[0].length && d.file === diags_3[0].file; })) { + var _b = diags_3[0], file = _b.file, start = _b.start, length_7 = _b.length; diag = { file: file, start: start, length: length_7, code: chain.code, category: chain.category, messageText: chain, relatedInformation: related }; } else { @@ -71563,7 +71639,8 @@ var ts; if (ts.isCallChain(node)) { var nonOptionalType = getOptionalExpressionType(funcType, node.expression); callChainFlags = nonOptionalType === funcType ? 0 /* None */ : - ts.isOutermostOptionalChain(node) ? 16 /* IsOuterCallChain */ : 8 /* IsInnerCallChain */; + ts.isOutermostOptionalChain(node) ? 16 /* IsOuterCallChain */ : + 8 /* IsInnerCallChain */; funcType = nonOptionalType; } else { @@ -72340,8 +72417,10 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 /* Function */ - ? 252 /* FunctionDeclaration */ : resolvedRequire.flags & 3 /* Variable */ - ? 250 /* VariableDeclaration */ : 0 /* Unknown */; + ? 252 /* FunctionDeclaration */ + : resolvedRequire.flags & 3 /* Variable */ + ? 250 /* VariableDeclaration */ + : 0 /* Unknown */; if (targetDeclarationKind !== 0 /* Unknown */) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); // function/variable declaration should be ambient @@ -75999,7 +76078,7 @@ var ts; case 199 /* BindingElement */: case 252 /* FunctionDeclaration */: case 266 /* ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 - case 78 /* Identifier */: + case 78 /* Identifier */: // https://github.com/microsoft/TypeScript/issues/36098 // Identifiers are used as declarations of assignment declarations whose parents may be // SyntaxKind.CallExpression - `Object.defineProperty(thing, "aField", {value: 42});` // SyntaxKind.ElementAccessExpression - `thing["aField"] = 42;` or `thing["aField"];` (with a doc comment on it) @@ -77275,7 +77354,12 @@ var ts; if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) { return false; } - var interestingFlags = 8 /* Private */ | 16 /* Protected */ | 256 /* Async */ | 128 /* Abstract */ | 64 /* Readonly */ | 32 /* Static */; + var interestingFlags = 8 /* Private */ | + 16 /* Protected */ | + 256 /* Async */ | + 128 /* Abstract */ | + 64 /* Readonly */ | + 32 /* Static */; return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags); } function checkVariableDeclaration(node) { @@ -78996,9 +79080,9 @@ var ts; ts.forEach(properties, function (p) { seen.set(p.escapedName, p); }); for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { var base = baseTypes_2[_i]; - var properties_4 = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)); - for (var _a = 0, properties_5 = properties_4; _a < properties_5.length; _a++) { - var prop = properties_5[_a]; + var properties_5 = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)); + for (var _a = 0, properties_4 = properties_5; _a < properties_4.length; _a++) { + var prop = properties_4[_a]; var existing = seen.get(prop.escapedName); if (existing && !isPropertyIdenticalTo(existing, prop)) { seen.delete(prop.escapedName); @@ -80701,7 +80785,7 @@ var ts; } } if (name.parent.kind === 173 /* TypePredicate */) { - return resolveEntityName(name, 1 /* FunctionScopedVariable */); + return resolveEntityName(name, /*meaning*/ 1 /* FunctionScopedVariable */); } return undefined; } @@ -81090,7 +81174,7 @@ var ts; var symbol = getReferencedValueSymbol(node); // We should only get the declaration of an alias if there isn't a local value // declaration for the symbol - if (isNonLocalAlias(symbol, 111551 /* Value */) && !getTypeOnlyAliasDeclaration(symbol)) { + if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* Value */) && !getTypeOnlyAliasDeclaration(symbol)) { return getDeclarationOfAliasSymbol(symbol); } } @@ -88643,7 +88727,9 @@ var ts; } function visitPrefixUnaryExpression(node) { if (shouldTransformPrivateElements && ts.isPrivateIdentifierPropertyAccessExpression(node.operand)) { - var operator = node.operator === 45 /* PlusPlusToken */ ? 39 /* PlusToken */ : node.operator === 46 /* MinusMinusToken */ ? 40 /* MinusToken */ : undefined; + var operator = node.operator === 45 /* PlusPlusToken */ ? + 39 /* PlusToken */ : node.operator === 46 /* MinusMinusToken */ ? + 40 /* MinusToken */ : undefined; var info = void 0; if (operator && (info = accessPrivateIdentifier(node.operand.name))) { var receiver = ts.visitNode(node.operand.expression, visitor, ts.isExpression); @@ -88656,7 +88742,9 @@ var ts; } function visitPostfixUnaryExpression(node, valueIsDiscarded) { if (shouldTransformPrivateElements && ts.isPrivateIdentifierPropertyAccessExpression(node.operand)) { - var operator = node.operator === 45 /* PlusPlusToken */ ? 39 /* PlusToken */ : node.operator === 46 /* MinusMinusToken */ ? 40 /* MinusToken */ : undefined; + var operator = node.operator === 45 /* PlusPlusToken */ ? + 39 /* PlusToken */ : node.operator === 46 /* MinusMinusToken */ ? + 40 /* MinusToken */ : undefined; var info = void 0; if (operator && (info = accessPrivateIdentifier(node.operand.name))) { var receiver = ts.visitNode(node.operand.expression, visitor, ts.isExpression); @@ -88796,10 +88884,11 @@ var ts; return ts.visitEachChild(node, visitor, context); } var staticProperties = ts.getProperties(node, /*requireInitializer*/ false, /*isStatic*/ true); + var pendingPrivateStateAssignment; if (shouldTransformPrivateElements && ts.some(node.members, function (m) { return ts.hasStaticModifier(m) && !!m.name && ts.isPrivateIdentifier(m.name); })) { var temp = factory.createTempVariable(hoistVariableDeclaration, /* reservedInNestedScopes */ true); getPrivateIdentifierEnvironment().classConstructor = factory.cloneNode(temp); - getPendingExpressions().push(factory.createAssignment(temp, factory.getInternalName(node))); + pendingPrivateStateAssignment = factory.createAssignment(temp, factory.getInternalName(node)); } var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 103 /* NullKeyword */); @@ -88808,6 +88897,9 @@ var ts; /*decorators*/ undefined, node.modifiers, node.name, /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)) ]; + if (pendingPrivateStateAssignment) { + getPendingExpressions().unshift(pendingPrivateStateAssignment); + } // Write any pending expressions from elided or moved computed property names if (ts.some(pendingExpressions)) { statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))); @@ -90371,7 +90463,9 @@ var ts; return ts.visitEachChild(node, expressionResultIsUnused ? visitorWithUnusedExpressionResult : visitor, context); } function visitSourceFile(node) { - var ancestorFacts = enterSubtree(2 /* SourceFileExcludes */, ts.isEffectiveStrictModeSourceFile(node, compilerOptions) ? 0 /* StrictModeSourceFileIncludes */ : 1 /* SourceFileIncludes */); + var ancestorFacts = enterSubtree(2 /* SourceFileExcludes */, ts.isEffectiveStrictModeSourceFile(node, compilerOptions) ? + 0 /* StrictModeSourceFileIncludes */ : + 1 /* SourceFileIncludes */); exportedVariableStatement = false; var visited = ts.visitEachChild(node, visitor, context); var statement = ts.concatenate(visited.statements, taggedTemplateStringDeclarations && [ @@ -101289,7 +101383,13 @@ var ts; }); } ts.isInternalDeclaration = isInternalDeclaration; - var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */; + var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | + 2048 /* WriteClassExpressionAsTypeLiteral */ | + 4096 /* UseTypeOfFunction */ | + 8 /* UseStructuralFallback */ | + 524288 /* AllowEmptyTuple */ | + 4 /* GenerateNamesForShadowedTypeParams */ | + 1 /* NoTruncation */; /** * Transforms a ts file into a .d.ts file * This process requires type information, which is retrieved through the emit resolver. Because of this, @@ -102190,7 +102290,7 @@ var ts; } var previousNeedsDeclare = needsDeclare; switch (input.kind) { - case 255 /* TypeAliasDeclaration */: + case 255 /* TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all return cleanup(factory.updateTypeAliasDeclaration(input, /*decorators*/ undefined, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); case 254 /* InterfaceDeclaration */: { @@ -103278,8 +103378,11 @@ var ts; if (configFile.options.emitDeclarationOnly) return undefined; var isJsonFile = ts.fileExtensionIs(inputFileName, ".json" /* Json */); - var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory), isJsonFile ? ".json" /* Json */ : - configFile.options.jsx === 1 /* Preserve */ && (ts.fileExtensionIs(inputFileName, ".tsx" /* Tsx */) || ts.fileExtensionIs(inputFileName, ".jsx" /* Jsx */)) ? ".jsx" /* Jsx */ : ".js" /* Js */); + var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory), isJsonFile ? + ".json" /* Json */ : + configFile.options.jsx === 1 /* Preserve */ && (ts.fileExtensionIs(inputFileName, ".tsx" /* Tsx */) || ts.fileExtensionIs(inputFileName, ".jsx" /* Jsx */)) ? + ".jsx" /* Jsx */ : + ".js" /* Js */); return !isJsonFile || ts.comparePaths(inputFileName, outputFileName, ts.Debug.checkDefined(configFile.options.configFilePath), ignoreCase) !== 0 /* EqualTo */ ? outputFileName : undefined; @@ -104846,7 +104949,9 @@ var ts; var pos = getTextPosWithWriteLine(); writeUnparsedNode(unparsed); if (bundleFileInfo) { - updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 295 /* UnparsedText */ ? "text" /* Text */ : "internal" /* Internal */); + updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 295 /* UnparsedText */ ? + "text" /* Text */ : + "internal" /* Internal */); } } // SyntaxKind.UnparsedSyntheticReference @@ -114368,7 +114473,8 @@ var ts; return { relativePreference: importModuleSpecifierPreference === "relative" ? 0 /* Relative */ : importModuleSpecifierPreference === "non-relative" ? 1 /* NonRelative */ : - importModuleSpecifierPreference === "project-relative" ? 3 /* ExternalNonRelative */ : 2 /* Shortest */, + importModuleSpecifierPreference === "project-relative" ? 3 /* ExternalNonRelative */ : + 2 /* Shortest */, ending: getEnding(), }; function getEnding() { @@ -114376,14 +114482,16 @@ var ts; case "minimal": return 0 /* Minimal */; case "index": return 1 /* Index */; case "js": return 2 /* JsExtension */; - default: return usesJsExtensionOnImports(importingSourceFile) ? 2 /* JsExtension */ : ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeJs ? 1 /* Index */ : 0 /* Minimal */; + default: return usesJsExtensionOnImports(importingSourceFile) ? 2 /* JsExtension */ + : ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeJs ? 1 /* Index */ : 0 /* Minimal */; } } } function getPreferencesForUpdate(compilerOptions, oldImportSpecifier) { return { relativePreference: ts.isExternalModuleNameRelative(oldImportSpecifier) ? 0 /* Relative */ : 1 /* NonRelative */, - ending: ts.hasJSFileExtension(oldImportSpecifier) ? 2 /* JsExtension */ : + ending: ts.hasJSFileExtension(oldImportSpecifier) ? + 2 /* JsExtension */ : ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeJs || ts.endsWith(oldImportSpecifier, "index") ? 1 /* Index */ : 0 /* Minimal */, }; } @@ -118863,8 +118971,10 @@ var ts; } function getKindOfVariableDeclaration(v) { return ts.isVarConst(v) - ? "const" /* constElement */ : ts.isLet(v) - ? "let" /* letElement */ : "var" /* variableElement */; + ? "const" /* constElement */ + : ts.isLet(v) + ? "let" /* letElement */ + : "var" /* variableElement */; } } ts.getNodeKind = getNodeKind; @@ -120798,10 +120908,10 @@ var ts; var delta = 0; var lastPos = -1; for (var _i = 0, edits_1 = edits; _i < edits_1.length; _i++) { - var _a = edits_1[_i], fileName = _a.fileName, textChanges_1 = _a.textChanges; + var _a = edits_1[_i], fileName = _a.fileName, textChanges_2 = _a.textChanges; ts.Debug.assert(fileName === renameFilename); - for (var _b = 0, textChanges_2 = textChanges_1; _b < textChanges_2.length; _b++) { - var change = textChanges_2[_b]; + for (var _b = 0, textChanges_1 = textChanges_2; _b < textChanges_1.length; _b++) { + var change = textChanges_1[_b]; var span = change.span, newText = change.newText; var index = indexInTextChange(newText, name); if (index !== -1) { @@ -123624,6 +123734,8 @@ var ts; return jsdocCompletionInfo(ts.JsDoc.getJSDocTagCompletions()); case 3 /* JsDocParameterName */: return jsdocCompletionInfo(ts.JsDoc.getJSDocParameterNameCompletions(completionData.tag)); + case 4 /* Keywords */: + return specificKeywordCompletionInfo(completionData.keywords); default: return ts.Debug.assertNever(completionData); } @@ -123632,6 +123744,19 @@ var ts; function jsdocCompletionInfo(entries) { return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries }; } + function specificKeywordCompletionInfo(keywords) { + return { + isGlobalCompletion: false, + isMemberCompletion: false, + isNewIdentifierLocation: false, + entries: keywords.map(function (k) { return ({ + name: ts.tokenToString(k), + kind: "keyword" /* keyword */, + kindModifiers: "" /* none */, + sortText: SortText.GlobalsOrKeywords, + }); }), + }; + } function getOptionalReplacementSpan(location) { // StringLiteralLike locations are handled separately in stringCompletions.ts return (location === null || location === void 0 ? void 0 : location.kind) === 78 /* Identifier */ ? ts.createTextSpanFromNode(location) : undefined; @@ -123858,7 +123983,8 @@ var ts; var replacementSpan = ts.createTextSpanFromNode(importCompletionNode, sourceFile); var quotedModuleSpecifier = ts.quote(sourceFile, preferences, origin.moduleSpecifier); var exportKind = origin.isDefaultExport ? 1 /* Default */ : - origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : 0 /* Named */; + origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : + 0 /* Named */; var tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : ""; var importKind = ts.codefix.getImportKind(sourceFile, exportKind, options); var suffix = useSemicolons ? ";" : ""; @@ -124055,6 +124181,8 @@ var ts; return ts.JsDoc.getJSDocTagCompletionDetails(name); case 3 /* JsDocParameterName */: return ts.JsDoc.getJSDocParameterNameCompletionDetails(name); + case 4 /* Keywords */: + return request.keywords.indexOf(ts.stringToToken(name)) > -1 ? createSimpleDetails(name, "keyword" /* keyword */, ts.SymbolDisplayPartKind.keyword) : undefined; default: return ts.Debug.assertNever(request); } @@ -124113,6 +124241,7 @@ var ts; CompletionDataKind[CompletionDataKind["JsDocTagName"] = 1] = "JsDocTagName"; CompletionDataKind[CompletionDataKind["JsDocTag"] = 2] = "JsDocTag"; CompletionDataKind[CompletionDataKind["JsDocParameterName"] = 3] = "JsDocParameterName"; + CompletionDataKind[CompletionDataKind["Keywords"] = 4] = "Keywords"; })(CompletionDataKind || (CompletionDataKind = {})); var CompletionKind; (function (CompletionKind) { @@ -124167,7 +124296,7 @@ var ts; } } function getFirstSymbolInChain(symbol, enclosingDeclaration, checker) { - var chain = checker.getAccessibleSymbolChain(symbol, enclosingDeclaration, 67108863 /* All */, /*useOnlyExternalAliasing*/ false); + var chain = checker.getAccessibleSymbolChain(symbol, enclosingDeclaration, /*meaning*/ 67108863 /* All */, /*useOnlyExternalAliasing*/ false); if (chain) return ts.first(chain); return symbol.parent && (isModuleSymbol(symbol.parent) ? symbol : getFirstSymbolInChain(symbol.parent, enclosingDeclaration, checker)); @@ -124273,13 +124402,17 @@ var ts; var importCompletionNode; var location = ts.getTouchingPropertyName(sourceFile, position); if (contextToken) { + var importCompletionCandidate = getImportCompletionNode(contextToken); + if (importCompletionCandidate === 153 /* FromKeyword */) { + return { kind: 4 /* Keywords */, keywords: [153 /* FromKeyword */] }; + } // Import statement completions use `insertText`, and also require the `data` property of `CompletionEntryIdentifier` // added in TypeScript 4.3 to be sent back from the client during `getCompletionEntryDetails`. Since this feature // is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients // to opt in with the `includeCompletionsForImportStatements` user preference. - importCompletionNode = preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText - ? getImportCompletionNode(contextToken) - : undefined; + if (importCompletionCandidate && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) { + importCompletionNode = importCompletionCandidate; + } // Bail out if this is a known invalid completion location if (!importCompletionNode && isCompletionListBlocker(contextToken)) { log("Returning an empty list because completion was requested in an invalid position."); @@ -124755,7 +124888,8 @@ var ts; collectAutoImports(/*resolveModuleSpecifier*/ false); if (isTypeOnly) { keywordFilters = contextToken && ts.isAssertionExpression(contextToken.parent) - ? 6 /* TypeAssertionKeywords */ : 7 /* TypeKeywords */; + ? 6 /* TypeAssertionKeywords */ + : 7 /* TypeKeywords */; } } function shouldOfferImportCompletions() { @@ -124986,7 +125120,7 @@ var ts; || containingNodeKind === 172 /* IndexSignature */ // [ | : string ] || containingNodeKind === 159 /* ComputedPropertyName */; // [ | /* this can become an index signature */ case 139 /* ModuleKeyword */: // module | - case 140 /* NamespaceKeyword */: + case 140 /* NamespaceKeyword */: // namespace | return true; case 24 /* DotToken */: return containingNodeKind === 257 /* ModuleDeclaration */; // module A.| @@ -125235,7 +125369,7 @@ var ts; var parent = contextToken.parent; switch (contextToken.kind) { case 18 /* OpenBraceToken */: // const x = { | - case 27 /* CommaToken */: + case 27 /* CommaToken */: // const x = { a: 0, | if (ts.isObjectLiteralExpression(parent) || ts.isObjectBindingPattern(parent)) { return parent; } @@ -125414,7 +125548,7 @@ var ts; case 118 /* LetKeyword */: case 84 /* ConstKeyword */: case 135 /* InferKeyword */: - case 149 /* TypeKeyword */: + case 149 /* TypeKeyword */: // type htm| return true; case 41 /* AsteriskToken */: return ts.isFunctionLike(contextToken.parent) && !ts.isMethodDeclaration(contextToken.parent); @@ -125707,7 +125841,7 @@ var ts; // TODO: GH#18169 return { name: JSON.stringify(name), needsConvertPropertyAccess: false }; case 2 /* PropertyAccess */: - case 1 /* Global */: + case 1 /* Global */: // For a 'this.' completion it will be in a global context, but may have a non-identifier name. // Don't add a completion for a name starting with a space. See https://github.com/Microsoft/TypeScript/pull/20547 return name.charCodeAt(0) === 32 /* space */ ? undefined : { name: name, needsConvertPropertyAccess: true }; case 5 /* None */: @@ -125903,16 +126037,16 @@ var ts; return ts.findAncestor(contextToken, ts.isClassLike); } switch (contextToken.kind) { - case 62 /* EqualsToken */: + case 62 /* EqualsToken */: // class c { public prop = | /* global completions */ } return undefined; case 26 /* SemicolonToken */: // class c {getValue(): number; | } - case 19 /* CloseBraceToken */: + case 19 /* CloseBraceToken */: // class c { method() { } | } // class c { method() { } b| } return isFromObjectTypeDeclaration(location) && location.parent.name === location ? location.parent.parent : ts.tryCast(location, ts.isObjectTypeDeclaration); case 18 /* OpenBraceToken */: // class c { | - case 27 /* CommaToken */: + case 27 /* CommaToken */: // class c {getValue(): number, | } return ts.tryCast(contextToken.parent, ts.isObjectTypeDeclaration); default: if (!isFromObjectTypeDeclaration(contextToken)) { @@ -126032,16 +126166,20 @@ var ts; } function getImportCompletionNode(contextToken) { var candidate = getCandidate(); - return candidate && ts.rangeIsOnSingleLine(candidate, candidate.getSourceFile()) ? candidate : undefined; + return candidate === 153 /* FromKeyword */ || candidate && ts.rangeIsOnSingleLine(candidate, candidate.getSourceFile()) ? candidate : undefined; function getCandidate() { var parent = contextToken.parent; if (ts.isImportEqualsDeclaration(parent)) { return isModuleSpecifierMissingOrEmpty(parent.moduleReference) ? parent : undefined; } if (ts.isNamedImports(parent) || ts.isNamespaceImport(parent)) { - return isModuleSpecifierMissingOrEmpty(parent.parent.parent.moduleSpecifier) && (ts.isNamespaceImport(parent) || parent.elements.length < 2) && !parent.parent.name - ? parent.parent.parent - : undefined; + if (isModuleSpecifierMissingOrEmpty(parent.parent.parent.moduleSpecifier) && (ts.isNamespaceImport(parent) || parent.elements.length < 2) && !parent.parent.name) { + // At `import { ... } |` or `import * as Foo |`, the only possible completion is `from` + return contextToken.kind === 19 /* CloseBraceToken */ || contextToken.kind === 78 /* Identifier */ + ? 153 /* FromKeyword */ + : parent.parent.parent; + } + return undefined; } if (ts.isImportKeyword(contextToken) && ts.isSourceFile(parent)) { // A lone import keyword with nothing following it does not parse as a statement at all @@ -126778,7 +126916,7 @@ var ts; } } break; - case 78 /* Identifier */: + case 78 /* Identifier */: // for 'const x = require("y"); break; // TODO: GH#23879 case 261 /* ImportEqualsDeclaration */: handleNamespaceImport(direct, direct.name, ts.hasSyntacticModifier(direct, 1 /* Export */), /*alreadyAddedDirect*/ false); @@ -131433,9 +131571,11 @@ var ts; return ts.isFunctionExpression(node) || ts.isFunctionDeclaration(node) || ts.isVariableDeclaration(node); } var bAssignmentDeclarationKind = ts.isBinaryExpression(b.node) || ts.isCallExpression(b.node) ? - ts.getAssignmentDeclarationKind(b.node) : 0 /* None */; + ts.getAssignmentDeclarationKind(b.node) : + 0 /* None */; var aAssignmentDeclarationKind = ts.isBinaryExpression(a.node) || ts.isCallExpression(a.node) ? - ts.getAssignmentDeclarationKind(a.node) : 0 /* None */; + ts.getAssignmentDeclarationKind(a.node) : + 0 /* None */; // We treat this as an es5 class and merge the nodes in in one of several cases if ((isEs5ClassMember[bAssignmentDeclarationKind] && isEs5ClassMember[aAssignmentDeclarationKind]) // merge two class elements || (isPossibleConstructor(a.node) && isEs5ClassMember[bAssignmentDeclarationKind]) // ctor function & member @@ -132738,7 +132878,8 @@ var ts; return ts.min(a, b, compareMatches); } function compareMatches(a, b) { - return a === undefined ? 1 /* GreaterThan */ : b === undefined ? -1 /* LessThan */ : ts.compareValues(a.kind, b.kind) || ts.compareBooleans(!a.isCaseSensitive, !b.isCaseSensitive); + return a === undefined ? 1 /* GreaterThan */ : b === undefined ? -1 /* LessThan */ + : ts.compareValues(a.kind, b.kind) || ts.compareBooleans(!a.isCaseSensitive, !b.isCaseSensitive); } function partStartsWith(candidate, candidateSpan, pattern, ignoreCase, patternSpan) { if (patternSpan === void 0) { patternSpan = { start: 0, length: pattern.length }; } @@ -134771,7 +134912,8 @@ var ts; } var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol); if (flags & 32 /* Class */) { - return ts.getDeclarationOfKind(symbol, 222 /* ClassExpression */) ? "local class" /* localClassElement */ : "class" /* classElement */; + return ts.getDeclarationOfKind(symbol, 222 /* ClassExpression */) ? + "local class" /* localClassElement */ : "class" /* classElement */; } if (flags & 384 /* Enum */) return "enum" /* enumElement */; @@ -134874,7 +135016,8 @@ var ts; var _a = symbol.declarations, declaration = _a[0], declarations = _a.slice(1); // omit deprecated flag if some declarations are not deprecated var excludeFlags = ts.length(declarations) && isDeprecatedDeclaration(declaration) && ts.some(declarations, function (d) { return !isDeprecatedDeclaration(d); }) - ? 8192 /* Deprecated */ : 0 /* None */; + ? 8192 /* Deprecated */ + : 0 /* None */; var modifiers = ts.getNodeModifiers(declaration, excludeFlags); if (modifiers) { return modifiers.split(","); @@ -135755,7 +135898,8 @@ var ts; shouldRescanTemplateToken(n) ? 3 /* RescanTemplateToken */ : shouldRescanJsxIdentifier(n) ? 4 /* RescanJsxIdentifier */ : shouldRescanJsxText(n) ? 5 /* RescanJsxText */ : - shouldRescanJsxAttributeValue(n) ? 6 /* RescanJsxAttributeValue */ : 0 /* Scan */; + shouldRescanJsxAttributeValue(n) ? 6 /* RescanJsxAttributeValue */ : + 0 /* Scan */; if (lastTokenInfo && expectedScanAction === lastScanAction) { // readTokenInfo was called before with the same expected scan action. // No need to re-scan text, return existing 'lastTokenInfo' @@ -135936,14 +136080,8 @@ var ts; var binaryKeywordOperators = [100 /* InKeyword */, 101 /* InstanceOfKeyword */, 157 /* OfKeyword */, 126 /* AsKeyword */, 137 /* IsKeyword */]; var unaryPrefixOperators = [45 /* PlusPlusToken */, 46 /* MinusMinusToken */, 54 /* TildeToken */, 53 /* ExclamationToken */]; var unaryPrefixExpressions = [ - 8 /* NumericLiteral */, - 9 /* BigIntLiteral */, - 78 /* Identifier */, - 20 /* OpenParenToken */, - 22 /* OpenBracketToken */, - 18 /* OpenBraceToken */, - 107 /* ThisKeyword */, - 102 /* NewKeyword */ + 8 /* NumericLiteral */, 9 /* BigIntLiteral */, 78 /* Identifier */, 20 /* OpenParenToken */, + 22 /* OpenBracketToken */, 18 /* OpenBraceToken */, 107 /* ThisKeyword */, 102 /* NewKeyword */ ]; var unaryPreincrementExpressions = [78 /* Identifier */, 20 /* OpenParenToken */, 107 /* ThisKeyword */, 102 /* NewKeyword */]; var unaryPostincrementExpressions = [78 /* Identifier */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 102 /* NewKeyword */]; @@ -136374,7 +136512,7 @@ var ts; // case SyntaxKind.SimpleArrowFunctionExpression: // case SyntaxKind.ParenthesizedArrowFunctionExpression: // falls through - case 254 /* InterfaceDeclaration */: + case 254 /* InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one return true; } return false; @@ -137264,7 +137402,7 @@ var ts; // if there are any tokens that logically belong to node and interleave child nodes // such tokens will be consumed in processChildNode for the child that follows them ts.forEachChild(node, function (child) { - processChildNode(child, -1 /* Unknown */, node, nodeDynamicIndentation, nodeStartLine, undecoratedNodeStartLine, /*isListItem*/ false); + processChildNode(child, /*inheritedIndentation*/ -1 /* Unknown */, node, nodeDynamicIndentation, nodeStartLine, undecoratedNodeStartLine, /*isListItem*/ false); }, function (nodes) { processChildNodes(nodes, node, nodeStartLine, nodeDynamicIndentation); }); @@ -137435,7 +137573,8 @@ var ts; } if (indentToken) { var tokenIndentation = (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) ? - dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind, container, !!isListEndToken) : -1 /* Unknown */; + dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind, container, !!isListEndToken) : + -1 /* Unknown */; var indentNextTokenOrTrivia = true; if (currentTokenInfo.leadingTrivia) { var commentIndentation_1 = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation, container); @@ -141263,7 +141402,7 @@ var ts; // do not produce a transformed statement for a null argument break; case 202 /* PropertyAccessExpression */: - case 78 /* Identifier */: + case 78 /* Identifier */: // identifier includes undefined if (!argName) { // undefined was argument passed to promise handler break; diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index cb161b6a6e3ba..eb839a30eab36 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -85,7 +85,7 @@ var ts; // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types - ts.version = "4.3.1-rc"; + ts.version = "4.3.2"; /* @internal */ var Comparison; (function (Comparison) { @@ -1642,7 +1642,8 @@ var ts; return a === b ? 0 /* EqualTo */ : a === undefined ? -1 /* LessThan */ : b === undefined ? 1 /* GreaterThan */ : - a < b ? -1 /* LessThan */ : 1 /* GreaterThan */; + a < b ? -1 /* LessThan */ : + 1 /* GreaterThan */; } /** * Compare two numeric values for their order relative to each other. @@ -7657,7 +7658,8 @@ var ts; if (ts.sys && ts.sys.getEnvironmentVariable) { setCustomPollingValues(ts.sys); ts.Debug.setAssertionLevel(/^development$/i.test(ts.sys.getEnvironmentVariable("NODE_ENV")) - ? 1 /* Normal */ : 0 /* None */); + ? 1 /* Normal */ + : 0 /* None */); } if (ts.sys && ts.sys.debugMode) { ts.Debug.isDebugging = true; @@ -7676,7 +7678,7 @@ var ts; Identifier_expected: diag(1003, ts.DiagnosticCategory.Error, "Identifier_expected_1003", "Identifier expected."), _0_expected: diag(1005, ts.DiagnosticCategory.Error, "_0_expected_1005", "'{0}' expected."), A_file_cannot_have_a_reference_to_itself: diag(1006, ts.DiagnosticCategory.Error, "A_file_cannot_have_a_reference_to_itself_1006", "A file cannot have a reference to itself."), - The_parser_expected_to_find_a_1_to_match_the_0_token_here: diag(1007, ts.DiagnosticCategory.Error, "The_parser_expected_to_find_a_1_to_match_the_0_token_here_1007", "The parser expected to find a '{1}' to match the '{0}' token here."), + The_parser_expected_to_find_a_to_match_the_token_here: diag(1007, ts.DiagnosticCategory.Error, "The_parser_expected_to_find_a_to_match_the_token_here_1007", "The parser expected to find a '}' to match the '{' token here."), Trailing_comma_not_allowed: diag(1009, ts.DiagnosticCategory.Error, "Trailing_comma_not_allowed_1009", "Trailing comma not allowed."), Asterisk_Slash_expected: diag(1010, ts.DiagnosticCategory.Error, "Asterisk_Slash_expected_1010", "'*/' expected."), An_element_access_expression_should_take_an_argument: diag(1011, ts.DiagnosticCategory.Error, "An_element_access_expression_should_take_an_argument_1011", "An element access expression should take an argument."), @@ -12997,7 +12999,7 @@ var ts; case 105 /* SuperKeyword */: case 226 /* NonNullExpression */: case 227 /* MetaProperty */: - case 99 /* ImportKeyword */: + case 99 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression return true; default: return false; @@ -16070,7 +16072,8 @@ var ts; case 217 /* BinaryExpression */: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? - binaryOperator === 62 /* EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* Definite */ : 2 /* Compound */ : 0 /* None */; + binaryOperator === 62 /* EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* Definite */ : 2 /* Compound */ : + 0 /* None */; case 215 /* PrefixUnaryExpression */: case 216 /* PostfixUnaryExpression */: var unaryOperator = parent.operator; @@ -18495,7 +18498,8 @@ var ts; if (getCheckFlags(s) & 6 /* Synthetic */) { var checkFlags = s.checkFlags; var accessModifier = checkFlags & 1024 /* ContainsPrivate */ ? 8 /* Private */ : - checkFlags & 256 /* ContainsPublic */ ? 4 /* Public */ : 16 /* Protected */; + checkFlags & 256 /* ContainsPublic */ ? 4 /* Public */ : + 16 /* Protected */; var staticModifier = checkFlags & 2048 /* ContainsStatic */ ? 32 /* Static */ : 0; return accessModifier | staticModifier; } @@ -19027,7 +19031,8 @@ var ts; } function compareDiagnostics(d1, d2) { return compareDiagnosticsSkipRelatedInformation(d1, d2) || - compareRelatedInformation(d1, d2) || 0 /* EqualTo */; + compareRelatedInformation(d1, d2) || + 0 /* EqualTo */; } ts.compareDiagnostics = compareDiagnostics; function compareDiagnosticsSkipRelatedInformation(d1, d2) { @@ -19035,7 +19040,8 @@ var ts; ts.compareValues(d1.start, d2.start) || ts.compareValues(d1.length, d2.length) || ts.compareValues(d1.code, d2.code) || - compareMessageText(d1.messageText, d2.messageText) || 0 /* EqualTo */; + compareMessageText(d1.messageText, d2.messageText) || + 0 /* EqualTo */; } ts.compareDiagnosticsSkipRelatedInformation = compareDiagnosticsSkipRelatedInformation; function compareRelatedInformation(d1, d2) { @@ -19887,15 +19893,15 @@ var ts; var log2Base; switch (stringValue.charCodeAt(1)) { // "x" in "0x123" case 98 /* b */: - case 66 /* B */: + case 66 /* B */: // 0b or 0B log2Base = 1; break; case 111 /* o */: - case 79 /* O */: + case 79 /* O */: // 0o or 0O log2Base = 3; break; case 120 /* x */: - case 88 /* X */: + case 88 /* X */: // 0x or 0X log2Base = 4; break; default: // already in decimal; omit trailing "n" @@ -21562,7 +21568,8 @@ var ts; case 129 /* AsyncKeyword */: // 'async' modifier is ES2017 (async functions) or ES2018 (async generators) transformFlags = - 128 /* ContainsES2017 */ | 64 /* ContainsES2018 */; + 128 /* ContainsES2017 */ | + 64 /* ContainsES2018 */; break; case 122 /* PublicKeyword */: case 120 /* PrivateKeyword */: @@ -21582,7 +21589,7 @@ var ts; case 148 /* SymbolKeyword */: case 113 /* VoidKeyword */: case 152 /* UnknownKeyword */: - case 150 /* UndefinedKeyword */: + case 150 /* UndefinedKeyword */: // `undefined` is an Identifier in the expression case. transformFlags = 1 /* ContainsTypeScript */; break; case 123 /* StaticKeyword */: @@ -21695,7 +21702,9 @@ var ts; var node = createBaseNode(159 /* ComputedPropertyName */); node.expression = parenthesizerRules().parenthesizeExpressionOfComputedPropertyName(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 512 /* ContainsES2015 */ | 65536 /* ContainsComputedPropertyName */; + propagateChildFlags(node.expression) | + 512 /* ContainsES2015 */ | + 65536 /* ContainsComputedPropertyName */; return node; } // @api @@ -21763,7 +21772,9 @@ var ts; var node = createBaseNode(162 /* Decorator */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */ | 4096 /* ContainsTypeScriptClassSyntax */; + propagateChildFlags(node.expression) | + 1 /* ContainsTypeScript */ | + 4096 /* ContainsTypeScriptClassSyntax */; return node; } // @api @@ -21800,7 +21811,8 @@ var ts; node.exclamationToken = questionOrExclamationToken && ts.isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.transformFlags |= propagateChildFlags(node.questionToken) | - propagateChildFlags(node.exclamationToken) | 8388608 /* ContainsClassFields */; + propagateChildFlags(node.exclamationToken) | + 8388608 /* ContainsClassFields */; if (ts.isComputedPropertyName(node.name) || (ts.hasStaticModifier(node) && node.initializer)) { node.transformFlags |= 4096 /* ContainsTypeScriptClassSyntax */; } @@ -21847,7 +21859,8 @@ var ts; node.questionToken = questionToken; node.transformFlags |= propagateChildFlags(node.asteriskToken) | - propagateChildFlags(node.questionToken) | 512 /* ContainsES2015 */; + propagateChildFlags(node.questionToken) | + 512 /* ContainsES2015 */; if (questionToken) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -22375,10 +22388,13 @@ var ts; var node = createBaseNode(197 /* ObjectBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= - propagateChildrenFlags(node.elements) | 512 /* ContainsES2015 */ | 262144 /* ContainsBindingPattern */; + propagateChildrenFlags(node.elements) | + 512 /* ContainsES2015 */ | + 262144 /* ContainsBindingPattern */; if (node.transformFlags & 16384 /* ContainsRestOrSpread */) { node.transformFlags |= - 64 /* ContainsES2018 */ | 32768 /* ContainsObjectRestOrSpread */; + 64 /* ContainsES2018 */ | + 32768 /* ContainsObjectRestOrSpread */; } return node; } @@ -22393,7 +22409,9 @@ var ts; var node = createBaseNode(198 /* ArrayBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= - propagateChildrenFlags(node.elements) | 512 /* ContainsES2015 */ | 262144 /* ContainsBindingPattern */; + propagateChildrenFlags(node.elements) | + 512 /* ContainsES2015 */ | + 262144 /* ContainsBindingPattern */; return node; } // @api @@ -22410,7 +22428,8 @@ var ts; node.propertyName = asName(propertyName); node.dotDotDotToken = dotDotDotToken; node.transformFlags |= - propagateChildFlags(node.dotDotDotToken) | 512 /* ContainsES2015 */; + propagateChildFlags(node.dotDotDotToken) | + 512 /* ContainsES2015 */; if (node.propertyName) { node.transformFlags |= ts.isIdentifier(node.propertyName) ? propagateIdentifierNameFlags(node.propertyName) : @@ -22479,7 +22498,8 @@ var ts; // super method calls require a lexical 'this' // super method calls require 'super' hoisting in ES2017 and ES2018 async functions and async generators node.transformFlags |= - 128 /* ContainsES2017 */ | 64 /* ContainsES2018 */; + 128 /* ContainsES2017 */ | + 64 /* ContainsES2018 */; } return node; } @@ -22532,7 +22552,8 @@ var ts; // super method calls require a lexical 'this' // super method calls require 'super' hoisting in ES2017 and ES2018 async functions and async generators node.transformFlags |= - 128 /* ContainsES2017 */ | 64 /* ContainsES2018 */; + 128 /* ContainsES2017 */ | + 64 /* ContainsES2018 */; } return node; } @@ -22556,7 +22577,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.questionDotToken) | - propagateChildFlags(node.argumentExpression) | 16 /* ContainsES2020 */; + propagateChildFlags(node.argumentExpression) | + 16 /* ContainsES2020 */; return node; } // @api @@ -22614,7 +22636,8 @@ var ts; propagateChildFlags(node.expression) | propagateChildFlags(node.questionDotToken) | propagateChildrenFlags(node.typeArguments) | - propagateChildrenFlags(node.arguments) | 16 /* ContainsES2020 */; + propagateChildrenFlags(node.arguments) | + 16 /* ContainsES2020 */; if (node.typeArguments) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -22642,7 +22665,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.expression) | propagateChildrenFlags(node.typeArguments) | - propagateChildrenFlags(node.arguments) | 16 /* ContainsES2020 */; + propagateChildrenFlags(node.arguments) | + 16 /* ContainsES2020 */; if (node.typeArguments) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -22665,7 +22689,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.tag) | propagateChildrenFlags(node.typeArguments) | - propagateChildFlags(node.template) | 512 /* ContainsES2015 */; + propagateChildFlags(node.template) | + 512 /* ContainsES2015 */; if (node.typeArguments) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -22689,7 +22714,8 @@ var ts; node.type = type; node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildFlags(node.type) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.type) | + 1 /* ContainsTypeScript */; return node; } // @api @@ -22753,7 +22779,8 @@ var ts; /*name*/ undefined, typeParameters, parameters, type, parenthesizerRules().parenthesizeConciseBodyOfArrowFunction(body)); node.equalsGreaterThanToken = equalsGreaterThanToken !== null && equalsGreaterThanToken !== void 0 ? equalsGreaterThanToken : createToken(38 /* EqualsGreaterThanToken */); node.transformFlags |= - propagateChildFlags(node.equalsGreaterThanToken) | 512 /* ContainsES2015 */; + propagateChildFlags(node.equalsGreaterThanToken) | + 512 /* ContainsES2015 */; if (ts.modifiersToFlags(node.modifiers) & 256 /* Async */) { node.transformFlags |= 128 /* ContainsES2017 */; } @@ -22814,7 +22841,10 @@ var ts; var node = createBaseExpression(214 /* AwaitExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 128 /* ContainsES2017 */ | 64 /* ContainsES2018 */ | 1048576 /* ContainsAwait */; + propagateChildFlags(node.expression) | + 128 /* ContainsES2017 */ | + 64 /* ContainsES2018 */ | + 1048576 /* ContainsAwait */; return node; } // @api @@ -22869,12 +22899,15 @@ var ts; else if (operatorKind === 62 /* EqualsToken */) { if (ts.isObjectLiteralExpression(node.left)) { node.transformFlags |= - 512 /* ContainsES2015 */ | 64 /* ContainsES2018 */ | 2048 /* ContainsDestructuringAssignment */ | + 512 /* ContainsES2015 */ | + 64 /* ContainsES2018 */ | + 2048 /* ContainsDestructuringAssignment */ | propagateAssignmentPatternFlags(node.left); } else if (ts.isArrayLiteralExpression(node.left)) { node.transformFlags |= - 512 /* ContainsES2015 */ | 2048 /* ContainsDestructuringAssignment */ | + 512 /* ContainsES2015 */ | + 2048 /* ContainsDestructuringAssignment */ | propagateAssignmentPatternFlags(node.left); } } @@ -22950,7 +22983,8 @@ var ts; node.templateSpans = createNodeArray(templateSpans); node.transformFlags |= propagateChildFlags(node.head) | - propagateChildrenFlags(node.templateSpans) | 512 /* ContainsES2015 */; + propagateChildrenFlags(node.templateSpans) | + 512 /* ContainsES2015 */; return node; } // @api @@ -23019,7 +23053,10 @@ var ts; node.asteriskToken = asteriskToken; node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildFlags(node.asteriskToken) | 512 /* ContainsES2015 */ | 64 /* ContainsES2018 */ | 524288 /* ContainsYield */; + propagateChildFlags(node.asteriskToken) | + 512 /* ContainsES2015 */ | + 64 /* ContainsES2018 */ | + 524288 /* ContainsYield */; return node; } // @api @@ -23034,7 +23071,9 @@ var ts; var node = createBaseExpression(221 /* SpreadElement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 512 /* ContainsES2015 */ | 16384 /* ContainsRestOrSpread */; + propagateChildFlags(node.expression) | + 512 /* ContainsES2015 */ | + 16384 /* ContainsRestOrSpread */; return node; } // @api @@ -23071,7 +23110,8 @@ var ts; node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildrenFlags(node.typeArguments) | 512 /* ContainsES2015 */; + propagateChildrenFlags(node.typeArguments) | + 512 /* ContainsES2015 */; return node; } // @api @@ -23088,7 +23128,8 @@ var ts; node.type = type; node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildFlags(node.type) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.type) | + 1 /* ContainsTypeScript */; return node; } // @api @@ -23103,7 +23144,8 @@ var ts; var node = createBaseExpression(226 /* NonNullExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.expression) | + 1 /* ContainsTypeScript */; return node; } // @api @@ -23121,7 +23163,8 @@ var ts; node.flags |= 32 /* OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.expression) | + 1 /* ContainsTypeScript */; return node; } // @api @@ -23165,7 +23208,8 @@ var ts; node.literal = literal; node.transformFlags |= propagateChildFlags(node.expression) | - propagateChildFlags(node.literal) | 512 /* ContainsES2015 */; + propagateChildFlags(node.literal) | + 512 /* ContainsES2015 */; return node; } // @api @@ -23341,7 +23385,8 @@ var ts; propagateChildFlags(node.awaitModifier) | propagateChildFlags(node.initializer) | propagateChildFlags(node.expression) | - propagateChildFlags(node.statement) | 512 /* ContainsES2015 */; + propagateChildFlags(node.statement) | + 512 /* ContainsES2015 */; if (awaitModifier) node.transformFlags |= 64 /* ContainsES2018 */; return node; @@ -23360,7 +23405,8 @@ var ts; var node = createBaseNode(241 /* ContinueStatement */); node.label = asName(label); node.transformFlags |= - propagateChildFlags(node.label) | 2097152 /* ContainsHoistedDeclarationOrCompletion */; + propagateChildFlags(node.label) | + 2097152 /* ContainsHoistedDeclarationOrCompletion */; return node; } // @api @@ -23374,7 +23420,8 @@ var ts; var node = createBaseNode(242 /* BreakStatement */); node.label = asName(label); node.transformFlags |= - propagateChildFlags(node.label) | 2097152 /* ContainsHoistedDeclarationOrCompletion */; + propagateChildFlags(node.label) | + 2097152 /* ContainsHoistedDeclarationOrCompletion */; return node; } // @api @@ -23389,7 +23436,9 @@ var ts; node.expression = expression; // return in an ES2018 async generator must be awaited node.transformFlags |= - propagateChildFlags(node.expression) | 64 /* ContainsES2018 */ | 2097152 /* ContainsHoistedDeclarationOrCompletion */; + propagateChildFlags(node.expression) | + 64 /* ContainsES2018 */ | + 2097152 /* ContainsHoistedDeclarationOrCompletion */; return node; } // @api @@ -23514,10 +23563,12 @@ var ts; node.flags |= flags & 3 /* BlockScoped */; node.declarations = createNodeArray(declarations); node.transformFlags |= - propagateChildrenFlags(node.declarations) | 2097152 /* ContainsHoistedDeclarationOrCompletion */; + propagateChildrenFlags(node.declarations) | + 2097152 /* ContainsHoistedDeclarationOrCompletion */; if (flags & 3 /* BlockScoped */) { node.transformFlags |= - 512 /* ContainsES2015 */ | 131072 /* ContainsBlockScopedBinding */; + 512 /* ContainsES2015 */ | + 131072 /* ContainsBlockScopedBinding */; } return node; } @@ -23536,7 +23587,8 @@ var ts; } else { node.transformFlags |= - propagateChildFlags(node.asteriskToken) | 2097152 /* ContainsHoistedDeclarationOrCompletion */; + propagateChildFlags(node.asteriskToken) | + 2097152 /* ContainsHoistedDeclarationOrCompletion */; if (ts.modifiersToFlags(node.modifiers) & 256 /* Async */) { if (node.asteriskToken) { node.transformFlags |= 64 /* ContainsES2018 */; @@ -23629,7 +23681,8 @@ var ts; var node = createBaseNamedDeclaration(256 /* EnumDeclaration */, decorators, modifiers, name); node.members = createNodeArray(members); node.transformFlags |= - propagateChildrenFlags(node.members) | 1 /* ContainsTypeScript */; + propagateChildrenFlags(node.members) | + 1 /* ContainsTypeScript */; node.transformFlags &= ~16777216 /* ContainsPossibleTopLevelAwait */; // Enum declarations cannot contain `await` return node; } @@ -23655,7 +23708,8 @@ var ts; else { node.transformFlags |= propagateChildFlags(node.name) | - propagateChildFlags(node.body) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.body) | + 1 /* ContainsTypeScript */; } node.transformFlags &= ~16777216 /* ContainsPossibleTopLevelAwait */; // Module declarations cannot contain `await`. return node; @@ -23792,7 +23846,8 @@ var ts; var node = createBaseNode(270 /* NamespaceExport */); node.name = name; node.transformFlags |= - propagateChildFlags(node.name) | 4 /* ContainsESNext */; + propagateChildFlags(node.name) | + 4 /* ContainsESNext */; node.transformFlags &= ~16777216 /* ContainsPossibleTopLevelAwait */; // always parsed in an Await context return node; } @@ -24298,7 +24353,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.openingElement) | propagateChildrenFlags(node.children) | - propagateChildFlags(node.closingElement) | 2 /* ContainsJsx */; + propagateChildFlags(node.closingElement) | + 2 /* ContainsJsx */; return node; } // @api @@ -24318,7 +24374,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.tagName) | propagateChildrenFlags(node.typeArguments) | - propagateChildFlags(node.attributes) | 2 /* ContainsJsx */; + propagateChildFlags(node.attributes) | + 2 /* ContainsJsx */; if (node.typeArguments) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -24341,7 +24398,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.tagName) | propagateChildrenFlags(node.typeArguments) | - propagateChildFlags(node.attributes) | 2 /* ContainsJsx */; + propagateChildFlags(node.attributes) | + 2 /* ContainsJsx */; if (typeArguments) { node.transformFlags |= 1 /* ContainsTypeScript */; } @@ -24360,7 +24418,8 @@ var ts; var node = createBaseNode(277 /* JsxClosingElement */); node.tagName = tagName; node.transformFlags |= - propagateChildFlags(node.tagName) | 2 /* ContainsJsx */; + propagateChildFlags(node.tagName) | + 2 /* ContainsJsx */; return node; } // @api @@ -24378,7 +24437,8 @@ var ts; node.transformFlags |= propagateChildFlags(node.openingFragment) | propagateChildrenFlags(node.children) | - propagateChildFlags(node.closingFragment) | 2 /* ContainsJsx */; + propagateChildFlags(node.closingFragment) | + 2 /* ContainsJsx */; return node; } // @api @@ -24423,7 +24483,8 @@ var ts; node.initializer = initializer; node.transformFlags |= propagateChildFlags(node.name) | - propagateChildFlags(node.initializer) | 2 /* ContainsJsx */; + propagateChildFlags(node.initializer) | + 2 /* ContainsJsx */; return node; } // @api @@ -24438,7 +24499,8 @@ var ts; var node = createBaseNode(282 /* JsxAttributes */); node.properties = createNodeArray(properties); node.transformFlags |= - propagateChildrenFlags(node.properties) | 2 /* ContainsJsx */; + propagateChildrenFlags(node.properties) | + 2 /* ContainsJsx */; return node; } // @api @@ -24452,7 +24514,8 @@ var ts; var node = createBaseNode(283 /* JsxSpreadAttribute */); node.expression = expression; node.transformFlags |= - propagateChildFlags(node.expression) | 2 /* ContainsJsx */; + propagateChildFlags(node.expression) | + 2 /* ContainsJsx */; return node; } // @api @@ -24468,7 +24531,8 @@ var ts; node.expression = expression; node.transformFlags |= propagateChildFlags(node.dotDotDotToken) | - propagateChildFlags(node.expression) | 2 /* ContainsJsx */; + propagateChildFlags(node.expression) | + 2 /* ContainsJsx */; return node; } // @api @@ -24597,7 +24661,8 @@ var ts; /*modifiers*/ undefined, name); node.objectAssignmentInitializer = objectAssignmentInitializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(objectAssignmentInitializer); node.transformFlags |= - propagateChildFlags(node.objectAssignmentInitializer) | 512 /* ContainsES2015 */; + propagateChildFlags(node.objectAssignmentInitializer) | + 512 /* ContainsES2015 */; return node; } function finishUpdateShorthandPropertyAssignment(updated, original) { @@ -24626,7 +24691,9 @@ var ts; var node = createBaseNode(291 /* SpreadAssignment */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= - propagateChildFlags(node.expression) | 64 /* ContainsES2018 */ | 32768 /* ContainsObjectRestOrSpread */; + propagateChildFlags(node.expression) | + 64 /* ContainsES2018 */ | + 32768 /* ContainsObjectRestOrSpread */; return node; } // @api @@ -24645,7 +24712,8 @@ var ts; node.initializer = initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= propagateChildFlags(node.name) | - propagateChildFlags(node.initializer) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.initializer) | + 1 /* ContainsTypeScript */; return node; } // @api @@ -24821,7 +24889,8 @@ var ts; node.expression = expression; node.original = original; node.transformFlags |= - propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */; + propagateChildFlags(node.expression) | + 1 /* ContainsTypeScript */; ts.setTextRange(node, original); return node; } @@ -29950,23 +30019,20 @@ var ts; return inContext(32768 /* AwaitContext */); } function parseErrorAtCurrentToken(message, arg0) { - return parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0); + parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0); } function parseErrorAtPosition(start, length, message, arg0) { // Don't report another error if it would just be at the same position as the last error. var lastError = ts.lastOrUndefined(parseDiagnostics); - var result; if (!lastError || start !== lastError.start) { - result = ts.createDetachedDiagnostic(fileName, start, length, message, arg0); - parseDiagnostics.push(result); + parseDiagnostics.push(ts.createDetachedDiagnostic(fileName, start, length, message, arg0)); } // Mark that we've encountered an error. We'll set an appropriate bit on the next // node we finish so that it can't be reused incrementally. parseErrorBeforeNextFinishedNode = true; - return result; } function parseErrorAt(start, end, message, arg0) { - return parseErrorAtPosition(start, end - start, message, arg0); + parseErrorAtPosition(start, end - start, message, arg0); } function parseErrorAtRange(range, message, arg0) { parseErrorAt(range.pos, range.end, message, arg0); @@ -30123,16 +30189,6 @@ var ts; parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind)); return false; } - function parseExpectedMatchingBrackets(openKind, closeKind, openPosition) { - if (token() === closeKind) { - nextToken(); - return; - } - var lastError = parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(closeKind)); - if (lastError) { - ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openPosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, ts.tokenToString(openKind), ts.tokenToString(closeKind))); - } - } function parseOptional(t) { if (token() === t) { nextToken(); @@ -30421,7 +30477,7 @@ var ts; case 22 /* OpenBracketToken */: case 41 /* AsteriskToken */: case 25 /* DotDotDotToken */: - case 24 /* DotToken */: + case 24 /* DotToken */: // Not an object literal member, but don't want to close the object (see `tests/cases/fourslash/completionsDotInObjectLiteral.ts`) return true; default: return isLiteralPropertyName(); @@ -30454,7 +30510,7 @@ var ts; case 15 /* ArrayLiteralMembers */: switch (token()) { case 27 /* CommaToken */: - case 24 /* DotToken */: + case 24 /* DotToken */: // Not an array literal member, but don't want to close the array (see `tests/cases/fourslash/completionsDotInArrayLiteralInObjectLiteral.ts`) return true; } // falls through @@ -33416,7 +33472,7 @@ var ts; case 50 /* AmpersandToken */: // foo & case 51 /* BarToken */: // foo | case 19 /* CloseBraceToken */: // foo } - case 1 /* EndOfFileToken */: + case 1 /* EndOfFileToken */: // foo // these cases can't legally follow a type arg list. However, they're not legal // expressions either. The user is probably in the middle of a generic type. So // treat it as such. @@ -33500,11 +33556,10 @@ var ts; } function parseArrayLiteralExpression() { var pos = getNodePos(); - var openBracketPosition = scanner.getTokenPos(); parseExpected(22 /* OpenBracketToken */); var multiLine = scanner.hasPrecedingLineBreak(); var elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement); - parseExpectedMatchingBrackets(22 /* OpenBracketToken */, 23 /* CloseBracketToken */, openBracketPosition); + parseExpected(23 /* CloseBracketToken */); return finishNode(factory.createArrayLiteralExpression(elements, multiLine), pos); } function parseObjectLiteralElement() { @@ -33564,7 +33619,12 @@ var ts; parseExpected(18 /* OpenBraceToken */); var multiLine = scanner.hasPrecedingLineBreak(); var properties = parseDelimitedList(12 /* ObjectLiteralMembers */, parseObjectLiteralElement, /*considerSemicolonAsDelimiter*/ true); - parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBracePosition); + if (!parseExpected(19 /* CloseBraceToken */)) { + var lastError = ts.lastOrUndefined(parseDiagnostics); + if (lastError && lastError.code === ts.Diagnostics._0_expected.code) { + ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here)); + } + } return finishNode(factory.createObjectLiteralExpression(properties, multiLine), pos); } function parseFunctionExpression() { @@ -33638,7 +33698,12 @@ var ts; if (parseExpected(18 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { var multiLine = scanner.hasPrecedingLineBreak(); var statements = parseList(1 /* BlockStatements */, parseStatement); - parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBracePosition); + if (!parseExpected(19 /* CloseBraceToken */)) { + var lastError = ts.lastOrUndefined(parseDiagnostics); + if (lastError && lastError.code === ts.Diagnostics._0_expected.code) { + ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here)); + } + } var result = withJSDoc(finishNode(factory.createBlock(statements, multiLine), pos), hasJSDoc); if (token() === 62 /* EqualsToken */) { parseErrorAtCurrentToken(ts.Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses); @@ -33683,10 +33748,9 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(98 /* IfKeyword */); - var openParenPosition = scanner.getTokenPos(); parseExpected(20 /* OpenParenToken */); var expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition); + parseExpected(21 /* CloseParenToken */); var thenStatement = parseStatement(); var elseStatement = parseOptional(90 /* ElseKeyword */) ? parseStatement() : undefined; return withJSDoc(finishNode(factory.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc); @@ -33697,10 +33761,9 @@ var ts; parseExpected(89 /* DoKeyword */); var statement = parseStatement(); parseExpected(114 /* WhileKeyword */); - var openParenPosition = scanner.getTokenPos(); parseExpected(20 /* OpenParenToken */); var expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition); + parseExpected(21 /* CloseParenToken */); // From: https://mail.mozilla.org/pipermail/es-discuss/2011-August/016188.html // 157 min --- All allen at wirfs-brock.com CONF --- "do{;}while(false)false" prohibited in // spec but allowed in consensus reality. Approved -- this is the de-facto standard whereby @@ -33712,10 +33775,9 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(114 /* WhileKeyword */); - var openParenPosition = scanner.getTokenPos(); parseExpected(20 /* OpenParenToken */); var expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition); + parseExpected(21 /* CloseParenToken */); var statement = parseStatement(); return withJSDoc(finishNode(factory.createWhileStatement(expression, statement), pos), hasJSDoc); } @@ -33782,10 +33844,9 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(115 /* WithKeyword */); - var openParenPosition = scanner.getTokenPos(); parseExpected(20 /* OpenParenToken */); var expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenPosition); + parseExpected(21 /* CloseParenToken */); var statement = doInsideOfContext(16777216 /* InWithStatement */, parseStatement); return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc); } @@ -34488,7 +34549,7 @@ var ts; case 53 /* ExclamationToken */: // Non-null assertion on property name case 58 /* ColonToken */: // Type Annotation for declaration case 62 /* EqualsToken */: // Initializer for declaration - case 57 /* QuestionToken */: + case 57 /* QuestionToken */: // Not valid, but permitted so that it gets caught later on. return true; default: // Covers @@ -35776,7 +35837,8 @@ var ts; hasChildren = true; if (child.kind === 333 /* JSDocTypeTag */) { if (childTypeTag) { - var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); + parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); + var lastError = ts.lastOrUndefined(parseDiagnostics); if (lastError) { ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, 0, 0, ts.Diagnostics.The_tag_was_first_specified_here)); } @@ -43028,7 +43090,8 @@ var ts; // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = prop.kind === 289 /* PropertyAssignment */ || prop.kind === 290 /* ShorthandPropertyAssignment */ || prop.kind === 166 /* MethodDeclaration */ - ? 1 /* Property */ : 2 /* Accessor */; + ? 1 /* Property */ + : 2 /* Accessor */; var existingKind = seen.get(identifier.escapedText); if (!existingKind) { seen.set(identifier.escapedText, currentKind); @@ -43549,7 +43612,7 @@ var ts; case 252 /* FunctionDeclaration */: return bindFunctionDeclaration(node); case 167 /* Constructor */: - return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, 0 /* None */); + return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); case 168 /* GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 46015 /* GetAccessorExcludes */); case 169 /* SetAccessor */: @@ -43642,7 +43705,8 @@ var ts; case 337 /* JSDocPropertyTag */: var propTag = node; var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 308 /* JSDocOptionalType */ ? - 4 /* Property */ | 16777216 /* Optional */ : 4 /* Property */; + 4 /* Property */ | 16777216 /* Optional */ : + 4 /* Property */; return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* PropertyExcludes */); case 335 /* JSDocTypedefTag */: case 328 /* JSDocCallbackTag */: @@ -43680,9 +43744,9 @@ var ts; else { var flags = ts.exportAssignmentIsAlias(node) // An export default clause with an EntityNameExpression or a class expression exports all meanings of that identifier or expression; - ? 2097152 /* Alias */ - // An export default clause with any other expression exports a value - : 4 /* Property */; + ? 2097152 /* Alias */ + // An export default clause with any other expression exports a value + : 4 /* Property */; // If there is an `export default x;` alias declaration, can't `export default` anything else. // (In contrast, you can still have `export default function f() {}` and `export default interface I {}`.) var symbol = declareSymbol(container.symbol.exports, container.symbol, node, flags, 67108863 /* All */); @@ -43791,7 +43855,8 @@ var ts; } // 'module.exports = expr' assignment var flags = ts.exportAssignmentIsAlias(node) - ? 2097152 /* Alias */ : 4 /* Property */ | 1048576 /* ExportValue */ | 512 /* ValueModule */; + ? 2097152 /* Alias */ + : 4 /* Property */ | 1048576 /* ExportValue */ | 512 /* ValueModule */; var symbol = declareSymbol(file.symbol.exports, file.symbol, node, flags | 67108864 /* Assignment */, 0 /* None */); ts.setValueDeclaration(symbol, node); } @@ -46576,7 +46641,7 @@ var ts; case 254 /* InterfaceDeclaration */: case 256 /* EnumDeclaration */: case 255 /* TypeAliasDeclaration */: - case 257 /* ModuleDeclaration */: + case 257 /* ModuleDeclaration */: // For `namespace N { N; }` return true; default: return false; @@ -50501,7 +50566,8 @@ var ts; // A Class + Property merge is made for a `module.exports.Member = class {}`, and it doesn't serialize well as either a class _or_ a property symbol - in fact, _it behaves like an alias!_ // `var` is `FunctionScopedVariable`, `const` and `let` are `BlockScopedVariable`, and `module.exports.thing =` is `Property` var flags = !(symbol.flags & 2 /* BlockScopedVariable */) ? undefined - : isConstVariable(symbol) ? 2 /* Const */ : 1 /* Let */; + : isConstVariable(symbol) ? 2 /* Const */ + : 1 /* Let */; var name = (needsPostExportDefault || !(symbol.flags & 4 /* Property */)) ? localName : getUnusedName(localName, symbol); var textRange = symbol.declarations && ts.find(symbol.declarations, function (d) { return ts.isVariableDeclaration(d); }); if (textRange && ts.isVariableDeclarationList(textRange.parent) && textRange.parent.declarations.length === 1) { @@ -51141,7 +51207,9 @@ var ts; ], 2 /* Const */)); // Inlined JSON types exported with [module.]exports= will already emit an export=, so should use `declare`. // Otherwise, the type itself should be exported. - addResult(statement, target && target.flags & 4 /* Property */ && target.escapedName === "export=" /* ExportEquals */ ? 2 /* Ambient */ : name === varName ? 1 /* Export */ : 0 /* None */); + addResult(statement, target && target.flags & 4 /* Property */ && target.escapedName === "export=" /* ExportEquals */ ? 2 /* Ambient */ + : name === varName ? 1 /* Export */ + : 0 /* None */); } if (isExportAssignmentCompatibleSymbolName) { results.push(ts.factory.createExportAssignment( @@ -56603,7 +56671,8 @@ var ts; return getRestTypeElementFlags(node); case 193 /* NamedTupleMember */: return node.questionToken ? 2 /* Optional */ : - node.dotDotDotToken ? getRestTypeElementFlags(node) : 1 /* Required */; + node.dotDotDotToken ? getRestTypeElementFlags(node) : + 1 /* Required */; default: return 1 /* Required */; } @@ -57180,7 +57249,7 @@ var ts; } function createUnionType(types, aliasSymbol, aliasTypeArguments, origin) { var result = createType(1048576 /* Union */); - result.objectFlags = getPropagatingFlagsOfTypes(types, 98304 /* Nullable */); + result.objectFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 98304 /* Nullable */); result.types = types; result.origin = origin; result.aliasSymbol = aliasSymbol; @@ -57368,7 +57437,7 @@ var ts; } function createIntersectionType(types, aliasSymbol, aliasTypeArguments) { var result = createType(2097152 /* Intersection */); - result.objectFlags = getPropagatingFlagsOfTypes(types, 98304 /* Nullable */); + result.objectFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 98304 /* Nullable */); result.types = types; result.aliasSymbol = aliasSymbol; result.aliasTypeArguments = aliasTypeArguments; @@ -59391,7 +59460,7 @@ var ts; case 209 /* FunctionExpression */: case 210 /* ArrowFunction */: case 166 /* MethodDeclaration */: - case 252 /* FunctionDeclaration */: + case 252 /* FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type return isContextSensitiveFunctionLikeDeclaration(node); case 201 /* ObjectLiteralExpression */: return ts.some(node.properties, isContextSensitive); @@ -60115,7 +60184,8 @@ var ts; } } var related = source.type === target.type ? -1 /* True */ : - source.type && target.type ? compareTypes(source.type, target.type, reportErrors) : 0 /* False */; + source.type && target.type ? compareTypes(source.type, target.type, reportErrors) : + 0 /* False */; if (related === 0 /* False */ && reportErrors) { errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); } @@ -62188,8 +62258,10 @@ var ts; } var sourceIsJSConstructor = source.symbol && isJSConstructor(source.symbol.valueDeclaration); var targetIsJSConstructor = target.symbol && isJSConstructor(target.symbol.valueDeclaration); - var sourceSignatures = getSignaturesOfType(source, (sourceIsJSConstructor && kind === 1 /* Construct */) ? 0 /* Call */ : kind); - var targetSignatures = getSignaturesOfType(target, (targetIsJSConstructor && kind === 1 /* Construct */) ? 0 /* Call */ : kind); + var sourceSignatures = getSignaturesOfType(source, (sourceIsJSConstructor && kind === 1 /* Construct */) ? + 0 /* Call */ : kind); + var targetSignatures = getSignaturesOfType(target, (targetIsJSConstructor && kind === 1 /* Construct */) ? + 0 /* Call */ : kind); if (kind === 1 /* Construct */ && sourceSignatures.length && targetSignatures.length) { var sourceIsAbstract = !!(sourceSignatures[0].flags & 4 /* Abstract */); var targetIsAbstract = !!(targetSignatures[0].flags & 4 /* Abstract */); @@ -62871,7 +62943,8 @@ var ts; function compareTypePredicatesIdentical(source, target, compareTypes) { return !(source && target && typePredicateKindsMatch(source, target)) ? 0 /* False */ : source.type === target.type ? -1 /* True */ : - source.type && target.type ? compareTypes(source.type, target.type) : 0 /* False */; + source.type && target.type ? compareTypes(source.type, target.type) : + 0 /* False */; } function literalTypesWithSameBaseType(types) { var commonBaseType; @@ -64310,7 +64383,9 @@ var ts; // We assign a lower priority to inferences made from types containing non-inferrable // types because we may only have a partial result (i.e. we may have failed to make // reverse inferences for some properties). - inferWithPriority(inferredType, inference.typeParameter, ts.getObjectFlags(source) & 524288 /* NonInferrableType */ ? 16 /* PartialHomomorphicMappedType */ : 8 /* HomomorphicMappedType */); + inferWithPriority(inferredType, inference.typeParameter, ts.getObjectFlags(source) & 524288 /* NonInferrableType */ ? + 16 /* PartialHomomorphicMappedType */ : + 8 /* HomomorphicMappedType */); } } return true; @@ -66757,7 +66832,7 @@ var ts; return !!ts.findAncestor(location, function (e) { return e.parent && ts.isExportAssignment(e.parent) && e.parent.expression === e && ts.isEntityNameExpression(e); }); } function markAliasReferenced(symbol, location) { - if (isNonLocalAlias(symbol, 111551 /* Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) { + if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) { var target = resolveAlias(symbol); if (target.flags & 111551 /* Value */) { // An alias resolving to a const enum cannot be elided if (1) 'isolatedModules' is enabled @@ -70160,7 +70235,8 @@ var ts; } var effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType; var accessFlags = ts.isAssignmentTarget(node) ? - 2 /* Writing */ | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 1 /* NoIndexSignatures */ : 0) : 0 /* None */; + 2 /* Writing */ | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 1 /* NoIndexSignatures */ : 0) : + 0 /* None */; var indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, /*noUncheckedIndexedAccessCandidate*/ undefined, node, accessFlags | 16 /* ExpressionPosition */) || errorType; return checkIndexedAccessIndexType(getFlowTypeOfAccessExpression(node, getNodeLinks(node).resolvedSymbol, indexedAccessType, indexExpression, checkMode), node); } @@ -71070,14 +71146,14 @@ var ts; var i_1 = 0; var _loop_22 = function (c) { var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); }; - var diags_3 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* Normal */, /*reportErrors*/ true, chain_2); - if (diags_3) { - if (diags_3.length <= min_3) { - min_3 = diags_3.length; + var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* Normal */, /*reportErrors*/ true, chain_2); + if (diags_2) { + if (diags_2.length <= min_3) { + min_3 = diags_2.length; minIndex = i_1; } - max = Math.max(max, diags_3.length); - allDiagnostics.push(diags_3); + max = Math.max(max, diags_2.length); + allDiagnostics.push(diags_2); } else { ts.Debug.fail("No error for 3 or fewer overload signatures"); @@ -71088,15 +71164,15 @@ var ts; var c = candidatesForArgumentError_1[_a]; _loop_22(c); } - var diags_2 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics); - ts.Debug.assert(diags_2.length > 0, "No errors reported for 3 or fewer overload signatures"); - var chain = ts.chainDiagnosticMessages(ts.map(diags_2, function (d) { return typeof d.messageText === "string" ? d : d.messageText; }), ts.Diagnostics.No_overload_matches_this_call); + var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics); + ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures"); + var chain = ts.chainDiagnosticMessages(ts.map(diags_3, function (d) { return typeof d.messageText === "string" ? d : d.messageText; }), ts.Diagnostics.No_overload_matches_this_call); // The below is a spread to guarantee we get a new (mutable) array - our `flatMap` helper tries to do "smart" optimizations where it reuses input // arrays and the emptyArray singleton where possible, which is decidedly not what we want while we're still constructing this diagnostic - var related = __spreadArray([], ts.flatMap(diags_2, function (d) { return d.relatedInformation; })); + var related = __spreadArray([], ts.flatMap(diags_3, function (d) { return d.relatedInformation; })); var diag = void 0; - if (ts.every(diags_2, function (d) { return d.start === diags_2[0].start && d.length === diags_2[0].length && d.file === diags_2[0].file; })) { - var _b = diags_2[0], file = _b.file, start = _b.start, length_7 = _b.length; + if (ts.every(diags_3, function (d) { return d.start === diags_3[0].start && d.length === diags_3[0].length && d.file === diags_3[0].file; })) { + var _b = diags_3[0], file = _b.file, start = _b.start, length_7 = _b.length; diag = { file: file, start: start, length: length_7, code: chain.code, category: chain.category, messageText: chain, relatedInformation: related }; } else { @@ -71358,7 +71434,8 @@ var ts; if (ts.isCallChain(node)) { var nonOptionalType = getOptionalExpressionType(funcType, node.expression); callChainFlags = nonOptionalType === funcType ? 0 /* None */ : - ts.isOutermostOptionalChain(node) ? 16 /* IsOuterCallChain */ : 8 /* IsInnerCallChain */; + ts.isOutermostOptionalChain(node) ? 16 /* IsOuterCallChain */ : + 8 /* IsInnerCallChain */; funcType = nonOptionalType; } else { @@ -72135,8 +72212,10 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 /* Function */ - ? 252 /* FunctionDeclaration */ : resolvedRequire.flags & 3 /* Variable */ - ? 250 /* VariableDeclaration */ : 0 /* Unknown */; + ? 252 /* FunctionDeclaration */ + : resolvedRequire.flags & 3 /* Variable */ + ? 250 /* VariableDeclaration */ + : 0 /* Unknown */; if (targetDeclarationKind !== 0 /* Unknown */) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); // function/variable declaration should be ambient @@ -75794,7 +75873,7 @@ var ts; case 199 /* BindingElement */: case 252 /* FunctionDeclaration */: case 266 /* ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 - case 78 /* Identifier */: + case 78 /* Identifier */: // https://github.com/microsoft/TypeScript/issues/36098 // Identifiers are used as declarations of assignment declarations whose parents may be // SyntaxKind.CallExpression - `Object.defineProperty(thing, "aField", {value: 42});` // SyntaxKind.ElementAccessExpression - `thing["aField"] = 42;` or `thing["aField"];` (with a doc comment on it) @@ -77070,7 +77149,12 @@ var ts; if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) { return false; } - var interestingFlags = 8 /* Private */ | 16 /* Protected */ | 256 /* Async */ | 128 /* Abstract */ | 64 /* Readonly */ | 32 /* Static */; + var interestingFlags = 8 /* Private */ | + 16 /* Protected */ | + 256 /* Async */ | + 128 /* Abstract */ | + 64 /* Readonly */ | + 32 /* Static */; return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags); } function checkVariableDeclaration(node) { @@ -78791,9 +78875,9 @@ var ts; ts.forEach(properties, function (p) { seen.set(p.escapedName, p); }); for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { var base = baseTypes_2[_i]; - var properties_4 = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)); - for (var _a = 0, properties_5 = properties_4; _a < properties_5.length; _a++) { - var prop = properties_5[_a]; + var properties_5 = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)); + for (var _a = 0, properties_4 = properties_5; _a < properties_4.length; _a++) { + var prop = properties_4[_a]; var existing = seen.get(prop.escapedName); if (existing && !isPropertyIdenticalTo(existing, prop)) { seen.delete(prop.escapedName); @@ -80496,7 +80580,7 @@ var ts; } } if (name.parent.kind === 173 /* TypePredicate */) { - return resolveEntityName(name, 1 /* FunctionScopedVariable */); + return resolveEntityName(name, /*meaning*/ 1 /* FunctionScopedVariable */); } return undefined; } @@ -80885,7 +80969,7 @@ var ts; var symbol = getReferencedValueSymbol(node); // We should only get the declaration of an alias if there isn't a local value // declaration for the symbol - if (isNonLocalAlias(symbol, 111551 /* Value */) && !getTypeOnlyAliasDeclaration(symbol)) { + if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* Value */) && !getTypeOnlyAliasDeclaration(symbol)) { return getDeclarationOfAliasSymbol(symbol); } } @@ -88438,7 +88522,9 @@ var ts; } function visitPrefixUnaryExpression(node) { if (shouldTransformPrivateElements && ts.isPrivateIdentifierPropertyAccessExpression(node.operand)) { - var operator = node.operator === 45 /* PlusPlusToken */ ? 39 /* PlusToken */ : node.operator === 46 /* MinusMinusToken */ ? 40 /* MinusToken */ : undefined; + var operator = node.operator === 45 /* PlusPlusToken */ ? + 39 /* PlusToken */ : node.operator === 46 /* MinusMinusToken */ ? + 40 /* MinusToken */ : undefined; var info = void 0; if (operator && (info = accessPrivateIdentifier(node.operand.name))) { var receiver = ts.visitNode(node.operand.expression, visitor, ts.isExpression); @@ -88451,7 +88537,9 @@ var ts; } function visitPostfixUnaryExpression(node, valueIsDiscarded) { if (shouldTransformPrivateElements && ts.isPrivateIdentifierPropertyAccessExpression(node.operand)) { - var operator = node.operator === 45 /* PlusPlusToken */ ? 39 /* PlusToken */ : node.operator === 46 /* MinusMinusToken */ ? 40 /* MinusToken */ : undefined; + var operator = node.operator === 45 /* PlusPlusToken */ ? + 39 /* PlusToken */ : node.operator === 46 /* MinusMinusToken */ ? + 40 /* MinusToken */ : undefined; var info = void 0; if (operator && (info = accessPrivateIdentifier(node.operand.name))) { var receiver = ts.visitNode(node.operand.expression, visitor, ts.isExpression); @@ -88591,10 +88679,11 @@ var ts; return ts.visitEachChild(node, visitor, context); } var staticProperties = ts.getProperties(node, /*requireInitializer*/ false, /*isStatic*/ true); + var pendingPrivateStateAssignment; if (shouldTransformPrivateElements && ts.some(node.members, function (m) { return ts.hasStaticModifier(m) && !!m.name && ts.isPrivateIdentifier(m.name); })) { var temp = factory.createTempVariable(hoistVariableDeclaration, /* reservedInNestedScopes */ true); getPrivateIdentifierEnvironment().classConstructor = factory.cloneNode(temp); - getPendingExpressions().push(factory.createAssignment(temp, factory.getInternalName(node))); + pendingPrivateStateAssignment = factory.createAssignment(temp, factory.getInternalName(node)); } var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 103 /* NullKeyword */); @@ -88603,6 +88692,9 @@ var ts; /*decorators*/ undefined, node.modifiers, node.name, /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)) ]; + if (pendingPrivateStateAssignment) { + getPendingExpressions().unshift(pendingPrivateStateAssignment); + } // Write any pending expressions from elided or moved computed property names if (ts.some(pendingExpressions)) { statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))); @@ -90166,7 +90258,9 @@ var ts; return ts.visitEachChild(node, expressionResultIsUnused ? visitorWithUnusedExpressionResult : visitor, context); } function visitSourceFile(node) { - var ancestorFacts = enterSubtree(2 /* SourceFileExcludes */, ts.isEffectiveStrictModeSourceFile(node, compilerOptions) ? 0 /* StrictModeSourceFileIncludes */ : 1 /* SourceFileIncludes */); + var ancestorFacts = enterSubtree(2 /* SourceFileExcludes */, ts.isEffectiveStrictModeSourceFile(node, compilerOptions) ? + 0 /* StrictModeSourceFileIncludes */ : + 1 /* SourceFileIncludes */); exportedVariableStatement = false; var visited = ts.visitEachChild(node, visitor, context); var statement = ts.concatenate(visited.statements, taggedTemplateStringDeclarations && [ @@ -101084,7 +101178,13 @@ var ts; }); } ts.isInternalDeclaration = isInternalDeclaration; - var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */; + var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | + 2048 /* WriteClassExpressionAsTypeLiteral */ | + 4096 /* UseTypeOfFunction */ | + 8 /* UseStructuralFallback */ | + 524288 /* AllowEmptyTuple */ | + 4 /* GenerateNamesForShadowedTypeParams */ | + 1 /* NoTruncation */; /** * Transforms a ts file into a .d.ts file * This process requires type information, which is retrieved through the emit resolver. Because of this, @@ -101985,7 +102085,7 @@ var ts; } var previousNeedsDeclare = needsDeclare; switch (input.kind) { - case 255 /* TypeAliasDeclaration */: + case 255 /* TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all return cleanup(factory.updateTypeAliasDeclaration(input, /*decorators*/ undefined, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); case 254 /* InterfaceDeclaration */: { @@ -103073,8 +103173,11 @@ var ts; if (configFile.options.emitDeclarationOnly) return undefined; var isJsonFile = ts.fileExtensionIs(inputFileName, ".json" /* Json */); - var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory), isJsonFile ? ".json" /* Json */ : - configFile.options.jsx === 1 /* Preserve */ && (ts.fileExtensionIs(inputFileName, ".tsx" /* Tsx */) || ts.fileExtensionIs(inputFileName, ".jsx" /* Jsx */)) ? ".jsx" /* Jsx */ : ".js" /* Js */); + var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory), isJsonFile ? + ".json" /* Json */ : + configFile.options.jsx === 1 /* Preserve */ && (ts.fileExtensionIs(inputFileName, ".tsx" /* Tsx */) || ts.fileExtensionIs(inputFileName, ".jsx" /* Jsx */)) ? + ".jsx" /* Jsx */ : + ".js" /* Js */); return !isJsonFile || ts.comparePaths(inputFileName, outputFileName, ts.Debug.checkDefined(configFile.options.configFilePath), ignoreCase) !== 0 /* EqualTo */ ? outputFileName : undefined; @@ -104641,7 +104744,9 @@ var ts; var pos = getTextPosWithWriteLine(); writeUnparsedNode(unparsed); if (bundleFileInfo) { - updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 295 /* UnparsedText */ ? "text" /* Text */ : "internal" /* Internal */); + updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 295 /* UnparsedText */ ? + "text" /* Text */ : + "internal" /* Internal */); } } // SyntaxKind.UnparsedSyntheticReference @@ -114163,7 +114268,8 @@ var ts; return { relativePreference: importModuleSpecifierPreference === "relative" ? 0 /* Relative */ : importModuleSpecifierPreference === "non-relative" ? 1 /* NonRelative */ : - importModuleSpecifierPreference === "project-relative" ? 3 /* ExternalNonRelative */ : 2 /* Shortest */, + importModuleSpecifierPreference === "project-relative" ? 3 /* ExternalNonRelative */ : + 2 /* Shortest */, ending: getEnding(), }; function getEnding() { @@ -114171,14 +114277,16 @@ var ts; case "minimal": return 0 /* Minimal */; case "index": return 1 /* Index */; case "js": return 2 /* JsExtension */; - default: return usesJsExtensionOnImports(importingSourceFile) ? 2 /* JsExtension */ : ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeJs ? 1 /* Index */ : 0 /* Minimal */; + default: return usesJsExtensionOnImports(importingSourceFile) ? 2 /* JsExtension */ + : ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeJs ? 1 /* Index */ : 0 /* Minimal */; } } } function getPreferencesForUpdate(compilerOptions, oldImportSpecifier) { return { relativePreference: ts.isExternalModuleNameRelative(oldImportSpecifier) ? 0 /* Relative */ : 1 /* NonRelative */, - ending: ts.hasJSFileExtension(oldImportSpecifier) ? 2 /* JsExtension */ : + ending: ts.hasJSFileExtension(oldImportSpecifier) ? + 2 /* JsExtension */ : ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeJs || ts.endsWith(oldImportSpecifier, "index") ? 1 /* Index */ : 0 /* Minimal */, }; } diff --git a/package.json b/package.json index c5270a50a2e24..2f3518663a299 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "https://www.typescriptlang.org/", - "version": "4.3.1-rc", + "version": "4.3.2", "license": "Apache-2.0", "description": "TypeScript is a language for application scale JavaScript development", "keywords": [ diff --git a/src/compiler/corePublic.ts b/src/compiler/corePublic.ts index f0fb790244b1c..ec1ec375ff1d3 100644 --- a/src/compiler/corePublic.ts +++ b/src/compiler/corePublic.ts @@ -5,7 +5,7 @@ namespace ts { // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types - export const version = "4.3.1-rc" as string; + export const version = "4.3.2" as string; /** * Type of objects whose values are all of the same type.