From 54426a14f4c232da8e563d20ca8e71263e1c96b5 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Wed, 22 Nov 2017 09:55:48 -0800 Subject: [PATCH] Update LKG --- lib/enu/diagnosticMessages.generated.json.lcg | 18 + lib/protocol.d.ts | 3 +- lib/tsc.js | 1338 ++++++----- lib/tsserver.js | 2038 +++++++++------- lib/tsserverlibrary.d.ts | 140 +- lib/tsserverlibrary.js | 2104 ++++++++++------- lib/typescript.d.ts | 120 +- lib/typescript.js | 1841 ++++++++------- lib/typescriptServices.d.ts | 120 +- lib/typescriptServices.js | 1841 ++++++++------- lib/typingsInstaller.js | 514 ++-- 11 files changed, 5779 insertions(+), 4298 deletions(-) diff --git a/lib/enu/diagnosticMessages.generated.json.lcg b/lib/enu/diagnosticMessages.generated.json.lcg index 7400710ad89..1a36bfac6d7 100644 --- a/lib/enu/diagnosticMessages.generated.json.lcg +++ b/lib/enu/diagnosticMessages.generated.json.lcg @@ -1923,6 +1923,12 @@ + + + + + + @@ -2727,6 +2733,18 @@ + + + + + + + + + + + + diff --git a/lib/protocol.d.ts b/lib/protocol.d.ts index 2ce24238fe9..c44d917e01e 100644 --- a/lib/protocol.d.ts +++ b/lib/protocol.d.ts @@ -427,7 +427,8 @@ declare namespace ts.server.protocol { */ errorCodes?: number[]; } - interface ApplyCodeActionCommandRequestArgs extends FileRequestArgs { + interface ApplyCodeActionCommandRequestArgs { + /** May also be an array of commands. */ command: {}; } /** diff --git a/lib/tsc.js b/lib/tsc.js index 03630d7d29b..ee5f3dc73a7 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -1158,6 +1158,10 @@ var ts; return Array.isArray ? Array.isArray(value) : value instanceof Array; } ts.isArray = isArray; + function toArray(value) { + return isArray(value) ? value : [value]; + } + ts.toArray = toArray; function isString(text) { return typeof text === "string"; } @@ -2066,6 +2070,11 @@ var ts; return (removeFileExtension(path) + newExtension); } ts.changeExtension = changeExtension; + function removeMinAndVersionNumbers(fileName) { + var trailingMinOrVersion = /[.-]((min)|(\d+(\.\d+)*))$/; + return fileName.replace(trailingMinOrVersion, "").replace(trailingMinOrVersion, ""); + } + ts.removeMinAndVersionNumbers = removeMinAndVersionNumbers; function Symbol(flags, name) { this.flags = flags; this.escapedName = name; @@ -2434,9 +2443,7 @@ var ts; function addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath) { var existingResult = getCachedFileSystemEntries(fileOrDirectoryPath); if (existingResult) { - if (!host.directoryExists(fileOrDirectory)) { - cachedReadDirectoryResult.delete(fileOrDirectoryPath); - } + clearCache(); } else { var parentResult = getCachedFileSystemEntriesForBaseDir(fileOrDirectoryPath); @@ -2447,8 +2454,12 @@ var ts; fileExists: host.fileExists(fileOrDirectoryPath), directoryExists: host.directoryExists(fileOrDirectoryPath) }; - updateFilesOfFileSystemEntry(parentResult, baseName, fsQueryResult.fileExists); - updateFileSystemEntry(parentResult.directories, baseName, fsQueryResult.directoryExists); + if (fsQueryResult.directoryExists || hasEntry(parentResult.directories, baseName)) { + clearCache(); + } + else { + updateFilesOfFileSystemEntry(parentResult, baseName, fsQueryResult.fileExists); + } return fsQueryResult; } } @@ -3803,6 +3814,9 @@ var ts; super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: diag(17011, ts.DiagnosticCategory.Error, "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", "'super' must be called before accessing a property of 'super' in the constructor of a derived class."), _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2: diag(17012, ts.DiagnosticCategory.Error, "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012", "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'?"), Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: diag(17013, ts.DiagnosticCategory.Error, "Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013", "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor."), + JSX_fragment_has_no_corresponding_closing_tag: diag(17014, ts.DiagnosticCategory.Error, "JSX_fragment_has_no_corresponding_closing_tag_17014", "JSX fragment has no corresponding closing tag."), + Expected_corresponding_closing_tag_for_JSX_fragment: diag(17015, ts.DiagnosticCategory.Error, "Expected_corresponding_closing_tag_for_JSX_fragment_17015", "Expected corresponding closing tag for JSX fragment."), + JSX_fragment_is_not_supported_when_using_jsxFactory: diag(17016, ts.DiagnosticCategory.Error, "JSX_fragment_is_not_supported_when_using_jsxFactory_17016", "JSX fragment is not supported when using --jsxFactory"), Circularity_detected_while_resolving_configuration_Colon_0: diag(18000, ts.DiagnosticCategory.Error, "Circularity_detected_while_resolving_configuration_Colon_0_18000", "Circularity detected while resolving configuration: {0}"), A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: diag(18001, ts.DiagnosticCategory.Error, "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", "A path in an 'extends' option must be relative or rooted, but '{0}' is not."), The_files_list_in_config_file_0_is_empty: diag(18002, ts.DiagnosticCategory.Error, "The_files_list_in_config_file_0_is_empty_18002", "The 'files' list in config file '{0}' is empty."), @@ -3852,6 +3866,10 @@ var ts; return token >= 71; } ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; + function tokenIsIdentifierOrKeywordOrGreaterThan(token) { + return token === 29 || tokenIsIdentifierOrKeyword(token); + } + ts.tokenIsIdentifierOrKeywordOrGreaterThan = tokenIsIdentifierOrKeywordOrGreaterThan; var textToToken = ts.createMapFromTemplate({ "abstract": 117, "any": 119, @@ -5568,7 +5586,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 265) { + while (node && node.kind !== 268) { node = node.parent; } return node; @@ -5656,7 +5674,7 @@ var ts; if (includeJsDoc && ts.hasJSDocNodes(node)) { return getTokenPosOfNode(node.jsDoc[0]); } - if (node.kind === 286 && node._children.length > 0) { + if (node.kind === 289 && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); @@ -5755,7 +5773,7 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 226 && node.parent.kind === 260; + return node.kind === 226 && node.parent.kind === 263; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { @@ -5779,7 +5797,7 @@ var ts; return node && node.kind === 233 && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 265 || + return node.kind === 268 || node.kind === 233 || ts.isFunctionLike(node); } @@ -5793,7 +5811,7 @@ var ts; return false; } switch (node.parent.kind) { - case 265: + case 268: return ts.isExternalModule(node.parent); case 234: return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); @@ -5807,9 +5825,9 @@ var ts; ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { - case 265: + case 268: case 235: - case 260: + case 263: case 233: case 214: case 215: @@ -5836,12 +5854,12 @@ var ts; case 157: case 160: case 161: - case 273: + case 276: case 229: case 199: case 230: case 231: - case 282: + case 285: case 228: case 151: case 152: @@ -5954,7 +5972,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 265: + case 268: var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); if (pos_1 === sourceFile.text.length) { return ts.createTextSpan(0, 0); @@ -5967,7 +5985,7 @@ var ts; case 230: case 233: case 232: - case 264: + case 267: case 228: case 186: case 151: @@ -6137,11 +6155,11 @@ var ts; case 216: case 220: case 221: - case 257: - case 258: + case 260: + case 261: case 222: case 224: - case 260: + case 263: return ts.forEachChild(node, traverse); } } @@ -6196,12 +6214,12 @@ var ts; if (node) { switch (node.kind) { case 176: - case 264: + case 267: case 146: - case 261: + case 264: case 149: case 148: - case 262: + case 265: case 226: return true; } @@ -6259,7 +6277,7 @@ var ts; ts.isThisTypePredicate = isThisTypePredicate; function getPropertyAssignment(objectLiteral, key, key2) { return ts.filter(objectLiteral.properties, function (property) { - if (property.kind === 261) { + if (property.kind === 264) { var propName = getTextOfPropertyName(property.name); return key === propName || (key2 && key2 === propName); } @@ -6313,7 +6331,7 @@ var ts; case 156: case 157: case 232: - case 265: + case 268: return node; } } @@ -6497,6 +6515,7 @@ var ts; case 200: case 249: case 250: + case 253: case 197: case 191: case 204: @@ -6526,8 +6545,8 @@ var ts; case 146: case 149: case 148: + case 267: case 264: - case 261: case 176: return parent.initializer === node; case 210: @@ -6537,7 +6556,7 @@ var ts; case 219: case 220: case 221: - case 257: + case 260: case 223: return parent.expression === node; case 214: @@ -6558,9 +6577,9 @@ var ts; case 144: return node === parent.expression; case 147: - case 256: - case 255: - case 263: + case 259: + case 258: + case 266: return true; case 201: return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent); @@ -6726,8 +6745,8 @@ var ts; case 146: case 151: case 150: - case 262: - case 261: + case 265: + case 264: case 149: case 148: return node.questionToken !== undefined; @@ -6737,7 +6756,7 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 273 && + return node.kind === 276 && node.parameters.length > 0 && node.parameters[0].name && node.parameters[0].name.escapedText === "new"; @@ -6784,7 +6803,7 @@ var ts; return result || ts.emptyArray; function getJSDocCommentsAndTagsWorker(node) { var parent = node.parent; - if (parent && (parent.kind === 261 || getNestedModuleDeclaration(parent))) { + if (parent && (parent.kind === 264 || getNestedModuleDeclaration(parent))) { getJSDocCommentsAndTagsWorker(parent); } if (parent && parent.parent && @@ -6827,7 +6846,7 @@ var ts; } ts.getParameterSymbolFromJSDoc = getParameterSymbolFromJSDoc; function getJSDocHost(node) { - ts.Debug.assert(node.parent.kind === 275); + ts.Debug.assert(node.parent.kind === 278); return node.parent.parent; } ts.getJSDocHost = getJSDocHost; @@ -6867,13 +6886,13 @@ var ts; case 198: node = parent; break; - case 262: + case 265: if (parent.name !== node) { return 0; } node = parent.parent; break; - case 261: + case 264: if (parent.name === node) { return 0; } @@ -6912,7 +6931,7 @@ var ts; ts.isNodeDescendantOf = isNodeDescendantOf; function isInAmbientContext(node) { while (node) { - if (hasModifier(node, 2) || (node.kind === 265 && node.isDeclarationFile)) { + if (hasModifier(node, 2) || (node.kind === 268 && node.isDeclarationFile)) { return true; } node = node.parent; @@ -6961,8 +6980,8 @@ var ts; case 150: case 153: case 154: + case 267: case 264: - case 261: case 179: return parent.name === node; case 143: @@ -6977,7 +6996,7 @@ var ts; case 242: return parent.propertyName === node; case 246: - case 253: + case 256: return true; } return false; @@ -7077,6 +7096,14 @@ var ts; return 72 <= token && token <= 142; } ts.isKeyword = isKeyword; + function isContextualKeyword(token) { + return 117 <= token && token <= 142; + } + ts.isContextualKeyword = isContextualKeyword; + function isNonContextualKeyword(token) { + return isKeyword(token) && !isContextualKeyword(token); + } + ts.isNonContextualKeyword = isNonContextualKeyword; function isTrivia(token) { return 2 <= token && token <= 7; } @@ -7218,7 +7245,7 @@ var ts; || kind === 153 || kind === 154 || kind === 233 - || kind === 265; + || kind === 268; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(range) { @@ -7305,6 +7332,7 @@ var ts; case 199: case 249: case 250: + case 253: case 12: case 13: case 196: @@ -7391,7 +7419,7 @@ var ts; return 2; case 198: return 1; - case 289: + case 292: return 0; default: return -1; @@ -8773,8 +8801,8 @@ var ts; return undefined; } switch (declaration.kind) { - case 284: - case 279: { + case 287: + case 282: { var name = declaration.name; if (name.kind === 143) { return name.right; @@ -8793,7 +8821,7 @@ var ts; return undefined; } } - case 283: + case 286: return getNameOfJSDocTypedef(declaration); case 243: { var expression = declaration.expression; @@ -8812,27 +8840,27 @@ var ts; } ts.getJSDocParameterTags = getJSDocParameterTags; function hasJSDocParameterTags(node) { - return !!getFirstJSDocTag(node, 279); + return !!getFirstJSDocTag(node, 282); } ts.hasJSDocParameterTags = hasJSDocParameterTags; function getJSDocAugmentsTag(node) { - return getFirstJSDocTag(node, 277); + return getFirstJSDocTag(node, 280); } ts.getJSDocAugmentsTag = getJSDocAugmentsTag; function getJSDocClassTag(node) { - return getFirstJSDocTag(node, 278); + return getFirstJSDocTag(node, 281); } ts.getJSDocClassTag = getJSDocClassTag; function getJSDocReturnTag(node) { - return getFirstJSDocTag(node, 280); + return getFirstJSDocTag(node, 283); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getFirstJSDocTag(node, 282); + return getFirstJSDocTag(node, 285); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function getJSDocTypeTag(node) { - var tag = getFirstJSDocTag(node, 281); + var tag = getFirstJSDocTag(node, 284); if (tag && tag.typeExpression && tag.typeExpression.type) { return tag; } @@ -8840,7 +8868,7 @@ var ts; } ts.getJSDocTypeTag = getJSDocTypeTag; function getJSDocType(node) { - var tag = getFirstJSDocTag(node, 281); + var tag = getFirstJSDocTag(node, 284); if (!tag && node.kind === 146) { var paramTags = getJSDocParameterTags(node); if (paramTags) { @@ -9083,7 +9111,7 @@ var ts; } ts.isParenthesizedExpression = isParenthesizedExpression; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 288) { + while (node.kind === 291) { node = node.expression; } return node; @@ -9357,138 +9385,150 @@ var ts; return node.kind === 252; } ts.isJsxClosingElement = isJsxClosingElement; - function isJsxAttribute(node) { + function isJsxFragment(node) { return node.kind === 253; } + ts.isJsxFragment = isJsxFragment; + function isJsxOpeningFragment(node) { + return node.kind === 254; + } + ts.isJsxOpeningFragment = isJsxOpeningFragment; + function isJsxClosingFragment(node) { + return node.kind === 255; + } + ts.isJsxClosingFragment = isJsxClosingFragment; + function isJsxAttribute(node) { + return node.kind === 256; + } ts.isJsxAttribute = isJsxAttribute; function isJsxAttributes(node) { - return node.kind === 254; + return node.kind === 257; } ts.isJsxAttributes = isJsxAttributes; function isJsxSpreadAttribute(node) { - return node.kind === 255; + return node.kind === 258; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxExpression(node) { - return node.kind === 256; + return node.kind === 259; } ts.isJsxExpression = isJsxExpression; function isCaseClause(node) { - return node.kind === 257; + return node.kind === 260; } ts.isCaseClause = isCaseClause; function isDefaultClause(node) { - return node.kind === 258; + return node.kind === 261; } ts.isDefaultClause = isDefaultClause; function isHeritageClause(node) { - return node.kind === 259; + return node.kind === 262; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 260; + return node.kind === 263; } ts.isCatchClause = isCatchClause; function isPropertyAssignment(node) { - return node.kind === 261; + return node.kind === 264; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 262; + return node.kind === 265; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isSpreadAssignment(node) { - return node.kind === 263; + return node.kind === 266; } ts.isSpreadAssignment = isSpreadAssignment; function isEnumMember(node) { - return node.kind === 264; + return node.kind === 267; } ts.isEnumMember = isEnumMember; function isSourceFile(node) { - return node.kind === 265; + return node.kind === 268; } ts.isSourceFile = isSourceFile; function isBundle(node) { - return node.kind === 266; + return node.kind === 269; } ts.isBundle = isBundle; function isJSDocTypeExpression(node) { - return node.kind === 267; + return node.kind === 270; } ts.isJSDocTypeExpression = isJSDocTypeExpression; function isJSDocAllType(node) { - return node.kind === 268; + return node.kind === 271; } ts.isJSDocAllType = isJSDocAllType; function isJSDocUnknownType(node) { - return node.kind === 269; + return node.kind === 272; } ts.isJSDocUnknownType = isJSDocUnknownType; function isJSDocNullableType(node) { - return node.kind === 270; + return node.kind === 273; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 271; + return node.kind === 274; } ts.isJSDocNonNullableType = isJSDocNonNullableType; function isJSDocOptionalType(node) { - return node.kind === 272; + return node.kind === 275; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 273; + return node.kind === 276; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 274; + return node.kind === 277; } ts.isJSDocVariadicType = isJSDocVariadicType; function isJSDoc(node) { - return node.kind === 275; + return node.kind === 278; } ts.isJSDoc = isJSDoc; function isJSDocAugmentsTag(node) { - return node.kind === 277; + return node.kind === 280; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocParameterTag(node) { - return node.kind === 279; + return node.kind === 282; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 280; + return node.kind === 283; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocTypeTag(node) { - return node.kind === 281; + return node.kind === 284; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 282; + return node.kind === 285; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 283; + return node.kind === 286; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocPropertyTag(node) { - return node.kind === 284; + return node.kind === 287; } ts.isJSDocPropertyTag = isJSDocPropertyTag; function isJSDocPropertyLikeTag(node) { - return node.kind === 284 || node.kind === 279; + return node.kind === 287 || node.kind === 282; } ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; function isJSDocTypeLiteral(node) { - return node.kind === 285; + return node.kind === 288; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; })(ts || (ts = {})); (function (ts) { function isSyntaxList(n) { - return n.kind === 286; + return n.kind === 289; } ts.isSyntaxList = isSyntaxList; function isNode(node) { @@ -9614,7 +9654,7 @@ var ts; case 156: case 157: case 160: - case 273: + case 276: case 161: return true; default: @@ -9658,9 +9698,9 @@ var ts; ts.isTypeElement = isTypeElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 261 - || kind === 262 - || kind === 263 + return kind === 264 + || kind === 265 + || kind === 266 || kind === 151 || kind === 153 || kind === 154 @@ -9681,13 +9721,13 @@ var ts; || kind === 95 || kind === 130 || kind === 201 - || kind === 268 - || kind === 269 - || kind === 270 || kind === 271 || kind === 272 || kind === 273 - || kind === 274; + || kind === 274 + || kind === 275 + || kind === 276 + || kind === 277; } function isTypeNode(node) { return isTypeNodeKind(node.kind); @@ -9798,6 +9838,7 @@ var ts; case 181: case 249: case 250: + case 253: case 183: case 177: case 185: @@ -9866,8 +9907,8 @@ var ts; case 198: case 202: case 200: - case 289: - case 288: + case 292: + case 291: return true; default: return isUnaryExpressionKind(kind); @@ -9880,11 +9921,11 @@ var ts; } ts.isAssertionExpression = isAssertionExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 288; + return node.kind === 291; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isNotEmittedStatement(node) { - return node.kind === 287; + return node.kind === 290; } ts.isNotEmittedStatement = isNotEmittedStatement; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -9960,7 +10001,7 @@ var ts; || kind === 199 || kind === 152 || kind === 232 - || kind === 264 + || kind === 267 || kind === 246 || kind === 228 || kind === 186 @@ -9969,22 +10010,22 @@ var ts; || kind === 237 || kind === 242 || kind === 230 - || kind === 253 + || kind === 256 || kind === 151 || kind === 150 || kind === 233 || kind === 236 || kind === 240 || kind === 146 - || kind === 261 + || kind === 264 || kind === 149 || kind === 148 || kind === 154 - || kind === 262 + || kind === 265 || kind === 231 || kind === 145 || kind === 226 - || kind === 283; + || kind === 286; } function isDeclarationStatementKind(kind) { return kind === 228 @@ -10019,13 +10060,13 @@ var ts; || kind === 208 || kind === 213 || kind === 220 - || kind === 287 - || kind === 291 - || kind === 290; + || kind === 290 + || kind === 294 + || kind === 293; } function isDeclaration(node) { if (node.kind === 145) { - return node.parent.kind !== 282 || ts.isInJavaScriptFile(node); + return node.parent.kind !== 285 || ts.isInJavaScriptFile(node); } return isDeclarationKind(node.kind); } @@ -10049,7 +10090,7 @@ var ts; if (node.kind !== 207) return false; if (node.parent !== undefined) { - if (node.parent.kind === 224 || node.parent.kind === 260) { + if (node.parent.kind === 224 || node.parent.kind === 263) { return false; } } @@ -10072,21 +10113,22 @@ var ts; function isJsxChild(node) { var kind = node.kind; return kind === 249 - || kind === 256 + || kind === 259 || kind === 250 - || kind === 10; + || kind === 10 + || kind === 253; } ts.isJsxChild = isJsxChild; function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 253 - || kind === 255; + return kind === 256 + || kind === 258; } ts.isJsxAttributeLike = isJsxAttributeLike; function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 9 - || kind === 256; + || kind === 259; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isJsxOpeningLikeElement(node) { @@ -10097,20 +10139,20 @@ var ts; ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 257 - || kind === 258; + return kind === 260 + || kind === 261; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; function isJSDocNode(node) { - return node.kind >= 267 && node.kind <= 285; + return node.kind >= 270 && node.kind <= 288; } ts.isJSDocNode = isJSDocNode; function isJSDocCommentContainingNode(node) { - return node.kind === 275 || isJSDocTag(node); + return node.kind === 278 || isJSDocTag(node); } ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode; function isJSDocTag(node) { - return node.kind >= 276 && node.kind <= 285; + return node.kind >= 279 && node.kind <= 288; } ts.isJSDocTag = isJSDocTag; function isSetAccessor(node) { @@ -10133,7 +10175,7 @@ var ts; var IdentifierConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 265) { + if (kind === 268) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 71) { @@ -10177,19 +10219,19 @@ var ts; visitNode(cbNode, node.constraint) || visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); - case 262: + case 265: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 263: + case 266: return visitNode(cbNode, node.expression); case 146: case 149: case 148: - case 261: + case 264: case 226: case 176: return visitNodes(cbNode, cbNodes, node.decorators) || @@ -10321,7 +10363,7 @@ var ts; case 207: case 234: return visitNodes(cbNode, cbNodes, node.statements); - case 265: + case 268: return visitNodes(cbNode, cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); case 208: @@ -10369,10 +10411,10 @@ var ts; visitNode(cbNode, node.caseBlock); case 235: return visitNodes(cbNode, cbNodes, node.clauses); - case 257: + case 260: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.statements); - case 258: + case 261: return visitNodes(cbNode, cbNodes, node.statements); case 222: return visitNode(cbNode, node.label) || @@ -10383,7 +10425,7 @@ var ts; return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 260: + case 263: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 147: @@ -10414,7 +10456,7 @@ var ts; visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.members); - case 264: + case 267: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 233: @@ -10461,7 +10503,7 @@ var ts; return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 144: return visitNode(cbNode, node.expression); - case 259: + case 262: return visitNodes(cbNode, cbNodes, node.types); case 201: return visitNode(cbNode, node.expression) || @@ -10470,45 +10512,49 @@ var ts; return visitNode(cbNode, node.expression); case 247: return visitNodes(cbNode, cbNodes, node.decorators); - case 289: + case 292: return visitNodes(cbNode, cbNodes, node.elements); case 249: return visitNode(cbNode, node.openingElement) || visitNodes(cbNode, cbNodes, node.children) || visitNode(cbNode, node.closingElement); + case 253: + return visitNode(cbNode, node.openingFragment) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingFragment); case 250: case 251: return visitNode(cbNode, node.tagName) || visitNode(cbNode, node.attributes); - case 254: + case 257: return visitNodes(cbNode, cbNodes, node.properties); - case 253: + case 256: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 255: + case 258: return visitNode(cbNode, node.expression); - case 256: + case 259: return visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.expression); case 252: return visitNode(cbNode, node.tagName); - case 267: - return visitNode(cbNode, node.type); - case 271: - return visitNode(cbNode, node.type); case 270: return visitNode(cbNode, node.type); - case 272: - return visitNode(cbNode, node.type); - case 273: - return visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); case 274: return visitNode(cbNode, node.type); + case 273: + return visitNode(cbNode, node.type); case 275: + return visitNode(cbNode, node.type); + case 276: + return visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + case 277: + return visitNode(cbNode, node.type); + case 278: return visitNodes(cbNode, cbNodes, node.tags); - case 279: - case 284: + case 282: + case 287: if (node.isNameFirst) { return visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression); @@ -10517,17 +10563,17 @@ var ts; return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); } - case 280: - return visitNode(cbNode, node.typeExpression); - case 281: - return visitNode(cbNode, node.typeExpression); - case 277: - return visitNode(cbNode, node.class); - case 282: - return visitNodes(cbNode, cbNodes, node.typeParameters); case 283: + return visitNode(cbNode, node.typeExpression); + case 284: + return visitNode(cbNode, node.typeExpression); + case 280: + return visitNode(cbNode, node.class); + case 285: + return visitNodes(cbNode, cbNodes, node.typeParameters); + case 286: if (node.typeExpression && - node.typeExpression.kind === 267) { + node.typeExpression.kind === 270) { return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName); } @@ -10535,7 +10581,7 @@ var ts; return visitNode(cbNode, node.fullName) || visitNode(cbNode, node.typeExpression); } - case 285: + case 288: if (node.jsDocPropertyTags) { for (var _i = 0, _a = node.jsDocPropertyTags; _i < _a.length; _i++) { var tag = _a[_i]; @@ -10543,7 +10589,7 @@ var ts; } } return; - case 288: + case 291: return visitNode(cbNode, node.expression); } } @@ -10734,7 +10780,7 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion, scriptKind) { - var sourceFile = new SourceFileConstructor(265, 0, sourceText.length); + var sourceFile = new SourceFileConstructor(268, 0, sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -11171,6 +11217,10 @@ var ts; nextToken(); return ts.tokenIsIdentifierOrKeyword(token()); } + function nextTokenIsIdentifierOrKeywordOrGreaterThan() { + nextToken(); + return ts.tokenIsIdentifierOrKeywordOrGreaterThan(token()); + } function isHeritageClauseExtendsOrImplementsKeyword() { if (token() === 108 || token() === 85) { @@ -11355,8 +11405,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 257: - case 258: + case 260: + case 261: return true; } } @@ -11400,7 +11450,7 @@ var ts; return false; } function isReusableEnumMember(node) { - return node.kind === 264; + return node.kind === 267; } function isReusableTypeMember(node) { if (node) { @@ -11621,7 +11671,7 @@ var ts; return finishNode(node); } function parseJSDocAllType() { - var result = createNode(268); + var result = createNode(271); nextToken(); return finishNode(result); } @@ -11634,18 +11684,18 @@ var ts; token() === 29 || token() === 58 || token() === 49) { - var result = createNode(269, pos); + var result = createNode(272, pos); return finishNode(result); } else { - var result = createNode(270, pos); + var result = createNode(273, pos); result.type = parseType(); return finishNode(result); } } function parseJSDocFunctionType() { if (lookAhead(nextTokenIsOpenParen)) { - var result = createNode(273); + var result = createNode(276); nextToken(); fillSignature(56, 4 | 32, result); return addJSDocComment(finishNode(result)); @@ -12001,9 +12051,9 @@ var ts; case 89: return parseJSDocFunctionType(); case 24: - return parseJSDocNodeWithType(274); + return parseJSDocNodeWithType(277); case 51: - return parseJSDocNodeWithType(271); + return parseJSDocNodeWithType(274); case 13: case 9: case 8: @@ -12085,13 +12135,13 @@ var ts; if (!(contextFlags & 1048576)) { return type; } - type = createJSDocPostfixType(272, type); + type = createJSDocPostfixType(275, type); break; case 51: - type = createJSDocPostfixType(271, type); + type = createJSDocPostfixType(274, type); break; case 55: - type = createJSDocPostfixType(270, type); + type = createJSDocPostfixType(273, type); break; case 21: parseExpected(21); @@ -12749,8 +12799,8 @@ var ts; node.operand = parseLeftHandSideExpressionOrHigher(); return finishNode(node); } - else if (sourceFile.languageVariant === 1 && token() === 27 && lookAhead(nextTokenIsIdentifierOrKeyword)) { - return parseJsxElementOrSelfClosingElement(true); + else if (sourceFile.languageVariant === 1 && token() === 27 && lookAhead(nextTokenIsIdentifierOrKeywordOrGreaterThan)) { + return parseJsxElementOrSelfClosingElementOrFragment(true); } var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); @@ -12802,25 +12852,32 @@ var ts; return lhs.name.escapedText === rhs.name.escapedText && tagNamesAreEquivalent(lhs.expression, rhs.expression); } - function parseJsxElementOrSelfClosingElement(inExpressionContext) { - var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); + function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext) { + var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); var result; if (opening.kind === 251) { var node = createNode(249, opening.pos); node.openingElement = opening; - node.children = parseJsxChildren(node.openingElement.tagName); + node.children = parseJsxChildren(node.openingElement); node.closingElement = parseJsxClosingElement(inExpressionContext); if (!tagNamesAreEquivalent(node.openingElement.tagName, node.closingElement.tagName)) { parseErrorAtPosition(node.closingElement.pos, node.closingElement.end - node.closingElement.pos, ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNodeFromSourceText(sourceText, node.openingElement.tagName)); } result = finishNode(node); } + else if (opening.kind === 254) { + var node = createNode(253, opening.pos); + node.openingFragment = opening; + node.children = parseJsxChildren(node.openingFragment); + node.closingFragment = parseJsxClosingFragment(inExpressionContext); + result = finishNode(node); + } else { ts.Debug.assert(opening.kind === 250); result = opening; } if (inExpressionContext && token() === 27) { - var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(true); }); + var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElementOrFragment(true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); var badNode = createNode(194, result.pos); @@ -12848,11 +12905,11 @@ var ts; case 17: return parseJsxExpression(false); case 27: - return parseJsxElementOrSelfClosingElement(false); + return parseJsxElementOrSelfClosingElementOrFragment(false); } ts.Debug.fail("Unknown JSX child kind " + token()); } - function parseJsxChildren(openingTagName) { + function parseJsxChildren(openingTag) { var list = []; var listPos = getNodePos(); var saveParsingContext = parsingContext; @@ -12863,7 +12920,13 @@ var ts; break; } else if (token() === 1) { - parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTagName)); + if (ts.isJsxOpeningFragment(openingTag)) { + parseErrorAtPosition(openingTag.pos, openingTag.end - openingTag.pos, ts.Diagnostics.JSX_fragment_has_no_corresponding_closing_tag); + } + else { + var openingTagName = openingTag.tagName; + parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTagName)); + } break; } else if (token() === 7) { @@ -12878,13 +12941,18 @@ var ts; return createNodeArray(list, listPos); } function parseJsxAttributes() { - var jsxAttributes = createNode(254); + var jsxAttributes = createNode(257); jsxAttributes.properties = parseList(13, parseJsxAttribute); return finishNode(jsxAttributes); } - function parseJsxOpeningOrSelfClosingElement(inExpressionContext) { + function parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext) { var fullStart = scanner.getStartPos(); parseExpected(27); + if (token() === 29) { + parseExpected(29); + var node_1 = createNode(254, fullStart); + return finishNode(node_1); + } var tagName = parseJsxElementName(); var attributes = parseJsxAttributes(); var node; @@ -12920,7 +12988,7 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(256); + var node = createNode(259); parseExpected(17); if (token() !== 18) { node.dotDotDotToken = parseOptionalToken(24); @@ -12940,7 +13008,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(253); + var node = createNode(256); node.name = parseIdentifierName(); if (token() === 58) { switch (scanJsxAttributeValue()) { @@ -12955,7 +13023,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(255); + var node = createNode(258); parseExpected(17); parseExpected(24); node.expression = parseExpression(); @@ -12975,6 +13043,22 @@ var ts; } return finishNode(node); } + function parseJsxClosingFragment(inExpressionContext) { + var node = createNode(255); + parseExpected(28); + if (ts.tokenIsIdentifierOrKeyword(token())) { + var unexpectedTagName = parseJsxElementName(); + parseErrorAtPosition(unexpectedTagName.pos, unexpectedTagName.end - unexpectedTagName.pos, ts.Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment); + } + if (inExpressionContext) { + parseExpected(29); + } + else { + parseExpected(29, undefined, false); + scanJsxText(); + } + return finishNode(node); + } function parseTypeAssertion() { var node = createNode(184); parseExpected(27); @@ -13180,7 +13264,7 @@ var ts; var fullStart = scanner.getStartPos(); var dotDotDotToken = parseOptionalToken(24); if (dotDotDotToken) { - var spreadElement = createNode(263, fullStart); + var spreadElement = createNode(266, fullStart); spreadElement.expression = parseAssignmentExpressionOrHigher(); return addJSDocComment(finishNode(spreadElement)); } @@ -13199,7 +13283,7 @@ var ts; } var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 26 || token() === 18 || token() === 58); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(262, fullStart); + var shorthandDeclaration = createNode(265, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(58); @@ -13210,7 +13294,7 @@ var ts; return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(261, fullStart); + var propertyAssignment = createNode(264, fullStart); propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; @@ -13259,10 +13343,10 @@ var ts; var fullStart = scanner.getStartPos(); parseExpected(94); if (parseOptional(23)) { - var node_1 = createNode(204, fullStart); - node_1.keywordToken = 94; - node_1.name = parseIdentifierName(); - return finishNode(node_1); + var node_2 = createNode(204, fullStart); + node_2.keywordToken = 94; + node_2.name = parseIdentifierName(); + return finishNode(node_2); } var node = createNode(182, fullStart); node.expression = parseMemberExpressionOrHigher(); @@ -13413,7 +13497,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(257); + var node = createNode(260); parseExpected(73); node.expression = allowInAnd(parseExpression); parseExpected(56); @@ -13421,7 +13505,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(258); + var node = createNode(261); parseExpected(79); parseExpected(56); node.statements = parseList(3, parseStatement); @@ -13462,7 +13546,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(260); + var result = createNode(263); parseExpected(74); if (parseOptional(19)) { result.variableDeclaration = parseVariableDeclaration(); @@ -14086,7 +14170,7 @@ var ts; function parseHeritageClause() { var tok = token(); if (tok === 85 || tok === 108) { - var node = createNode(259); + var node = createNode(262); node.token = tok; nextToken(); node.types = parseDelimitedList(7, parseExpressionWithTypeArguments); @@ -14135,7 +14219,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseEnumMember() { - var node = createNode(264, scanner.getStartPos()); + var node = createNode(267, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return addJSDocComment(finishNode(node)); @@ -14476,7 +14560,7 @@ var ts; } JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; function parseJSDocTypeExpression(requireBraces) { - var result = createNode(267, scanner.getTokenPos()); + var result = createNode(270, scanner.getTokenPos()); if (!parseExpected(17) && requireBraces) { return undefined; } @@ -14634,7 +14718,7 @@ var ts; content.charCodeAt(start + 3) !== 42; } function createJSDocComment() { - var result = createNode(275, start); + var result = createNode(278, start); result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd); result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -14751,7 +14835,7 @@ var ts; return comments; } function parseUnknownTag(atToken, tagName) { - var result = createNode(276, atToken.pos); + var result = createNode(279, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -14803,8 +14887,8 @@ var ts; typeExpression = tryParseTypeExpression(); } var result = target === 1 ? - createNode(279, atToken.pos) : - createNode(284, atToken.pos); + createNode(282, atToken.pos) : + createNode(287, atToken.pos); var nestedTypeLiteral = parseNestedTypeLiteral(typeExpression, name); if (nestedTypeLiteral) { typeExpression = nestedTypeLiteral; @@ -14820,7 +14904,7 @@ var ts; } function parseNestedTypeLiteral(typeExpression, name) { if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) { - var typeLiteralExpression = createNode(267, scanner.getTokenPos()); + var typeLiteralExpression = createNode(270, scanner.getTokenPos()); var child = void 0; var jsdocTypeLiteral = void 0; var start_2 = scanner.getStartPos(); @@ -14832,7 +14916,7 @@ var ts; children.push(child); } if (children) { - jsdocTypeLiteral = createNode(285, start_2); + jsdocTypeLiteral = createNode(288, start_2); jsdocTypeLiteral.jsDocPropertyTags = children; if (typeExpression.type.kind === 164) { jsdocTypeLiteral.isArrayType = true; @@ -14843,27 +14927,27 @@ var ts; } } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 280; })) { + if (ts.forEach(tags, function (t) { return t.kind === 283; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } - var result = createNode(280, atToken.pos); + var result = createNode(283, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 281; })) { + if (ts.forEach(tags, function (t) { return t.kind === 284; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } - var result = createNode(281, atToken.pos); + var result = createNode(284, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = parseJSDocTypeExpression(true); return finishNode(result); } function parseAugmentsTag(atToken, tagName) { - var result = createNode(277, atToken.pos); + var result = createNode(280, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.class = parseExpressionWithTypeArgumentsForAugments(); @@ -14891,7 +14975,7 @@ var ts; return node; } function parseClassTag(atToken, tagName) { - var tag = createNode(278, atToken.pos); + var tag = createNode(281, atToken.pos); tag.atToken = atToken; tag.tagName = tagName; return finishNode(tag); @@ -14899,7 +14983,7 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(283, atToken.pos); + var typedefTag = createNode(286, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(0); @@ -14922,9 +15006,9 @@ var ts; var start_3 = scanner.getStartPos(); while (child = tryParse(function () { return parseChildParameterOrPropertyTag(0); })) { if (!jsdocTypeLiteral) { - jsdocTypeLiteral = createNode(285, start_3); + jsdocTypeLiteral = createNode(288, start_3); } - if (child.kind === 281) { + if (child.kind === 284) { if (childTypeTag) { break; } @@ -14986,7 +15070,7 @@ var ts; case 57: if (canParseTag) { var child = tryParseChildTag(target); - if (child && child.kind === 279 && + if (child && child.kind === 282 && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; } @@ -15036,7 +15120,7 @@ var ts; return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 282; })) { + if (ts.forEach(tags, function (t) { return t.kind === 285; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } var typeParameters = []; @@ -15060,7 +15144,7 @@ var ts; break; } } - var result = createNode(282, atToken.pos); + var result = createNode(285, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = createNodeArray(typeParameters, typeParametersPos); @@ -15581,14 +15665,14 @@ var ts; case 228: case 229: return (ts.hasModifier(node, 512) ? "default" : undefined); - case 273: + case 276: return (ts.isJSDocConstructSignature(node) ? "__new" : "__call"); case 146: - ts.Debug.assert(node.parent.kind === 273); + ts.Debug.assert(node.parent.kind === 276); var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "arg" + index; - case 283: + case 286: var name_2 = ts.getNameOfJSDocTypedef(node); return typeof name_2 !== "undefined" ? name_2.escapedText : undefined; } @@ -15662,9 +15746,9 @@ var ts; } } else { - if (node.kind === 283) + if (node.kind === 286) ts.Debug.assert(ts.isInJavaScriptFile(node)); - var isJSDocTypedefInJSDocNamespace = node.kind === 283 && + var isJSDocTypedefInJSDocNamespace = node.kind === 286 && node.name && node.name.kind === 71 && node.name.isInJSDocNamespace; @@ -15723,7 +15807,7 @@ var ts; if (hasExplicitReturn) node.flags |= 256; } - if (node.kind === 265) { + if (node.kind === 268) { node.flags |= emitFlags; } if (isIIFE) { @@ -15843,7 +15927,7 @@ var ts; case 235: bindCaseBlock(node); break; - case 257: + case 260: bindCaseClause(node); break; case 222: @@ -15870,10 +15954,10 @@ var ts; case 181: bindCallExpressionFlow(node); break; - case 275: + case 278: bindJSDocComment(node); break; - case 283: + case 286: bindJSDocTypedefTag(node); break; default: @@ -16231,7 +16315,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 258; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 261; }); node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; if (!hasDefault) { addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0)); @@ -16327,13 +16411,13 @@ var ts; else if (node.kind === 178) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 261) { + if (p.kind === 264) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 262) { + else if (p.kind === 265) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 263) { + else if (p.kind === 266) { bindAssignmentTargetFlow(p.expression); } } @@ -16439,7 +16523,7 @@ var ts; } function bindJSDocComment(node) { ts.forEachChild(node, function (n) { - if (n.kind !== 283) { + if (n.kind !== 286) { bind(n); } }); @@ -16479,8 +16563,8 @@ var ts; case 232: case 178: case 163: - case 285: - case 254: + case 288: + case 257: return 1; case 230: return 1 | 64; @@ -16488,7 +16572,7 @@ var ts; case 231: case 172: return 1 | 32; - case 265: + case 268: return 1 | 4 | 32; case 151: if (ts.isObjectLiteralOrClassExpressionMethod(node)) { @@ -16500,7 +16584,7 @@ var ts; case 153: case 154: case 155: - case 273: + case 276: case 160: case 156: case 157: @@ -16513,7 +16597,7 @@ var ts; return 4; case 149: return node.initializer ? 4 : 0; - case 260: + case 263: case 214: case 215: case 216: @@ -16534,7 +16618,7 @@ var ts; switch (container.kind) { case 233: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 265: + case 268: return declareSourceFileMember(node, symbolFlags, symbolExcludes); case 199: case 229: @@ -16542,10 +16626,10 @@ var ts; case 232: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); case 163: - case 285: + case 288: case 178: case 230: - case 254: + case 257: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); case 160: case 161: @@ -16560,7 +16644,7 @@ var ts; case 228: case 186: case 187: - case 273: + case 276: case 231: case 172: return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); @@ -16577,8 +16661,8 @@ var ts; : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 265 ? node : node.body; - if (body && (body.kind === 265 || body.kind === 234)) { + var body = node.kind === 268 ? node : node.body; + if (body && (body.kind === 268 || body.kind === 234)) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; if (stat.kind === 244 || stat.kind === 243) { @@ -16659,11 +16743,11 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 263 || prop.name.kind !== 71) { + if (prop.kind === 266 || prop.name.kind !== 71) { continue; } var identifier = prop.name; - var currentKind = prop.kind === 261 || prop.kind === 262 || prop.kind === 151 + var currentKind = prop.kind === 264 || prop.kind === 265 || prop.kind === 151 ? 1 : 2; var existingKind = seen.get(identifier.escapedText); @@ -16697,7 +16781,7 @@ var ts; case 233: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 265: + case 268: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -16786,7 +16870,7 @@ var ts; } function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2) { - if (blockScopeContainer.kind !== 265 && + if (blockScopeContainer.kind !== 268 && blockScopeContainer.kind !== 233 && !ts.isFunctionLike(blockScopeContainer)) { var errorSpan = ts.getErrorSpanForNode(file, node); @@ -16857,7 +16941,7 @@ var ts; } for (var _b = 0, _c = jsDoc.tags; _b < _c.length; _b++) { var tag = _c[_b]; - if (tag.kind === 283) { + if (tag.kind === 286) { var savedParent = parent; parent = jsDoc; bind(tag); @@ -16889,14 +16973,14 @@ var ts; case 71: if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 283) { + while (parentNode && parentNode.kind !== 286) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288, 793064); break; } case 99: - if (currentFlow && (ts.isExpression(node) || parent.kind === 262)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 265)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); @@ -16929,7 +17013,7 @@ var ts; ts.Debug.fail("Unknown special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 260: + case 263: return checkStrictModeCatchClause(node); case 188: return checkStrictModeDeleteExpression(node); @@ -16958,10 +17042,10 @@ var ts; case 149: case 148: return bindPropertyWorker(node); - case 261: - case 262: - return bindPropertyOrMethodOrAccessor(node, 4, 0); case 264: + case 265: + return bindPropertyOrMethodOrAccessor(node, 4, 0); + case 267: return bindPropertyOrMethodOrAccessor(node, 8, 900095); case 155: case 156: @@ -16979,11 +17063,11 @@ var ts; case 154: return bindPropertyOrMethodOrAccessor(node, 65536, 74687); case 160: - case 273: + case 276: case 161: return bindFunctionOrConstructorType(node); case 163: - case 285: + case 288: case 172: return bindAnonymousTypeWorker(node); case 178: @@ -17008,9 +17092,9 @@ var ts; return bindEnumDeclaration(node); case 233: return bindModuleDeclaration(node); - case 254: + case 257: return bindJsxAttributes(node); - case 253: + case 256: return bindJsxAttribute(node, 4, 0); case 237: case 240: @@ -17025,7 +17109,7 @@ var ts; return bindExportDeclaration(node); case 243: return bindExportAssignment(node); - case 265: + case 268: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); case 207: @@ -17034,17 +17118,17 @@ var ts; } case 234: return updateStrictModeStatementList(node.statements); - case 279: - if (node.parent.kind !== 285) { + case 282: + if (node.parent.kind !== 288) { break; } - case 284: + case 287: var propTag = node; - var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 272 ? + var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 275 ? 4 | 16777216 : 4; return declareSymbolAndAddToSymbolTable(propTag, flags, 0); - case 283: { + case 286: { var fullName = node.fullName; if (!fullName || fullName.kind === 71) { return bindBlockScopedDeclaration(node, 524288, 793064); @@ -17093,7 +17177,7 @@ var ts; if (node.modifiers && node.modifiers.length) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); } - if (node.parent.kind !== 265) { + if (node.parent.kind !== 268) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); return; } @@ -17384,9 +17468,9 @@ var ts; return computeClassDeclaration(node, subtreeFlags); case 199: return computeClassExpression(node, subtreeFlags); - case 259: + case 262: return computeHeritageClause(node, subtreeFlags); - case 260: + case 263: return computeCatchClause(node, subtreeFlags); case 201: return computeExpressionWithTypeArguments(node, subtreeFlags); @@ -17794,7 +17878,7 @@ var ts; case 124: case 76: case 232: - case 264: + case 267: case 184: case 202: case 203: @@ -17810,6 +17894,9 @@ var ts; case 254: case 255: case 256: + case 257: + case 258: + case 259: transformFlags |= 4; break; case 13: @@ -17818,7 +17905,7 @@ var ts; case 16: case 196: case 183: - case 262: + case 265: case 115: case 204: transformFlags |= 192; @@ -17887,7 +17974,7 @@ var ts; case 198: transformFlags |= 192 | 524288; break; - case 263: + case 266: transformFlags |= 8 | 1048576; break; case 97: @@ -17943,7 +18030,7 @@ var ts; transformFlags |= 192; } break; - case 265: + case 268: if (subtreeFlags & 32768) { transformFlags |= 192; } @@ -18005,7 +18092,7 @@ var ts; return -3; case 178: return 540087617; - case 260: + case 263: return 537920833; case 174: case 175: @@ -19587,7 +19674,7 @@ var ts; return type.flags & 32768 ? type.objectFlags : 0; } function isGlobalSourceFile(node) { - return node.kind === 265 && !ts.isExternalOrCommonJsModule(node); + return node.kind === 268 && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -19711,7 +19798,7 @@ var ts; if (result = lookup(location.locals, name, meaning)) { var useResult = true; if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) { - if (meaning & result.flags & 793064 && lastLocation.kind !== 275) { + if (meaning & result.flags & 793064 && lastLocation.kind !== 278) { useResult = result.flags & 262144 ? lastLocation === location.type || lastLocation.kind === 146 || @@ -19734,13 +19821,13 @@ var ts; } } switch (location.kind) { - case 265: + case 268: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; case 233: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 265 || ts.isAmbientModule(location)) { + if (location.kind === 268 || ts.isAmbientModule(location)) { if (result = moduleExports.get("default")) { var localSymbol = ts.getLocalSymbolForExportDefault(result); if (localSymbol && (result.flags & meaning) && localSymbol.escapedName === name) { @@ -19862,7 +19949,7 @@ var ts; } if (!result) { if (lastLocation) { - ts.Debug.assert(lastLocation.kind === 265); + ts.Debug.assert(lastLocation.kind === 268); if (lastLocation.commonJsModuleIndicator && name === "exports") { return lastLocation.symbol; } @@ -20584,7 +20671,7 @@ var ts; } } switch (location.kind) { - case 265: + case 268: if (!ts.isExternalOrCommonJsModule(location)) { break; } @@ -20732,7 +20819,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 265 && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 268 && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -21018,7 +21105,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 265 || declaration.parent.kind === 234; + return declaration.parent.kind === 268 || declaration.parent.kind === 234; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return ts.contains(context.symbolStack, symbol); @@ -21705,7 +21792,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.some(symbol.declarations, function (declaration) { - return declaration.parent.kind === 265 || declaration.parent.kind === 234; + return declaration.parent.kind === 268 || declaration.parent.kind === 234; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 4) || @@ -22106,7 +22193,7 @@ var ts; } var parent = getDeclarationContainer(node); if (!(ts.getCombinedModifierFlags(node) & 1) && - !(node.kind !== 237 && parent.kind !== 265 && ts.isInAmbientContext(parent))) { + !(node.kind !== 237 && parent.kind !== 268 && ts.isInAmbientContext(parent))) { return isGlobalSourceFile(parent); } return isDeclarationVisible(parent); @@ -22140,7 +22227,7 @@ var ts; case 242: return false; case 145: - case 265: + case 268: case 236: return true; case 243: @@ -22434,7 +22521,7 @@ var ts; if (ts.isJsxAttribute(declaration)) { return trueType; } - if (declaration.kind === 262) { + if (declaration.kind === 265) { return checkIdentifier(declaration.name); } if (ts.isBindingPattern(declaration.name)) { @@ -22548,7 +22635,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - if (declaration.kind === 261) { + if (declaration.kind === 264) { return type; } return getWidenedType(type); @@ -22810,13 +22897,13 @@ var ts; case 150: case 160: case 161: - case 273: + case 276: case 228: case 151: case 186: case 187: case 231: - case 282: + case 285: case 172: var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); if (node.kind === 172) { @@ -23074,9 +23161,9 @@ var ts; return unknownType; } var declaration = ts.find(symbol.declarations, function (d) { - return d.kind === 283 || d.kind === 231; + return d.kind === 286 || d.kind === 231; }); - var typeNode = declaration.kind === 283 ? declaration.typeExpression : declaration.type; + var typeNode = declaration.kind === 286 ? declaration.typeExpression : declaration.type; var type = typeNode ? getTypeFromTypeNode(typeNode) : unknownType; if (popTypeResolution()) { var typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); @@ -24061,7 +24148,7 @@ var ts; } function isJSDocOptionalParameter(node) { if (ts.isInJavaScriptFile(node)) { - if (node.type && node.type.kind === 272) { + if (node.type && node.type.kind === 275) { return true; } var paramTags = ts.getJSDocParameterTags(node); @@ -24072,7 +24159,7 @@ var ts; return true; } if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 272; + return paramTag.typeExpression.type.kind === 275; } } } @@ -24284,7 +24371,7 @@ var ts; case 154: case 186: case 187: - case 273: + case 276: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -25478,8 +25565,8 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 119: - case 268: - case 269: + case 271: + case 272: return anyType; case 136: return stringType; @@ -25520,18 +25607,18 @@ var ts; return getTypeFromUnionTypeNode(node); case 167: return getTypeFromIntersectionTypeNode(node); - case 270: + case 273: return getTypeFromJSDocNullableTypeNode(node); case 168: - case 271: - case 272: - case 267: + case 274: + case 275: + case 270: return getTypeFromTypeNode(node.type); case 160: case 161: case 163: - case 285: - case 273: + case 288: + case 276: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 170: return getTypeFromTypeOperatorNode(node); @@ -25543,7 +25630,7 @@ var ts; case 143: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); - case 274: + case 277: return getTypeFromJSDocVariadicType(node); default: return unknownType; @@ -25804,15 +25891,15 @@ var ts; case 194: return node.operatorToken.kind === 54 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 261: + case 264: return isContextSensitive(node.initializer); case 185: return isContextSensitive(node.expression); - case 254: + case 257: return ts.forEach(node.properties, isContextSensitive); - case 253: - return node.initializer && isContextSensitive(node.initializer); case 256: + return node.initializer && isContextSensitive(node.initializer); + case 259: return node.expression && isContextSensitive(node.expression); } return false; @@ -28180,7 +28267,7 @@ var ts; } function getAssignedTypeOfBinaryExpression(node) { var isDestructuringDefaultAssignment = node.parent.kind === 177 && isDestructuringAssignmentTarget(node.parent) || - node.parent.kind === 261 && isDestructuringAssignmentTarget(node.parent.parent); + node.parent.kind === 264 && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); @@ -28216,9 +28303,9 @@ var ts; return getAssignedTypeOfArrayLiteralElement(parent, node); case 198: return getAssignedTypeOfSpreadExpression(parent); - case 261: + case 264: return getAssignedTypeOfPropertyAssignment(parent); - case 262: + case 265: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return unknownType; @@ -28287,7 +28374,7 @@ var ts; getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 257) { + if (clause.kind === 260) { var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } @@ -29002,7 +29089,7 @@ var ts; return ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || node.kind === 234 || - node.kind === 265 || + node.kind === 268 || node.kind === 149; }); } @@ -29179,7 +29266,7 @@ var ts; function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 || (symbol.flags & (2 | 32)) === 0 || - symbol.valueDeclaration.parent.kind === 260) { + symbol.valueDeclaration.parent.kind === 263) { return; } var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); @@ -29341,7 +29428,7 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 273) { + if (jsdocType && jsdocType.kind === 276) { var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && @@ -29460,7 +29547,7 @@ var ts; return (func.kind === 151 || func.kind === 153 || func.kind === 154) && func.parent.kind === 178 ? func.parent : - func.kind === 186 && func.parent.kind === 261 ? func.parent.parent : + func.kind === 186 && func.parent.kind === 264 ? func.parent.parent : undefined; } function getThisTypeArgument(type) { @@ -29496,7 +29583,7 @@ var ts; if (thisType) { return instantiateType(thisType, getContextualMapper(containingLiteral)); } - if (literal.parent.kind !== 261) { + if (literal.parent.kind !== 264) { break; } literal = literal.parent.parent; @@ -29741,7 +29828,12 @@ var ts; function getContextualTypeForJsxExpression(node) { var jsxAttributes = ts.isJsxAttributeLike(node.parent) ? node.parent.parent : - node.parent.openingElement.attributes; + ts.isJsxElement(node.parent) ? + node.parent.openingElement.attributes : + undefined; + if (!jsxAttributes) { + return undefined; + } var attributesType = getContextualType(jsxAttributes); if (!attributesType || isTypeAny(attributesType)) { return undefined; @@ -29801,10 +29893,10 @@ var ts; return getTypeFromTypeNode(parent.type); case 194: return getContextualTypeForBinaryOperand(node); - case 261: - case 262: + case 264: + case 265: return getContextualTypeForObjectLiteralElement(parent); - case 263: + case 266: return getApparentTypeOfContextualType(parent.parent); case 177: { var arrayLiteral = parent; @@ -29820,10 +29912,10 @@ var ts; var tag = ts.isInJavaScriptFile(parent) ? ts.getJSDocTypeTag(parent) : undefined; return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(parent); } - case 256: + case 259: return getContextualTypeForJsxExpression(parent); - case 253: - case 255: + case 256: + case 258: return getContextualTypeForJsxAttribute(parent); case 251: case 250: @@ -30040,15 +30132,15 @@ var ts; var memberDecl = node.properties[i]; var member = memberDecl.symbol; var literalName = void 0; - if (memberDecl.kind === 261 || - memberDecl.kind === 262 || + if (memberDecl.kind === 264 || + memberDecl.kind === 265 || ts.isObjectLiteralMethod(memberDecl)) { var jsdocType = void 0; if (isInJSFile) { jsdocType = getTypeForDeclarationFromJSDocComment(memberDecl); } var type = void 0; - if (memberDecl.kind === 261) { + if (memberDecl.kind === 264) { if (memberDecl.name.kind === 144) { var t = checkComputedPropertyName(memberDecl.name); if (t.flags & 224) { @@ -30061,7 +30153,7 @@ var ts; type = checkObjectLiteralMethod(memberDecl, checkMode); } else { - ts.Debug.assert(memberDecl.kind === 262); + ts.Debug.assert(memberDecl.kind === 265); type = checkExpressionForMutableLocation(memberDecl.name, checkMode); } if (jsdocType) { @@ -30071,8 +30163,8 @@ var ts; typeFlags |= type.flags; var prop = createSymbol(4 | member.flags, literalName || member.escapedName); if (inDestructuringPattern) { - var isOptional = (memberDecl.kind === 261 && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 262 && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 264 && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 265 && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 16777216; } @@ -30098,7 +30190,7 @@ var ts; prop.target = member; member = prop; } - else if (memberDecl.kind === 263) { + else if (memberDecl.kind === 266) { if (languageVersion < 2) { checkExternalEmitHelpers(memberDecl, 2); } @@ -30181,11 +30273,11 @@ var ts; type.flags & 196608 && !ts.forEach(type.types, function (t) { return !isValidSpreadType(t); })); } function checkJsxSelfClosingElement(node) { - checkJsxOpeningLikeElement(node); + checkJsxOpeningLikeElementOrOpeningFragment(node); return getJsxGlobalElementType() || anyType; } function checkJsxElement(node) { - checkJsxOpeningLikeElement(node.openingElement); + checkJsxOpeningLikeElementOrOpeningFragment(node.openingElement); if (isJsxIntrinsicIdentifier(node.closingElement.tagName)) { getIntrinsicTagSymbol(node.closingElement); } @@ -30194,6 +30286,13 @@ var ts; } return getJsxGlobalElementType() || anyType; } + function checkJsxFragment(node) { + checkJsxOpeningLikeElementOrOpeningFragment(node.openingFragment); + if (compilerOptions.jsx === 2 && compilerOptions.jsxFactory) { + error(node, ts.Diagnostics.JSX_fragment_is_not_supported_when_using_jsxFactory); + } + return getJsxGlobalElementType() || anyType; + } function isUnhyphenatedJsxName(name) { return !ts.stringContains(name, "-"); } @@ -30239,7 +30338,7 @@ var ts; } } else { - ts.Debug.assert(attributeDecl.kind === 255); + ts.Debug.assert(attributeDecl.kind === 258); if (attributesArray.length > 0) { spread = getSpreadType(spread, createJsxAttributesType(attributes.symbol, attributesTable), openingLikeElement.symbol, 0); attributesArray = []; @@ -30274,18 +30373,7 @@ var ts; } var parent = openingLikeElement.parent.kind === 249 ? openingLikeElement.parent : undefined; if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) { - var childrenTypes = []; - for (var _c = 0, _d = parent.children; _c < _d.length; _c++) { - var child = _d[_c]; - if (child.kind === 10) { - if (!child.containsOnlyWhiteSpaces) { - childrenTypes.push(stringType); - } - } - else { - childrenTypes.push(checkExpression(child, checkMode)); - } - } + var childrenTypes = checkJsxChildren(parent, checkMode); if (!hasSpreadAnyType && jsxChildrenPropertyName && jsxChildrenPropertyName !== "") { if (explicitlySpecifyChildrenAttribute) { error(attributes, ts.Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, ts.unescapeLeadingUnderscores(jsxChildrenPropertyName)); @@ -30310,6 +30398,21 @@ var ts; return result; } } + function checkJsxChildren(node, checkMode) { + var childrenTypes = []; + for (var _i = 0, _a = node.children; _i < _a.length; _i++) { + var child = _a[_i]; + if (child.kind === 10) { + if (!child.containsOnlyWhiteSpaces) { + childrenTypes.push(stringType); + } + } + else { + childrenTypes.push(checkExpression(child, checkMode)); + } + } + return childrenTypes; + } function checkJsxAttributes(node, checkMode) { return createJsxAttributesTypeFromAttributesProperty(node.parent, undefined, checkMode); } @@ -30646,19 +30749,28 @@ var ts; } } } - function checkJsxOpeningLikeElement(node) { - checkGrammarJsxElement(node); + function checkJsxOpeningLikeElementOrOpeningFragment(node) { + var isNodeOpeningLikeElement = ts.isJsxOpeningLikeElement(node); + if (isNodeOpeningLikeElement) { + checkGrammarJsxElement(node); + } checkJsxPreconditions(node); var reactRefErr = diagnostics && compilerOptions.jsx === 2 ? ts.Diagnostics.Cannot_find_name_0 : undefined; var reactNamespace = getJsxNamespace(); - var reactSym = resolveName(node.tagName, reactNamespace, 107455, reactRefErr, reactNamespace, true); + var reactLocation = isNodeOpeningLikeElement ? node.tagName : node; + var reactSym = resolveName(reactLocation, reactNamespace, 107455, reactRefErr, reactNamespace, true); if (reactSym) { reactSym.isReferenced = true; if (reactSym.flags & 2097152 && !isConstEnumOrConstEnumOnlyModule(resolveAlias(reactSym))) { markAliasSymbolAsReferenced(reactSym); } } - checkJsxAttributesAssignableToTagNameAttributes(node); + if (isNodeOpeningLikeElement) { + checkJsxAttributesAssignableToTagNameAttributes(node); + } + else { + checkJsxChildren(node.parent); + } } function isKnownProperty(targetType, name, isComparingJsxAttributes) { if (targetType.flags & 32768) { @@ -30869,7 +30981,7 @@ var ts; switch (node.kind) { case 149: return true; - case 261: + case 264: return false; default: return ts.isPartOfExpression(node) ? false : "quit"; @@ -32723,7 +32835,7 @@ var ts; return sourceType; } function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { - if (property.kind === 261 || property.kind === 262) { + if (property.kind === 264 || property.kind === 265) { var name = property.name; if (name.kind === 144) { checkComputedPropertyName(name); @@ -32738,7 +32850,7 @@ var ts; isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1) || getIndexTypeOfType(objectLiteralType, 0); if (type) { - if (property.kind === 262) { + if (property.kind === 265) { return checkDestructuringAssignment(property, type); } else { @@ -32749,7 +32861,7 @@ var ts; error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name)); } } - else if (property.kind === 263) { + else if (property.kind === 266) { if (languageVersion < 5) { checkExternalEmitHelpers(property, 4); } @@ -32820,7 +32932,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode) { var target; - if (exprOrAssignment.kind === 262) { + if (exprOrAssignment.kind === 265) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { if (strictNullChecks && @@ -32848,7 +32960,7 @@ var ts; } function checkReferenceAssignment(target, sourceType, checkMode) { var targetType = checkExpression(target, checkMode); - var error = target.parent.kind === 263 ? + var error = target.parent.kind === 266 ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; if (checkReferenceExpression(target, error)) { @@ -33359,13 +33471,15 @@ var ts; return undefinedWideningType; case 197: return checkYieldExpression(node); - case 256: + case 259: return checkJsxExpression(node, checkMode); case 249: return checkJsxElement(node); case 250: return checkJsxSelfClosingElement(node); - case 254: + case 253: + return checkJsxFragment(node); + case 257: return checkJsxAttributes(node, checkMode); case 251: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); @@ -34178,7 +34292,7 @@ var ts; switch (d.kind) { case 230: case 231: - case 283: + case 286: return 2; case 233: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 @@ -34506,7 +34620,7 @@ var ts; error(classLike, ts.Diagnostics.JSDoc_0_is_not_attached_to_a_class, ts.idText(node.tagName)); return; } - var augmentsTags = ts.getAllJSDocTagsOfKind(classLike, 277); + var augmentsTags = ts.getAllJSDocTagsOfKind(classLike, 280); ts.Debug.assert(augmentsTags.length > 0); if (augmentsTags.length > 1) { error(augmentsTags[1], ts.Diagnostics.Class_declarations_cannot_have_more_than_one_augments_or_extends_tag); @@ -34578,7 +34692,7 @@ var ts; for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) { var node = deferredUnusedIdentifierNodes_1[_i]; switch (node.kind) { - case 265: + case 268: case 233: checkUnusedModuleMembers(node); break; @@ -34838,7 +34952,7 @@ var ts; return; } var parent = getDeclarationContainer(node); - if (parent.kind === 265 && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 268 && ts.isExternalOrCommonJsModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -34850,7 +34964,7 @@ var ts; return; } var parent = getDeclarationContainer(node); - if (parent.kind === 265 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) { + if (parent.kind === 268 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -34878,7 +34992,7 @@ var ts; (container.kind === 207 && ts.isFunctionLike(container.parent) || container.kind === 234 || container.kind === 233 || - container.kind === 265); + container.kind === 268); if (!namesShareScope) { var name = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); @@ -35432,7 +35546,7 @@ var ts; var expressionType = checkExpression(node.expression); var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 258 && !hasDuplicateDefaultClause) { + if (clause.kind === 261 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -35444,7 +35558,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 257) { + if (produceDiagnostics && clause.kind === 260) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); var caseIsLiteral = isLiteralType(caseType); @@ -36042,7 +36156,7 @@ var ts; var declaration = memberSymbol.valueDeclaration; if (declaration !== member) { if (isBlockScopedNameDeclaredBeforeUse(declaration, member)) { - return getNodeLinks(declaration).enumMemberValue; + return getEnumMemberValue(declaration); } error(expr, ts.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums); return 0; @@ -36277,7 +36391,7 @@ var ts; return false; } var inAmbientExternalModule = node.parent.kind === 234 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 265 && !inAmbientExternalModule) { + if (node.parent.kind !== 268 && !inAmbientExternalModule) { error(moduleName, node.kind === 244 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); @@ -36386,7 +36500,7 @@ var ts; var inAmbientExternalModule = node.parent.kind === 234 && ts.isAmbientModule(node.parent.parent); var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 234 && !node.moduleSpecifier && ts.isInAmbientContext(node); - if (node.parent.kind !== 265 && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + if (node.parent.kind !== 268 && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -36402,7 +36516,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 265 || node.parent.kind === 234 || node.parent.kind === 233; + var isInAppropriateContext = node.parent.kind === 268 || node.parent.kind === 234 || node.parent.kind === 233; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -36425,7 +36539,7 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) { return; } - var container = node.parent.kind === 265 ? node.parent : node.parent.parent; + var container = node.parent.kind === 268 ? node.parent : node.parent.parent; if (container.kind === 233 && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); @@ -36564,24 +36678,24 @@ var ts; case 168: case 170: return checkSourceElement(node.type); - case 277: + case 280: return checkJSDocAugmentsTag(node); - case 283: + case 286: return checkJSDocTypedefTag(node); - case 279: + case 282: return checkJSDocParameterTag(node); - case 273: + case 276: checkSignatureDeclaration(node); + case 277: case 274: + case 273: case 271: - case 270: - case 268: - case 269: + case 272: if (!ts.isInJavaScriptFile(node) && !ts.isInJSDoc(node)) { grammarErrorOnNode(node, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); } return; - case 267: + case 270: return checkSourceElement(node.type); case 171: return checkIndexedAccessType(node); @@ -36943,10 +37057,10 @@ var ts; return entityNameSymbol; } } - if (entityName.parent.kind === 279) { + if (entityName.parent.kind === 282) { return ts.getParameterSymbolFromJSDoc(entityName.parent); } - if (entityName.parent.kind === 145 && entityName.parent.parent.kind === 282) { + if (entityName.parent.kind === 145 && entityName.parent.parent.kind === 285) { ts.Debug.assert(!ts.isInJavaScriptFile(entityName)); var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent); return typeParameter && typeParameter.symbol; @@ -36979,7 +37093,7 @@ var ts; var meaning = entityName.parent.kind === 159 ? 793064 : 1920; return resolveEntityName(entityName, meaning, false, true); } - else if (entityName.parent.kind === 253) { + else if (entityName.parent.kind === 256) { return getJsxAttributePropertySymbol(entityName.parent); } if (entityName.parent.kind === 158) { @@ -36988,7 +37102,7 @@ var ts; return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 265) { + if (node.kind === 268) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } if (isInsideWithStatementBody(node)) { @@ -37060,7 +37174,7 @@ var ts; } } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 262) { + if (location && location.kind === 265) { return resolveEntityName(location.name, 107455 | 2097152); } return undefined; @@ -37128,7 +37242,7 @@ var ts; var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } - if (expr.parent.kind === 261) { + if (expr.parent.kind === 264) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); } @@ -37243,7 +37357,7 @@ var ts; } var parentSymbol_1 = getParentOfSymbol(symbol); if (parentSymbol_1) { - if (parentSymbol_1.flags & 512 && parentSymbol_1.valueDeclaration.kind === 265) { + if (parentSymbol_1.flags & 512 && parentSymbol_1.valueDeclaration.kind === 268) { var symbolFile = parentSymbol_1.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); var symbolIsUmdExport = symbolFile !== referenceFile; @@ -37332,7 +37446,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(node) { node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 265 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 268 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); @@ -37391,7 +37505,7 @@ var ts; } function canHaveConstantValue(node) { switch (node.kind) { - case 264: + case 267: case 179: case 180: return true; @@ -37399,7 +37513,7 @@ var ts; return false; } function getConstantValue(node) { - if (node.kind === 264) { + if (node.kind === 267) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -37635,7 +37749,7 @@ var ts; break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 265 && current.flags & 512) { + if (current.valueDeclaration && current.valueDeclaration.kind === 268 && current.flags & 512) { return false; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { @@ -37654,7 +37768,7 @@ var ts; if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 265); + return ts.getDeclarationOfKind(moduleSymbol, 268); } function initializeTypeChecker() { for (var _i = 0, _a = host.getSourceFiles(); _i < _a.length; _i++) { @@ -37816,7 +37930,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 234 || node.parent.kind === 265) { + else if (node.parent.kind === 234 || node.parent.kind === 268) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128) { @@ -37839,7 +37953,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 234 || node.parent.kind === 265) { + else if (node.parent.kind === 234 || node.parent.kind === 268) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } else if (node.kind === 146) { @@ -37883,7 +37997,7 @@ var ts; flags |= 1; break; case 79: - var container = node.parent.kind === 265 ? node.parent : node.parent.parent; + var container = node.parent.kind === 268 ? node.parent : node.parent.parent; if (container.kind === 233 && !ts.isAmbientModule(container)) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } @@ -38001,7 +38115,7 @@ var ts; case 146: return false; default: - if (node.parent.kind === 234 || node.parent.kind === 265) { + if (node.parent.kind === 234 || node.parent.kind === 268) { return false; } switch (node.kind) { @@ -38259,14 +38373,14 @@ var ts; var GetOrSetAccessor = GetAccessor | SetAccessor; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 263) { + if (prop.kind === 266) { continue; } var name = prop.name; if (name.kind === 144) { checkGrammarComputedPropertyName(name); } - if (prop.kind === 262 && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 265 && !inDestructuring && prop.objectAssignmentInitializer) { return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); } if (prop.modifiers) { @@ -38278,7 +38392,7 @@ var ts; } } var currentKind = void 0; - if (prop.kind === 261 || prop.kind === 262) { + if (prop.kind === 264 || prop.kind === 265) { checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name.kind === 8) { checkGrammarNumericLiteral(name); @@ -38327,7 +38441,7 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 255) { + if (attr.kind === 258) { continue; } var jsxAttr = attr; @@ -38339,7 +38453,7 @@ var ts; return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 256 && !initializer.expression) { + if (initializer && initializer.kind === 259 && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -38731,7 +38845,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 207 || node.parent.kind === 234 || node.parent.kind === 265) { + if (node.parent.kind === 207 || node.parent.kind === 234 || node.parent.kind === 268) { var links_1 = getNodeLinks(node.parent); if (!links_1.hasReportedStatementInAmbientContext) { return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -38750,7 +38864,7 @@ var ts; else if (ts.isChildOfNodeWithKind(node, 173)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 264)) { + else if (ts.isChildOfNodeWithKind(node, 267)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -40621,8 +40735,24 @@ var ts; : node; } ts.updateJsxClosingElement = updateJsxClosingElement; - function createJsxAttribute(name, initializer) { + function createJsxFragment(openingFragment, children, closingFragment) { var node = createSynthesizedNode(253); + node.openingFragment = openingFragment; + node.children = createNodeArray(children); + node.closingFragment = closingFragment; + return node; + } + ts.createJsxFragment = createJsxFragment; + function updateJsxFragment(node, openingFragment, children, closingFragment) { + return node.openingFragment !== openingFragment + || node.children !== children + || node.closingFragment !== closingFragment + ? updateNode(createJsxFragment(openingFragment, children, closingFragment), node) + : node; + } + ts.updateJsxFragment = updateJsxFragment; + function createJsxAttribute(name, initializer) { + var node = createSynthesizedNode(256); node.name = name; node.initializer = initializer; return node; @@ -40636,7 +40766,7 @@ var ts; } ts.updateJsxAttribute = updateJsxAttribute; function createJsxAttributes(properties) { - var node = createSynthesizedNode(254); + var node = createSynthesizedNode(257); node.properties = createNodeArray(properties); return node; } @@ -40648,7 +40778,7 @@ var ts; } ts.updateJsxAttributes = updateJsxAttributes; function createJsxSpreadAttribute(expression) { - var node = createSynthesizedNode(255); + var node = createSynthesizedNode(258); node.expression = expression; return node; } @@ -40660,7 +40790,7 @@ var ts; } ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; function createJsxExpression(dotDotDotToken, expression) { - var node = createSynthesizedNode(256); + var node = createSynthesizedNode(259); node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; @@ -40673,7 +40803,7 @@ var ts; } ts.updateJsxExpression = updateJsxExpression; function createCaseClause(expression, statements) { - var node = createSynthesizedNode(257); + var node = createSynthesizedNode(260); node.expression = ts.parenthesizeExpressionForList(expression); node.statements = createNodeArray(statements); return node; @@ -40687,7 +40817,7 @@ var ts; } ts.updateCaseClause = updateCaseClause; function createDefaultClause(statements) { - var node = createSynthesizedNode(258); + var node = createSynthesizedNode(261); node.statements = createNodeArray(statements); return node; } @@ -40699,7 +40829,7 @@ var ts; } ts.updateDefaultClause = updateDefaultClause; function createHeritageClause(token, types) { - var node = createSynthesizedNode(259); + var node = createSynthesizedNode(262); node.token = token; node.types = createNodeArray(types); return node; @@ -40712,7 +40842,7 @@ var ts; } ts.updateHeritageClause = updateHeritageClause; function createCatchClause(variableDeclaration, block) { - var node = createSynthesizedNode(260); + var node = createSynthesizedNode(263); node.variableDeclaration = ts.isString(variableDeclaration) ? createVariableDeclaration(variableDeclaration) : variableDeclaration; node.block = block; return node; @@ -40726,7 +40856,7 @@ var ts; } ts.updateCatchClause = updateCatchClause; function createPropertyAssignment(name, initializer) { - var node = createSynthesizedNode(261); + var node = createSynthesizedNode(264); node.name = asName(name); node.questionToken = undefined; node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined; @@ -40741,7 +40871,7 @@ var ts; } ts.updatePropertyAssignment = updatePropertyAssignment; function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - var node = createSynthesizedNode(262); + var node = createSynthesizedNode(265); node.name = asName(name); node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? ts.parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; @@ -40755,7 +40885,7 @@ var ts; } ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment; function createSpreadAssignment(expression) { - var node = createSynthesizedNode(263); + var node = createSynthesizedNode(266); node.expression = expression !== undefined ? ts.parenthesizeExpressionForList(expression) : undefined; return node; } @@ -40767,7 +40897,7 @@ var ts; } ts.updateSpreadAssignment = updateSpreadAssignment; function createEnumMember(name, initializer) { - var node = createSynthesizedNode(264); + var node = createSynthesizedNode(267); node.name = asName(name); node.initializer = initializer && ts.parenthesizeExpressionForList(initializer); return node; @@ -40782,7 +40912,7 @@ var ts; ts.updateEnumMember = updateEnumMember; function updateSourceFileNode(node, statements) { if (node.statements !== statements) { - var updated = createSynthesizedNode(265); + var updated = createSynthesizedNode(268); updated.flags |= node.flags; updated.statements = createNodeArray(statements); updated.endOfFileToken = node.endOfFileToken; @@ -40851,28 +40981,28 @@ var ts; } ts.getMutableClone = getMutableClone; function createNotEmittedStatement(original) { - var node = createSynthesizedNode(287); + var node = createSynthesizedNode(290); node.original = original; setTextRange(node, original); return node; } ts.createNotEmittedStatement = createNotEmittedStatement; function createEndOfDeclarationMarker(original) { - var node = createSynthesizedNode(291); + var node = createSynthesizedNode(294); node.emitNode = {}; node.original = original; return node; } ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker; function createMergeDeclarationMarker(original) { - var node = createSynthesizedNode(290); + var node = createSynthesizedNode(293); node.emitNode = {}; node.original = original; return node; } ts.createMergeDeclarationMarker = createMergeDeclarationMarker; function createPartiallyEmittedExpression(expression, original) { - var node = createSynthesizedNode(288); + var node = createSynthesizedNode(291); node.expression = expression; node.original = original; setTextRange(node, original); @@ -40888,7 +41018,7 @@ var ts; ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; function flattenCommaElements(node) { if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) { - if (node.kind === 289) { + if (node.kind === 292) { return node.elements; } if (ts.isBinaryExpression(node) && node.operatorToken.kind === 26) { @@ -40898,7 +41028,7 @@ var ts; return node; } function createCommaList(elements) { - var node = createSynthesizedNode(289); + var node = createSynthesizedNode(292); node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)); return node; } @@ -40910,7 +41040,7 @@ var ts; } ts.updateCommaList = updateCommaList; function createBundle(sourceFiles) { - var node = ts.createNode(266); + var node = ts.createNode(269); node.sourceFiles = sourceFiles; return node; } @@ -41013,7 +41143,7 @@ var ts; function getOrCreateEmitNode(node) { if (!node.emitNode) { if (ts.isParseTreeNode(node)) { - if (node.kind === 265) { + if (node.kind === 268) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = ts.getSourceFileOfNode(node); @@ -41341,6 +41471,25 @@ var ts; return ts.setTextRange(ts.createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement), undefined, argumentsList), location); } ts.createExpressionForJsxElement = createExpressionForJsxElement; + function createExpressionForJsxFragment(jsxFactoryEntity, reactNamespace, children, parentElement, location) { + var tagName = ts.createPropertyAccess(createReactNamespace(reactNamespace, parentElement), "Fragment"); + var argumentsList = [tagName]; + argumentsList.push(ts.createNull()); + if (children && children.length > 0) { + if (children.length > 1) { + for (var _i = 0, children_2 = children; _i < children_2.length; _i++) { + var child = children_2[_i]; + child.startsOnNewLine = true; + argumentsList.push(child); + } + } + else { + argumentsList.push(children[0]); + } + } + return ts.setTextRange(ts.createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement), undefined, argumentsList), location); + } + ts.createExpressionForJsxFragment = createExpressionForJsxFragment; function getHelperName(name) { return ts.setEmitFlags(ts.createIdentifier(name), 4096 | 2); } @@ -41521,9 +41670,9 @@ var ts; case 153: case 154: return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); - case 261: + case 264: return createExpressionForPropertyAssignment(property, receiver); - case 262: + case 265: return createExpressionForShorthandPropertyAssignment(property, receiver); case 151: return createExpressionForMethodDeclaration(property, receiver); @@ -41946,7 +42095,7 @@ var ts; case 179: node = node.expression; continue; - case 288: + case 291: node = node.expression; continue; } @@ -41969,7 +42118,7 @@ var ts; case 202: case 203: return (kinds & 2) !== 0; - case 288: + case 291: return (kinds & 4) !== 0; } return false; @@ -42013,7 +42162,7 @@ var ts; case 184: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression); case 202: return ts.updateAsExpression(outerExpression, expression, outerExpression.type); case 203: return ts.updateNonNullExpression(outerExpression, expression); - case 288: return ts.updatePartiallyEmittedExpression(outerExpression, expression); + case 291: return ts.updatePartiallyEmittedExpression(outerExpression, expression); } } function isIgnorableParen(node) { @@ -42145,11 +42294,11 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 261: + case 264: return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 262: + case 265: return bindingElement.name; - case 263: + case 266: return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } return undefined; @@ -42169,7 +42318,7 @@ var ts; case 176: return bindingElement.dotDotDotToken; case 198: - case 263: + case 266: return bindingElement; } return undefined; @@ -42185,7 +42334,7 @@ var ts; : propertyName; } break; - case 261: + case 264: if (bindingElement.name) { var propertyName = bindingElement.name; return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) @@ -42193,7 +42342,7 @@ var ts; : propertyName; } break; - case 263: + case 266: return bindingElement.name; } var target = getTargetOfBindingOrAssignmentElement(bindingElement); @@ -42605,34 +42754,36 @@ var ts; case 252: return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); case 253: - return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 254: - return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); - case 255: - return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateJsxFragment(node, visitNode(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingFragment, visitor, ts.isJsxClosingFragment)); case 256: - return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); case 257: - return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); + return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); case 258: - return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); case 259: - return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); + return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); case 260: - return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); + return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); case 261: - return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); + return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); case 262: - return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); + return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); case 263: - return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); case 264: - return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); + return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); case 265: + return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); + case 266: + return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); + case 267: + return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); + case 268: return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); - case 288: + case 291: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); - case 289: + case 292: return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression)); default: return node; @@ -42670,7 +42821,7 @@ var ts; case 209: case 200: case 225: - case 287: + case 290: break; case 143: result = reduceNode(node.left, cbNode, result); @@ -42977,61 +43128,66 @@ var ts; result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingElement, cbNode, result); break; + case 253: + result = reduceNode(node.openingFragment, cbNode, result); + result = ts.reduceLeft(node.children, cbNode, result); + result = reduceNode(node.closingFragment, cbNode, result); + break; case 250: case 251: result = reduceNode(node.tagName, cbNode, result); result = reduceNode(node.attributes, cbNode, result); break; - case 254: + case 257: result = reduceNodes(node.properties, cbNodes, result); break; case 252: result = reduceNode(node.tagName, cbNode, result); break; - case 253: + case 256: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 255: - result = reduceNode(node.expression, cbNode, result); - break; - case 256: - result = reduceNode(node.expression, cbNode, result); - break; - case 257: - result = reduceNode(node.expression, cbNode, result); case 258: - result = reduceNodes(node.statements, cbNodes, result); + result = reduceNode(node.expression, cbNode, result); break; case 259: - result = reduceNodes(node.types, cbNodes, result); + result = reduceNode(node.expression, cbNode, result); break; case 260: - result = reduceNode(node.variableDeclaration, cbNode, result); - result = reduceNode(node.block, cbNode, result); - break; + result = reduceNode(node.expression, cbNode, result); case 261: - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.initializer, cbNode, result); + result = reduceNodes(node.statements, cbNodes, result); break; case 262: - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.objectAssignmentInitializer, cbNode, result); + result = reduceNodes(node.types, cbNodes, result); break; case 263: - result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.variableDeclaration, cbNode, result); + result = reduceNode(node.block, cbNode, result); break; case 264: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; case 265: - result = reduceNodes(node.statements, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; - case 288: + case 266: result = reduceNode(node.expression, cbNode, result); break; - case 289: + case 267: + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + case 268: + result = reduceNodes(node.statements, cbNodes, result); + break; + case 291: + result = reduceNode(node.expression, cbNode, result); + break; + case 292: result = reduceNodes(node.elements, cbNodes, result); break; default: @@ -43675,7 +43831,7 @@ var ts; } function onBeforeVisitNode(node) { switch (node.kind) { - case 265: + case 268: case 235: case 234: case 207: @@ -43841,7 +43997,7 @@ var ts; return visitClassDeclaration(node); case 199: return visitClassExpression(node); - case 259: + case 262: return visitHeritageClause(node); case 201: return visitExpressionWithTypeArguments(node); @@ -44862,7 +45018,7 @@ var ts; function addVarForEnumOrModuleDeclaration(statements, node) { var statement = ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ ts.createVariableDeclaration(ts.getLocalName(node, false, true)) - ], currentScope.kind === 265 ? 0 : 1)); + ], currentScope.kind === 268 ? 0 : 1)); ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { @@ -45112,7 +45268,7 @@ var ts; if ((enabledSubstitutions & 2) === 0) { enabledSubstitutions |= 2; context.enableSubstitution(71); - context.enableSubstitution(262); + context.enableSubstitution(265); context.enableEmitNotification(233); } } @@ -45198,7 +45354,7 @@ var ts; function trySubstituteNamespaceExportedName(node) { if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var container = resolver.getReferencedExportContainer(node, false); - if (container && container.kind !== 265) { + if (container && container.kind !== 268) { var substitute = (applicableSubstitutions & 2 && container.kind === 233) || (applicableSubstitutions & 8 && container.kind === 232); if (substitute) { @@ -45601,7 +45757,7 @@ var ts; return visitExpressionStatement(node); case 185: return visitParenthesizedExpression(node, noDestructuringValue); - case 260: + case 263: return visitCatchClause(node); default: return ts.visitEachChild(node, visitor, context); @@ -45635,7 +45791,7 @@ var ts; var objects = []; for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { var e = elements_3[_i]; - if (e.kind === 263) { + if (e.kind === 266) { if (chunkObject) { objects.push(ts.createObjectLiteral(chunkObject)); chunkObject = undefined; @@ -45647,7 +45803,7 @@ var ts; if (!chunkObject) { chunkObject = []; } - if (e.kind === 261) { + if (e.kind === 264) { var p = e; chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); } @@ -46083,7 +46239,9 @@ var ts; return visitJsxElement(node, false); case 250: return visitJsxSelfClosingElement(node, false); - case 256: + case 253: + return visitJsxFragment(node, false); + case 259: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -46093,12 +46251,14 @@ var ts; switch (node.kind) { case 10: return visitJsxText(node); - case 256: + case 259: return visitJsxExpression(node); case 249: return visitJsxElement(node, true); case 250: return visitJsxSelfClosingElement(node, true); + case 253: + return visitJsxFragment(node, true); default: ts.Debug.failBadSyntaxKind(node); return undefined; @@ -46110,6 +46270,9 @@ var ts; function visitJsxSelfClosingElement(node, isChild) { return visitJsxOpeningLikeElement(node, undefined, isChild, node); } + function visitJsxFragment(node, isChild) { + return visitJsxOpeningFragment(node.openingFragment, node.children, isChild, node); + } function visitJsxOpeningLikeElement(node, children, isChild, location) { var tagName = getTagName(node); var objectProperties; @@ -46135,6 +46298,13 @@ var ts; } return element; } + function visitJsxOpeningFragment(node, children, isChild, location) { + var element = ts.createExpressionForJsxFragment(context.getEmitResolver().getJsxFactoryEntity(), compilerOptions.reactNamespace, ts.mapDefined(children, transformJsxChildToExpression), node, location); + if (isChild) { + ts.startOnNewLine(element); + } + return element; + } function transformJsxSpreadAttributeToExpression(node) { return ts.visitNode(node.expression, visitor, ts.isExpression); } @@ -46151,7 +46321,7 @@ var ts; var decoded = tryDecodeEntities(node.text); return decoded ? ts.setTextRange(ts.createLiteral(decoded), node) : node; } - else if (node.kind === 256) { + else if (node.kind === 259) { if (node.expression === undefined) { return ts.createTrue(); } @@ -46677,9 +46847,9 @@ var ts; return visitExpressionStatement(node); case 178: return visitObjectLiteralExpression(node); - case 260: + case 263: return visitCatchClause(node); - case 262: + case 265: return visitShorthandPropertyAssignment(node); case 144: return visitComputedPropertyName(node); @@ -47982,10 +48152,10 @@ var ts; case 151: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 261: + case 264: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 262: + case 265: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -48492,7 +48662,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; context.enableSubstitution(179); - context.enableSubstitution(261); + context.enableSubstitution(264); return transformSourceFile; function transformSourceFile(node) { return node; @@ -49371,7 +49541,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 258 && defaultClauseIndex === -1) { + if (clause.kind === 261 && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -49381,7 +49551,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 257) { + if (clause.kind === 260) { var caseClause = clause; if (containsYield(caseClause.expression) && pendingClauses.length > 0) { break; @@ -50201,8 +50371,8 @@ var ts; context.enableSubstitution(194); context.enableSubstitution(192); context.enableSubstitution(193); - context.enableSubstitution(262); - context.enableEmitNotification(265); + context.enableSubstitution(265); + context.enableEmitNotification(268); var moduleInfoMap = []; var deferredExports = []; var currentSourceFile; @@ -50383,9 +50553,9 @@ var ts; return visitFunctionDeclaration(node); case 229: return visitClassDeclaration(node); - case 290: + case 293: return visitMergeDeclarationMarker(node); - case 291: + case 294: return visitEndOfDeclarationMarker(node); default: return ts.visitEachChild(node, importCallExpressionVisitor, context); @@ -50794,7 +50964,7 @@ var ts; return node; } function onEmitNode(hint, node, emitCallback) { - if (node.kind === 265) { + if (node.kind === 268) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; noSubstitution = []; @@ -50854,7 +51024,7 @@ var ts; } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 265) { + if (exportContainer && exportContainer.kind === 268) { return ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node)), node); } var importDeclaration = resolver.getReferencedImportDeclaration(node); @@ -50954,7 +51124,7 @@ var ts; context.enableSubstitution(194); context.enableSubstitution(192); context.enableSubstitution(193); - context.enableEmitNotification(265); + context.enableEmitNotification(268); var moduleInfoMap = []; var deferredExports = []; var exportFunctionsMap = []; @@ -51290,7 +51460,7 @@ var ts; } function shouldHoistVariableDeclarationList(node) { return (ts.getEmitFlags(node) & 2097152) === 0 - && (enclosingBlockScopedContainer.kind === 265 + && (enclosingBlockScopedContainer.kind === 268 || (ts.getOriginalNode(node).flags & 3) === 0); } function transformInitializedVariable(node, isExportedDeclaration) { @@ -51472,19 +51642,19 @@ var ts; return visitSwitchStatement(node); case 235: return visitCaseBlock(node); - case 257: + case 260: return visitCaseClause(node); - case 258: + case 261: return visitDefaultClause(node); case 224: return visitTryStatement(node); - case 260: + case 263: return visitCatchClause(node); case 207: return visitBlock(node); - case 290: + case 293: return visitMergeDeclarationMarker(node); - case 291: + case 294: return visitEndOfDeclarationMarker(node); default: return destructuringAndImportCallVisitor(node); @@ -51624,7 +51794,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 265; + return container !== undefined && container.kind === 268; } else { return false; @@ -51639,7 +51809,7 @@ var ts; return node; } function onEmitNode(hint, node, emitCallback) { - if (node.kind === 265) { + if (node.kind === 268) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -51751,7 +51921,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, false); - if (exportContainer && exportContainer.kind === 265) { + if (exportContainer && exportContainer.kind === 268) { exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -51779,7 +51949,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(265); + context.enableEmitNotification(268); context.enableSubstitution(71); var currentSourceFile; return transformSourceFile; @@ -51888,7 +52058,7 @@ var ts; } ts.getTransformers = getTransformers; function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) { - var enabledSyntaxKindFeatures = new Array(292); + var enabledSyntaxKindFeatures = new Array(295); var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentVariableDeclarationsStack = []; @@ -52148,7 +52318,7 @@ var ts; } if (compilerOptions.mapRoot) { sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); - if (sourceFileOrBundle.kind === 265) { + if (sourceFileOrBundle.kind === 268) { sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFileOrBundle, host, sourceMapDir)); } if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { @@ -52255,7 +52425,7 @@ var ts; source = undefined; if (source) setSourceFile(source); - if (node.kind !== 287 + if (node.kind !== 290 && (emitFlags & 16) === 0 && pos >= 0) { emitPos(skipSourceTrivia(pos)); @@ -52272,7 +52442,7 @@ var ts; } if (source) setSourceFile(source); - if (node.kind !== 287 + if (node.kind !== 290 && (emitFlags & 32) === 0 && end >= 0) { emitPos(end); @@ -52414,7 +52584,7 @@ var ts; if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 287; + var isEmittedNode = node.kind !== 290; var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0 || node.kind === 10; var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0 || node.kind === 10; if (!skipLeadingComments) { @@ -52708,8 +52878,8 @@ var ts; } ts.getDeclarationDiagnostics = getDeclarationDiagnostics; function emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFileOrBundle, emitOnlyDtsFiles) { - var sourceFiles = sourceFileOrBundle.kind === 266 ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; - var isBundledEmit = sourceFileOrBundle.kind === 266; + var sourceFiles = sourceFileOrBundle.kind === 269 ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; + var isBundledEmit = sourceFileOrBundle.kind === 269; var newLine = host.getNewLine(); var compilerOptions = host.getCompilerOptions(); var write; @@ -53219,9 +53389,9 @@ var ts; writeModuleElement(node); } else if (node.kind === 237 || - (node.parent.kind === 265 && isCurrentFileExternalModule)) { + (node.parent.kind === 268 && isCurrentFileExternalModule)) { var isVisible = void 0; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 265) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 268) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -53271,7 +53441,7 @@ var ts; } } function emitModuleElementDeclarationFlags(node) { - if (node.parent.kind === 265) { + if (node.parent.kind === 268) { var modifiers = ts.getModifierFlags(node); if (modifiers & 1) { write("export "); @@ -54211,11 +54381,11 @@ var ts; case 149: case 148: return emitPropertyDeclaration(node); - case 264: + case 267: return emitEnumMemberDeclaration(node); case 243: return emitExportAssignment(node); - case 265: + case 268: return emitSourceFile(node); } } @@ -54234,7 +54404,7 @@ var ts; } return addedBundledEmitReference; function getDeclFileName(emitFileNames, sourceFileOrBundle) { - var isBundledEmit = sourceFileOrBundle.kind === 266; + var isBundledEmit = sourceFileOrBundle.kind === 269; if (isBundledEmit && !addBundledFileReference) { return; } @@ -54248,7 +54418,7 @@ var ts; var emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFileOrBundle, emitOnlyDtsFiles); var emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath) || host.getCompilerOptions().noEmit; if (!emitSkipped) { - var sourceFiles = sourceFileOrBundle.kind === 266 ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; + var sourceFiles = sourceFileOrBundle.kind === 269 ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; var declarationOutput = emitDeclarationResult.referencesOutput + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo); ts.writeFile(host, emitterDiagnostics, declarationFilePath, declarationOutput, host.getCompilerOptions().emitBOM, sourceFiles); @@ -54313,7 +54483,7 @@ var ts; return ".js"; } function getOriginalSourceFileOrBundle(sourceFileOrBundle) { - if (sourceFileOrBundle.kind === 266) { + if (sourceFileOrBundle.kind === 269) { return ts.updateBundle(sourceFileOrBundle, ts.sameMap(sourceFileOrBundle.sourceFiles, ts.getOriginalSourceFile)); } return ts.getOriginalSourceFile(sourceFileOrBundle); @@ -54379,8 +54549,8 @@ var ts; } } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle) { - var bundle = sourceFileOrBundle.kind === 266 ? sourceFileOrBundle : undefined; - var sourceFile = sourceFileOrBundle.kind === 265 ? sourceFileOrBundle : undefined; + var bundle = sourceFileOrBundle.kind === 269 ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 268 ? sourceFileOrBundle : undefined; var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFileOrBundle); if (bundle) { @@ -54416,7 +54586,7 @@ var ts; } function emitHelpers(node, writeLines) { var helpersEmitted = false; - var bundle = node.kind === 266 ? node : undefined; + var bundle = node.kind === 269 ? node : undefined; if (bundle && moduleKind === ts.ModuleKind.None) { return; } @@ -54489,8 +54659,8 @@ var ts; break; } switch (node.kind) { - case 265: return printFile(node); - case 266: return printBundle(node); + case 268: return printFile(node); + case 269: return printBundle(node); } writeNode(hint, node, sourceFile, beginPrint()); return endPrint(); @@ -54675,7 +54845,7 @@ var ts; return emitTypeReference(node); case 160: return emitFunctionType(node); - case 273: + case 276: return emitJSDocFunctionType(node); case 161: return emitConstructorType(node); @@ -54705,19 +54875,19 @@ var ts; return emitMappedType(node); case 173: return emitLiteralType(node); - case 268: + case 271: write("*"); return; - case 269: + case 272: write("?"); return; - case 270: + case 273: return emitJSDocNullableType(node); - case 271: - return emitJSDocNonNullableType(node); - case 272: - return emitJSDocOptionalType(node); case 274: + return emitJSDocNonNullableType(node); + case 275: + return emitJSDocOptionalType(node); + case 277: return emitJSDocVariadicType(node); case 174: return emitObjectBindingPattern(node); @@ -54816,32 +54986,34 @@ var ts; case 10: return emitJsxText(node); case 251: - return emitJsxOpeningElement(node); - case 252: - return emitJsxClosingElement(node); - case 253: - return emitJsxAttribute(node); case 254: - return emitJsxAttributes(node); + return emitJsxOpeningElementOrFragment(node); + case 252: case 255: - return emitJsxSpreadAttribute(node); + return emitJsxClosingElementOrFragment(node); case 256: - return emitJsxExpression(node); + return emitJsxAttribute(node); case 257: - return emitCaseClause(node); + return emitJsxAttributes(node); case 258: - return emitDefaultClause(node); + return emitJsxSpreadAttribute(node); case 259: - return emitHeritageClause(node); + return emitJsxExpression(node); case 260: - return emitCatchClause(node); + return emitCaseClause(node); case 261: - return emitPropertyAssignment(node); + return emitDefaultClause(node); case 262: - return emitShorthandPropertyAssignment(node); + return emitHeritageClause(node); case 263: - return emitSpreadAssignment(node); + return emitCatchClause(node); case 264: + return emitPropertyAssignment(node); + case 265: + return emitShorthandPropertyAssignment(node); + case 266: + return emitSpreadAssignment(node); + case 267: return emitEnumMember(node); } if (ts.isExpression(node)) { @@ -54929,9 +55101,11 @@ var ts; return emitJsxElement(node); case 250: return emitJsxSelfClosingElement(node); - case 288: + case 253: + return emitJsxFragment(node); + case 291: return emitPartiallyEmittedExpression(node); - case 289: + case 292: return emitCommaList(node); } } @@ -54991,7 +55165,7 @@ var ts; emit(node.name); } emitIfPresent(node.questionToken); - if (node.parent && node.parent.kind === 273 && !node.name) { + if (node.parent && node.parent.kind === 276 && !node.name) { emit(node.type); } else { @@ -55913,21 +56087,30 @@ var ts; } write("/>"); } - function emitJsxOpeningElement(node) { + function emitJsxFragment(node) { + emit(node.openingFragment); + emitList(node, node.children, 131072); + emit(node.closingFragment); + } + function emitJsxOpeningElementOrFragment(node) { write("<"); - emitJsxTagName(node.tagName); - writeIfAny(node.attributes.properties, " "); - if (node.attributes.properties && node.attributes.properties.length > 0) { - emit(node.attributes); + if (ts.isJsxOpeningElement(node)) { + emitJsxTagName(node.tagName); + if (node.attributes.properties && node.attributes.properties.length > 0) { + write(" "); + emit(node.attributes); + } } write(">"); } function emitJsxText(node) { writer.writeLiteral(getTextOfNode(node, true)); } - function emitJsxClosingElement(node) { + function emitJsxClosingElementOrFragment(node) { write(""); } function emitJsxAttributes(node) { @@ -56307,11 +56490,6 @@ var ts; function decreaseIndent() { writer.decreaseIndent(); } - function writeIfAny(nodes, text) { - if (ts.some(nodes)) { - write(text); - } - } function writeToken(token, pos, contextNode) { return onEmitSourceMapOfToken ? onEmitSourceMapOfToken(contextNode, token, pos, writeTokenText) @@ -56683,6 +56861,12 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { + var ConfigFileProgramReloadLevel; + (function (ConfigFileProgramReloadLevel) { + ConfigFileProgramReloadLevel[ConfigFileProgramReloadLevel["None"] = 0] = "None"; + ConfigFileProgramReloadLevel[ConfigFileProgramReloadLevel["Partial"] = 1] = "Partial"; + ConfigFileProgramReloadLevel[ConfigFileProgramReloadLevel["Full"] = 2] = "Full"; + })(ConfigFileProgramReloadLevel = ts.ConfigFileProgramReloadLevel || (ts.ConfigFileProgramReloadLevel = {})); function updateMissingFilePathsWatch(program, missingFileWatches, createMissingFileWatch) { var missingFilePaths = program.getMissingFilePaths(); var newMissingFilePathMap = ts.arrayToSet(missingFilePaths); @@ -58085,7 +58269,7 @@ var ts; return; } break; - case 259: + case 262: var heritageClause = node; if (heritageClause.token === 108) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); @@ -59499,7 +59683,7 @@ var ts; ts.createWatchModeWithoutConfigFile = createWatchModeWithoutConfigFile; function createWatchMode(rootFileNames, compilerOptions, watchingHost, configFileName, configFileSpecs, configFileWildCardDirectories, optionsToExtendForConfigFile) { var program; - var needsReload; + var reloadLevel; var missingFilesMap; var watchedWildcardDirectories; var timerToUpdateProgram; @@ -59703,22 +59887,32 @@ var ts; } function scheduleProgramReload() { ts.Debug.assert(!!configFileName); - needsReload = true; + reloadLevel = ts.ConfigFileProgramReloadLevel.Full; scheduleProgramUpdate(); } function updateProgram() { timerToUpdateProgram = undefined; reportWatchDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation)); - if (needsReload) { - reloadConfigFile(); + switch (reloadLevel) { + case ts.ConfigFileProgramReloadLevel.Partial: + return reloadFileNamesFromConfigFile(); + case ts.ConfigFileProgramReloadLevel.Full: + return reloadConfigFile(); + default: + return synchronizeProgram(); } - else { - synchronizeProgram(); + } + function reloadFileNamesFromConfigFile() { + var result = ts.getFileNamesFromConfigSpecs(configFileSpecs, ts.getDirectoryPath(configFileName), compilerOptions, directoryStructureHost); + if (!configFileSpecs.filesSpecs && result.fileNames.length === 0) { + reportDiagnostic(ts.getErrorForNoInputFiles(configFileSpecs, configFileName)); } + rootFileNames = result.fileNames; + synchronizeProgram(); } function reloadConfigFile() { writeLog("Reloading config file: " + configFileName); - needsReload = false; + reloadLevel = ts.ConfigFileProgramReloadLevel.None; var cachedHost = directoryStructureHost; cachedHost.clearCache(); var configParseResult = parseConfigFile(configFileName, optionsToExtendForConfigFile, cachedHost, reportDiagnostic, reportWatchDiagnostic); @@ -59787,16 +59981,12 @@ var ts; else { removeSourceFile(fileOrDirectoryPath); } - if (fileOrDirectoryPath !== directory && !ts.isSupportedSourceFileName(fileOrDirectory, compilerOptions)) { + if (fileOrDirectoryPath !== directory && ts.hasExtension(fileOrDirectoryPath) && !ts.isSupportedSourceFileName(fileOrDirectory, compilerOptions)) { writeLog("Project: " + configFileName + " Detected file add/remove of non supported extension: " + fileOrDirectory); return; } - if (!needsReload) { - var result_6 = ts.getFileNamesFromConfigSpecs(configFileSpecs, ts.getDirectoryPath(configFileName), compilerOptions, directoryStructureHost); - if (!configFileSpecs.filesSpecs && result_6.fileNames.length === 0) { - reportDiagnostic(ts.getErrorForNoInputFiles(configFileSpecs, configFileName)); - } - rootFileNames = result_6.fileNames; + if (reloadLevel !== ts.ConfigFileProgramReloadLevel.Full) { + reloadLevel = ts.ConfigFileProgramReloadLevel.Partial; scheduleProgramUpdate(); } }, flags); @@ -60731,7 +60921,7 @@ var ts; var result = {}; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 261) { + if (element.kind !== 264) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); continue; } diff --git a/lib/tsserver.js b/lib/tsserver.js index adc8cf18790..43515961797 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -289,46 +289,49 @@ var ts; SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 250] = "JsxSelfClosingElement"; SyntaxKind[SyntaxKind["JsxOpeningElement"] = 251] = "JsxOpeningElement"; SyntaxKind[SyntaxKind["JsxClosingElement"] = 252] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 253] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxAttributes"] = 254] = "JsxAttributes"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 255] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 256] = "JsxExpression"; - SyntaxKind[SyntaxKind["CaseClause"] = 257] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 258] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 259] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 260] = "CatchClause"; - SyntaxKind[SyntaxKind["PropertyAssignment"] = 261] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 262] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 263] = "SpreadAssignment"; - SyntaxKind[SyntaxKind["EnumMember"] = 264] = "EnumMember"; - SyntaxKind[SyntaxKind["SourceFile"] = 265] = "SourceFile"; - SyntaxKind[SyntaxKind["Bundle"] = 266] = "Bundle"; - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 267] = "JSDocTypeExpression"; - SyntaxKind[SyntaxKind["JSDocAllType"] = 268] = "JSDocAllType"; - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 269] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 270] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 271] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 272] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 273] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 274] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocComment"] = 275] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocTag"] = 276] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 277] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocClassTag"] = 278] = "JSDocClassTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 279] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 280] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 281] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 282] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 283] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 284] = "JSDocPropertyTag"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 285] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["SyntaxList"] = 286] = "SyntaxList"; - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 287] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 288] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["CommaListExpression"] = 289] = "CommaListExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 290] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 291] = "EndOfDeclarationMarker"; - SyntaxKind[SyntaxKind["Count"] = 292] = "Count"; + SyntaxKind[SyntaxKind["JsxFragment"] = 253] = "JsxFragment"; + SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 254] = "JsxOpeningFragment"; + SyntaxKind[SyntaxKind["JsxClosingFragment"] = 255] = "JsxClosingFragment"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 256] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxAttributes"] = 257] = "JsxAttributes"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 258] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 259] = "JsxExpression"; + SyntaxKind[SyntaxKind["CaseClause"] = 260] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 261] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 262] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 263] = "CatchClause"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 264] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 265] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 266] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["EnumMember"] = 267] = "EnumMember"; + SyntaxKind[SyntaxKind["SourceFile"] = 268] = "SourceFile"; + SyntaxKind[SyntaxKind["Bundle"] = 269] = "Bundle"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 270] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 271] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 272] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 273] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 274] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 275] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 276] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 277] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 278] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTag"] = 279] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 280] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocClassTag"] = 281] = "JSDocClassTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 282] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 283] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 284] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 285] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 286] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 287] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 288] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["SyntaxList"] = 289] = "SyntaxList"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 290] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 291] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["CommaListExpression"] = 292] = "CommaListExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 293] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 294] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["Count"] = 295] = "Count"; SyntaxKind[SyntaxKind["FirstAssignment"] = 58] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 70] = "LastAssignment"; SyntaxKind[SyntaxKind["FirstCompoundAssignment"] = 59] = "FirstCompoundAssignment"; @@ -354,10 +357,12 @@ var ts; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 27] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 70] = "LastBinaryOperator"; SyntaxKind[SyntaxKind["FirstNode"] = 143] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 267] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 285] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 276] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 285] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 270] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 288] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 279] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 288] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 117] = "FirstContextualKeyword"; + SyntaxKind[SyntaxKind["LastContextualKeyword"] = 142] = "LastContextualKeyword"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); var NodeFlags; (function (NodeFlags) { @@ -2189,6 +2194,10 @@ var ts; return Array.isArray ? Array.isArray(value) : value instanceof Array; } ts.isArray = isArray; + function toArray(value) { + return isArray(value) ? value : [value]; + } + ts.toArray = toArray; function isString(text) { return typeof text === "string"; } @@ -3104,6 +3113,11 @@ var ts; return (removeFileExtension(path) + newExtension); } ts.changeExtension = changeExtension; + function removeMinAndVersionNumbers(fileName) { + var trailingMinOrVersion = /[.-]((min)|(\d+(\.\d+)*))$/; + return fileName.replace(trailingMinOrVersion, "").replace(trailingMinOrVersion, ""); + } + ts.removeMinAndVersionNumbers = removeMinAndVersionNumbers; function Symbol(flags, name) { this.flags = flags; this.escapedName = name; @@ -3479,9 +3493,7 @@ var ts; function addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath) { var existingResult = getCachedFileSystemEntries(fileOrDirectoryPath); if (existingResult) { - if (!host.directoryExists(fileOrDirectory)) { - cachedReadDirectoryResult.delete(fileOrDirectoryPath); - } + clearCache(); } else { var parentResult = getCachedFileSystemEntriesForBaseDir(fileOrDirectoryPath); @@ -3492,8 +3504,12 @@ var ts; fileExists: host.fileExists(fileOrDirectoryPath), directoryExists: host.directoryExists(fileOrDirectoryPath) }; - updateFilesOfFileSystemEntry(parentResult, baseName, fsQueryResult.fileExists); - updateFileSystemEntry(parentResult.directories, baseName, fsQueryResult.directoryExists); + if (fsQueryResult.directoryExists || hasEntry(parentResult.directories, baseName)) { + clearCache(); + } + else { + updateFilesOfFileSystemEntry(parentResult, baseName, fsQueryResult.fileExists); + } return fsQueryResult; } } @@ -4853,6 +4869,9 @@ var ts; super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: diag(17011, ts.DiagnosticCategory.Error, "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", "'super' must be called before accessing a property of 'super' in the constructor of a derived class."), _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2: diag(17012, ts.DiagnosticCategory.Error, "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012", "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'?"), Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: diag(17013, ts.DiagnosticCategory.Error, "Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013", "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor."), + JSX_fragment_has_no_corresponding_closing_tag: diag(17014, ts.DiagnosticCategory.Error, "JSX_fragment_has_no_corresponding_closing_tag_17014", "JSX fragment has no corresponding closing tag."), + Expected_corresponding_closing_tag_for_JSX_fragment: diag(17015, ts.DiagnosticCategory.Error, "Expected_corresponding_closing_tag_for_JSX_fragment_17015", "Expected corresponding closing tag for JSX fragment."), + JSX_fragment_is_not_supported_when_using_jsxFactory: diag(17016, ts.DiagnosticCategory.Error, "JSX_fragment_is_not_supported_when_using_jsxFactory_17016", "JSX fragment is not supported when using --jsxFactory"), Circularity_detected_while_resolving_configuration_Colon_0: diag(18000, ts.DiagnosticCategory.Error, "Circularity_detected_while_resolving_configuration_Colon_0_18000", "Circularity detected while resolving configuration: {0}"), A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: diag(18001, ts.DiagnosticCategory.Error, "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", "A path in an 'extends' option must be relative or rooted, but '{0}' is not."), The_files_list_in_config_file_0_is_empty: diag(18002, ts.DiagnosticCategory.Error, "The_files_list_in_config_file_0_is_empty_18002", "The 'files' list in config file '{0}' is empty."), @@ -5844,7 +5863,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 265) { + while (node && node.kind !== 268) { node = node.parent; } return node; @@ -5932,7 +5951,7 @@ var ts; if (includeJsDoc && ts.hasJSDocNodes(node)) { return getTokenPosOfNode(node.jsDoc[0]); } - if (node.kind === 286 && node._children.length > 0) { + if (node.kind === 289 && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); @@ -6031,7 +6050,7 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 226 && node.parent.kind === 260; + return node.kind === 226 && node.parent.kind === 263; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { @@ -6055,7 +6074,7 @@ var ts; return node && node.kind === 233 && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 265 || + return node.kind === 268 || node.kind === 233 || ts.isFunctionLike(node); } @@ -6069,7 +6088,7 @@ var ts; return false; } switch (node.parent.kind) { - case 265: + case 268: return ts.isExternalModule(node.parent); case 234: return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); @@ -6083,9 +6102,9 @@ var ts; ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { - case 265: + case 268: case 235: - case 260: + case 263: case 233: case 214: case 215: @@ -6112,12 +6131,12 @@ var ts; case 157: case 160: case 161: - case 273: + case 276: case 229: case 199: case 230: case 231: - case 282: + case 285: case 228: case 151: case 152: @@ -6230,7 +6249,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 265: + case 268: var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); if (pos_1 === sourceFile.text.length) { return ts.createTextSpan(0, 0); @@ -6243,7 +6262,7 @@ var ts; case 230: case 233: case 232: - case 264: + case 267: case 228: case 186: case 151: @@ -6413,11 +6432,11 @@ var ts; case 216: case 220: case 221: - case 257: - case 258: + case 260: + case 261: case 222: case 224: - case 260: + case 263: return ts.forEachChild(node, traverse); } } @@ -6472,12 +6491,12 @@ var ts; if (node) { switch (node.kind) { case 176: - case 264: + case 267: case 146: - case 261: + case 264: case 149: case 148: - case 262: + case 265: case 226: return true; } @@ -6535,7 +6554,7 @@ var ts; ts.isThisTypePredicate = isThisTypePredicate; function getPropertyAssignment(objectLiteral, key, key2) { return ts.filter(objectLiteral.properties, function (property) { - if (property.kind === 261) { + if (property.kind === 264) { var propName = getTextOfPropertyName(property.name); return key === propName || (key2 && key2 === propName); } @@ -6589,7 +6608,7 @@ var ts; case 156: case 157: case 232: - case 265: + case 268: return node; } } @@ -6773,6 +6792,7 @@ var ts; case 200: case 249: case 250: + case 253: case 197: case 191: case 204: @@ -6802,8 +6822,8 @@ var ts; case 146: case 149: case 148: + case 267: case 264: - case 261: case 176: return parent.initializer === node; case 210: @@ -6813,7 +6833,7 @@ var ts; case 219: case 220: case 221: - case 257: + case 260: case 223: return parent.expression === node; case 214: @@ -6834,9 +6854,9 @@ var ts; case 144: return node === parent.expression; case 147: - case 256: - case 255: - case 263: + case 259: + case 258: + case 266: return true; case 201: return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent); @@ -7002,8 +7022,8 @@ var ts; case 146: case 151: case 150: - case 262: - case 261: + case 265: + case 264: case 149: case 148: return node.questionToken !== undefined; @@ -7013,7 +7033,7 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 273 && + return node.kind === 276 && node.parameters.length > 0 && node.parameters[0].name && node.parameters[0].name.escapedText === "new"; @@ -7060,7 +7080,7 @@ var ts; return result || ts.emptyArray; function getJSDocCommentsAndTagsWorker(node) { var parent = node.parent; - if (parent && (parent.kind === 261 || getNestedModuleDeclaration(parent))) { + if (parent && (parent.kind === 264 || getNestedModuleDeclaration(parent))) { getJSDocCommentsAndTagsWorker(parent); } if (parent && parent.parent && @@ -7103,7 +7123,7 @@ var ts; } ts.getParameterSymbolFromJSDoc = getParameterSymbolFromJSDoc; function getJSDocHost(node) { - ts.Debug.assert(node.parent.kind === 275); + ts.Debug.assert(node.parent.kind === 278); return node.parent.parent; } ts.getJSDocHost = getJSDocHost; @@ -7149,13 +7169,13 @@ var ts; case 198: node = parent; break; - case 262: + case 265: if (parent.name !== node) { return 0; } node = parent.parent; break; - case 261: + case 264: if (parent.name === node) { return 0; } @@ -7194,7 +7214,7 @@ var ts; ts.isNodeDescendantOf = isNodeDescendantOf; function isInAmbientContext(node) { while (node) { - if (hasModifier(node, 2) || (node.kind === 265 && node.isDeclarationFile)) { + if (hasModifier(node, 2) || (node.kind === 268 && node.isDeclarationFile)) { return true; } node = node.parent; @@ -7243,8 +7263,8 @@ var ts; case 150: case 153: case 154: + case 267: case 264: - case 261: case 179: return parent.name === node; case 143: @@ -7259,7 +7279,7 @@ var ts; case 242: return parent.propertyName === node; case 246: - case 253: + case 256: return true; } return false; @@ -7359,6 +7379,14 @@ var ts; return 72 <= token && token <= 142; } ts.isKeyword = isKeyword; + function isContextualKeyword(token) { + return 117 <= token && token <= 142; + } + ts.isContextualKeyword = isContextualKeyword; + function isNonContextualKeyword(token) { + return isKeyword(token) && !isContextualKeyword(token); + } + ts.isNonContextualKeyword = isNonContextualKeyword; function isTrivia(token) { return 2 <= token && token <= 7; } @@ -7508,7 +7536,7 @@ var ts; || kind === 153 || kind === 154 || kind === 233 - || kind === 265; + || kind === 268; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(range) { @@ -7600,6 +7628,7 @@ var ts; case 199: case 249: case 250: + case 253: case 12: case 13: case 196: @@ -7686,7 +7715,7 @@ var ts; return 2; case 198: return 1; - case 289: + case 292: return 0; default: return -1; @@ -9074,8 +9103,8 @@ var ts; return undefined; } switch (declaration.kind) { - case 284: - case 279: { + case 287: + case 282: { var name = declaration.name; if (name.kind === 143) { return name.right; @@ -9094,7 +9123,7 @@ var ts; return undefined; } } - case 283: + case 286: return getNameOfJSDocTypedef(declaration); case 243: { var expression = declaration.expression; @@ -9113,27 +9142,27 @@ var ts; } ts.getJSDocParameterTags = getJSDocParameterTags; function hasJSDocParameterTags(node) { - return !!getFirstJSDocTag(node, 279); + return !!getFirstJSDocTag(node, 282); } ts.hasJSDocParameterTags = hasJSDocParameterTags; function getJSDocAugmentsTag(node) { - return getFirstJSDocTag(node, 277); + return getFirstJSDocTag(node, 280); } ts.getJSDocAugmentsTag = getJSDocAugmentsTag; function getJSDocClassTag(node) { - return getFirstJSDocTag(node, 278); + return getFirstJSDocTag(node, 281); } ts.getJSDocClassTag = getJSDocClassTag; function getJSDocReturnTag(node) { - return getFirstJSDocTag(node, 280); + return getFirstJSDocTag(node, 283); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getFirstJSDocTag(node, 282); + return getFirstJSDocTag(node, 285); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function getJSDocTypeTag(node) { - var tag = getFirstJSDocTag(node, 281); + var tag = getFirstJSDocTag(node, 284); if (tag && tag.typeExpression && tag.typeExpression.type) { return tag; } @@ -9141,7 +9170,7 @@ var ts; } ts.getJSDocTypeTag = getJSDocTypeTag; function getJSDocType(node) { - var tag = getFirstJSDocTag(node, 281); + var tag = getFirstJSDocTag(node, 284); if (!tag && node.kind === 146) { var paramTags = getJSDocParameterTags(node); if (paramTags) { @@ -9384,7 +9413,7 @@ var ts; } ts.isParenthesizedExpression = isParenthesizedExpression; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 288) { + while (node.kind === 291) { node = node.expression; } return node; @@ -9658,138 +9687,150 @@ var ts; return node.kind === 252; } ts.isJsxClosingElement = isJsxClosingElement; - function isJsxAttribute(node) { + function isJsxFragment(node) { return node.kind === 253; } + ts.isJsxFragment = isJsxFragment; + function isJsxOpeningFragment(node) { + return node.kind === 254; + } + ts.isJsxOpeningFragment = isJsxOpeningFragment; + function isJsxClosingFragment(node) { + return node.kind === 255; + } + ts.isJsxClosingFragment = isJsxClosingFragment; + function isJsxAttribute(node) { + return node.kind === 256; + } ts.isJsxAttribute = isJsxAttribute; function isJsxAttributes(node) { - return node.kind === 254; + return node.kind === 257; } ts.isJsxAttributes = isJsxAttributes; function isJsxSpreadAttribute(node) { - return node.kind === 255; + return node.kind === 258; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxExpression(node) { - return node.kind === 256; + return node.kind === 259; } ts.isJsxExpression = isJsxExpression; function isCaseClause(node) { - return node.kind === 257; + return node.kind === 260; } ts.isCaseClause = isCaseClause; function isDefaultClause(node) { - return node.kind === 258; + return node.kind === 261; } ts.isDefaultClause = isDefaultClause; function isHeritageClause(node) { - return node.kind === 259; + return node.kind === 262; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 260; + return node.kind === 263; } ts.isCatchClause = isCatchClause; function isPropertyAssignment(node) { - return node.kind === 261; + return node.kind === 264; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 262; + return node.kind === 265; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isSpreadAssignment(node) { - return node.kind === 263; + return node.kind === 266; } ts.isSpreadAssignment = isSpreadAssignment; function isEnumMember(node) { - return node.kind === 264; + return node.kind === 267; } ts.isEnumMember = isEnumMember; function isSourceFile(node) { - return node.kind === 265; + return node.kind === 268; } ts.isSourceFile = isSourceFile; function isBundle(node) { - return node.kind === 266; + return node.kind === 269; } ts.isBundle = isBundle; function isJSDocTypeExpression(node) { - return node.kind === 267; + return node.kind === 270; } ts.isJSDocTypeExpression = isJSDocTypeExpression; function isJSDocAllType(node) { - return node.kind === 268; + return node.kind === 271; } ts.isJSDocAllType = isJSDocAllType; function isJSDocUnknownType(node) { - return node.kind === 269; + return node.kind === 272; } ts.isJSDocUnknownType = isJSDocUnknownType; function isJSDocNullableType(node) { - return node.kind === 270; + return node.kind === 273; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 271; + return node.kind === 274; } ts.isJSDocNonNullableType = isJSDocNonNullableType; function isJSDocOptionalType(node) { - return node.kind === 272; + return node.kind === 275; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 273; + return node.kind === 276; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 274; + return node.kind === 277; } ts.isJSDocVariadicType = isJSDocVariadicType; function isJSDoc(node) { - return node.kind === 275; + return node.kind === 278; } ts.isJSDoc = isJSDoc; function isJSDocAugmentsTag(node) { - return node.kind === 277; + return node.kind === 280; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocParameterTag(node) { - return node.kind === 279; + return node.kind === 282; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 280; + return node.kind === 283; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocTypeTag(node) { - return node.kind === 281; + return node.kind === 284; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 282; + return node.kind === 285; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 283; + return node.kind === 286; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocPropertyTag(node) { - return node.kind === 284; + return node.kind === 287; } ts.isJSDocPropertyTag = isJSDocPropertyTag; function isJSDocPropertyLikeTag(node) { - return node.kind === 284 || node.kind === 279; + return node.kind === 287 || node.kind === 282; } ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; function isJSDocTypeLiteral(node) { - return node.kind === 285; + return node.kind === 288; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; })(ts || (ts = {})); (function (ts) { function isSyntaxList(n) { - return n.kind === 286; + return n.kind === 289; } ts.isSyntaxList = isSyntaxList; function isNode(node) { @@ -9915,7 +9956,7 @@ var ts; case 156: case 157: case 160: - case 273: + case 276: case 161: return true; default: @@ -9959,9 +10000,9 @@ var ts; ts.isTypeElement = isTypeElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 261 - || kind === 262 - || kind === 263 + return kind === 264 + || kind === 265 + || kind === 266 || kind === 151 || kind === 153 || kind === 154 @@ -9982,13 +10023,13 @@ var ts; || kind === 95 || kind === 130 || kind === 201 - || kind === 268 - || kind === 269 - || kind === 270 || kind === 271 || kind === 272 || kind === 273 - || kind === 274; + || kind === 274 + || kind === 275 + || kind === 276 + || kind === 277; } function isTypeNode(node) { return isTypeNodeKind(node.kind); @@ -10099,6 +10140,7 @@ var ts; case 181: case 249: case 250: + case 253: case 183: case 177: case 185: @@ -10167,8 +10209,8 @@ var ts; case 198: case 202: case 200: - case 289: - case 288: + case 292: + case 291: return true; default: return isUnaryExpressionKind(kind); @@ -10181,11 +10223,11 @@ var ts; } ts.isAssertionExpression = isAssertionExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 288; + return node.kind === 291; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isNotEmittedStatement(node) { - return node.kind === 287; + return node.kind === 290; } ts.isNotEmittedStatement = isNotEmittedStatement; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -10261,7 +10303,7 @@ var ts; || kind === 199 || kind === 152 || kind === 232 - || kind === 264 + || kind === 267 || kind === 246 || kind === 228 || kind === 186 @@ -10270,22 +10312,22 @@ var ts; || kind === 237 || kind === 242 || kind === 230 - || kind === 253 + || kind === 256 || kind === 151 || kind === 150 || kind === 233 || kind === 236 || kind === 240 || kind === 146 - || kind === 261 + || kind === 264 || kind === 149 || kind === 148 || kind === 154 - || kind === 262 + || kind === 265 || kind === 231 || kind === 145 || kind === 226 - || kind === 283; + || kind === 286; } function isDeclarationStatementKind(kind) { return kind === 228 @@ -10320,13 +10362,13 @@ var ts; || kind === 208 || kind === 213 || kind === 220 - || kind === 287 - || kind === 291 - || kind === 290; + || kind === 290 + || kind === 294 + || kind === 293; } function isDeclaration(node) { if (node.kind === 145) { - return node.parent.kind !== 282 || ts.isInJavaScriptFile(node); + return node.parent.kind !== 285 || ts.isInJavaScriptFile(node); } return isDeclarationKind(node.kind); } @@ -10350,7 +10392,7 @@ var ts; if (node.kind !== 207) return false; if (node.parent !== undefined) { - if (node.parent.kind === 224 || node.parent.kind === 260) { + if (node.parent.kind === 224 || node.parent.kind === 263) { return false; } } @@ -10373,21 +10415,22 @@ var ts; function isJsxChild(node) { var kind = node.kind; return kind === 249 - || kind === 256 + || kind === 259 || kind === 250 - || kind === 10; + || kind === 10 + || kind === 253; } ts.isJsxChild = isJsxChild; function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 253 - || kind === 255; + return kind === 256 + || kind === 258; } ts.isJsxAttributeLike = isJsxAttributeLike; function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 9 - || kind === 256; + || kind === 259; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isJsxOpeningLikeElement(node) { @@ -10398,20 +10441,20 @@ var ts; ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 257 - || kind === 258; + return kind === 260 + || kind === 261; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; function isJSDocNode(node) { - return node.kind >= 267 && node.kind <= 285; + return node.kind >= 270 && node.kind <= 288; } ts.isJSDocNode = isJSDocNode; function isJSDocCommentContainingNode(node) { - return node.kind === 275 || isJSDocTag(node); + return node.kind === 278 || isJSDocTag(node); } ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode; function isJSDocTag(node) { - return node.kind >= 276 && node.kind <= 285; + return node.kind >= 279 && node.kind <= 288; } ts.isJSDocTag = isJSDocTag; function isSetAccessor(node) { @@ -10433,6 +10476,10 @@ var ts; return token >= 71; } ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; + function tokenIsIdentifierOrKeywordOrGreaterThan(token) { + return token === 29 || tokenIsIdentifierOrKeyword(token); + } + ts.tokenIsIdentifierOrKeywordOrGreaterThan = tokenIsIdentifierOrKeywordOrGreaterThan; var textToToken = ts.createMapFromTemplate({ "abstract": 117, "any": 119, @@ -12046,7 +12093,7 @@ var ts; var IdentifierConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 265) { + if (kind === 268) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 71) { @@ -12090,19 +12137,19 @@ var ts; visitNode(cbNode, node.constraint) || visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); - case 262: + case 265: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 263: + case 266: return visitNode(cbNode, node.expression); case 146: case 149: case 148: - case 261: + case 264: case 226: case 176: return visitNodes(cbNode, cbNodes, node.decorators) || @@ -12234,7 +12281,7 @@ var ts; case 207: case 234: return visitNodes(cbNode, cbNodes, node.statements); - case 265: + case 268: return visitNodes(cbNode, cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); case 208: @@ -12282,10 +12329,10 @@ var ts; visitNode(cbNode, node.caseBlock); case 235: return visitNodes(cbNode, cbNodes, node.clauses); - case 257: + case 260: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.statements); - case 258: + case 261: return visitNodes(cbNode, cbNodes, node.statements); case 222: return visitNode(cbNode, node.label) || @@ -12296,7 +12343,7 @@ var ts; return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 260: + case 263: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 147: @@ -12327,7 +12374,7 @@ var ts; visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.members); - case 264: + case 267: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 233: @@ -12374,7 +12421,7 @@ var ts; return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 144: return visitNode(cbNode, node.expression); - case 259: + case 262: return visitNodes(cbNode, cbNodes, node.types); case 201: return visitNode(cbNode, node.expression) || @@ -12383,45 +12430,49 @@ var ts; return visitNode(cbNode, node.expression); case 247: return visitNodes(cbNode, cbNodes, node.decorators); - case 289: + case 292: return visitNodes(cbNode, cbNodes, node.elements); case 249: return visitNode(cbNode, node.openingElement) || visitNodes(cbNode, cbNodes, node.children) || visitNode(cbNode, node.closingElement); + case 253: + return visitNode(cbNode, node.openingFragment) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingFragment); case 250: case 251: return visitNode(cbNode, node.tagName) || visitNode(cbNode, node.attributes); - case 254: + case 257: return visitNodes(cbNode, cbNodes, node.properties); - case 253: + case 256: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 255: + case 258: return visitNode(cbNode, node.expression); - case 256: + case 259: return visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.expression); case 252: return visitNode(cbNode, node.tagName); - case 267: - return visitNode(cbNode, node.type); - case 271: - return visitNode(cbNode, node.type); case 270: return visitNode(cbNode, node.type); - case 272: - return visitNode(cbNode, node.type); - case 273: - return visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); case 274: return visitNode(cbNode, node.type); + case 273: + return visitNode(cbNode, node.type); case 275: + return visitNode(cbNode, node.type); + case 276: + return visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + case 277: + return visitNode(cbNode, node.type); + case 278: return visitNodes(cbNode, cbNodes, node.tags); - case 279: - case 284: + case 282: + case 287: if (node.isNameFirst) { return visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression); @@ -12430,17 +12481,17 @@ var ts; return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); } - case 280: - return visitNode(cbNode, node.typeExpression); - case 281: - return visitNode(cbNode, node.typeExpression); - case 277: - return visitNode(cbNode, node.class); - case 282: - return visitNodes(cbNode, cbNodes, node.typeParameters); case 283: + return visitNode(cbNode, node.typeExpression); + case 284: + return visitNode(cbNode, node.typeExpression); + case 280: + return visitNode(cbNode, node.class); + case 285: + return visitNodes(cbNode, cbNodes, node.typeParameters); + case 286: if (node.typeExpression && - node.typeExpression.kind === 267) { + node.typeExpression.kind === 270) { return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName); } @@ -12448,7 +12499,7 @@ var ts; return visitNode(cbNode, node.fullName) || visitNode(cbNode, node.typeExpression); } - case 285: + case 288: if (node.jsDocPropertyTags) { for (var _i = 0, _a = node.jsDocPropertyTags; _i < _a.length; _i++) { var tag = _a[_i]; @@ -12456,7 +12507,7 @@ var ts; } } return; - case 288: + case 291: return visitNode(cbNode, node.expression); } } @@ -12647,7 +12698,7 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion, scriptKind) { - var sourceFile = new SourceFileConstructor(265, 0, sourceText.length); + var sourceFile = new SourceFileConstructor(268, 0, sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -13084,6 +13135,10 @@ var ts; nextToken(); return ts.tokenIsIdentifierOrKeyword(token()); } + function nextTokenIsIdentifierOrKeywordOrGreaterThan() { + nextToken(); + return ts.tokenIsIdentifierOrKeywordOrGreaterThan(token()); + } function isHeritageClauseExtendsOrImplementsKeyword() { if (token() === 108 || token() === 85) { @@ -13268,8 +13323,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 257: - case 258: + case 260: + case 261: return true; } } @@ -13313,7 +13368,7 @@ var ts; return false; } function isReusableEnumMember(node) { - return node.kind === 264; + return node.kind === 267; } function isReusableTypeMember(node) { if (node) { @@ -13534,7 +13589,7 @@ var ts; return finishNode(node); } function parseJSDocAllType() { - var result = createNode(268); + var result = createNode(271); nextToken(); return finishNode(result); } @@ -13547,18 +13602,18 @@ var ts; token() === 29 || token() === 58 || token() === 49) { - var result = createNode(269, pos); + var result = createNode(272, pos); return finishNode(result); } else { - var result = createNode(270, pos); + var result = createNode(273, pos); result.type = parseType(); return finishNode(result); } } function parseJSDocFunctionType() { if (lookAhead(nextTokenIsOpenParen)) { - var result = createNode(273); + var result = createNode(276); nextToken(); fillSignature(56, 4 | 32, result); return addJSDocComment(finishNode(result)); @@ -13914,9 +13969,9 @@ var ts; case 89: return parseJSDocFunctionType(); case 24: - return parseJSDocNodeWithType(274); + return parseJSDocNodeWithType(277); case 51: - return parseJSDocNodeWithType(271); + return parseJSDocNodeWithType(274); case 13: case 9: case 8: @@ -13998,13 +14053,13 @@ var ts; if (!(contextFlags & 1048576)) { return type; } - type = createJSDocPostfixType(272, type); + type = createJSDocPostfixType(275, type); break; case 51: - type = createJSDocPostfixType(271, type); + type = createJSDocPostfixType(274, type); break; case 55: - type = createJSDocPostfixType(270, type); + type = createJSDocPostfixType(273, type); break; case 21: parseExpected(21); @@ -14662,8 +14717,8 @@ var ts; node.operand = parseLeftHandSideExpressionOrHigher(); return finishNode(node); } - else if (sourceFile.languageVariant === 1 && token() === 27 && lookAhead(nextTokenIsIdentifierOrKeyword)) { - return parseJsxElementOrSelfClosingElement(true); + else if (sourceFile.languageVariant === 1 && token() === 27 && lookAhead(nextTokenIsIdentifierOrKeywordOrGreaterThan)) { + return parseJsxElementOrSelfClosingElementOrFragment(true); } var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); @@ -14715,25 +14770,32 @@ var ts; return lhs.name.escapedText === rhs.name.escapedText && tagNamesAreEquivalent(lhs.expression, rhs.expression); } - function parseJsxElementOrSelfClosingElement(inExpressionContext) { - var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); + function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext) { + var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); var result; if (opening.kind === 251) { var node = createNode(249, opening.pos); node.openingElement = opening; - node.children = parseJsxChildren(node.openingElement.tagName); + node.children = parseJsxChildren(node.openingElement); node.closingElement = parseJsxClosingElement(inExpressionContext); if (!tagNamesAreEquivalent(node.openingElement.tagName, node.closingElement.tagName)) { parseErrorAtPosition(node.closingElement.pos, node.closingElement.end - node.closingElement.pos, ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNodeFromSourceText(sourceText, node.openingElement.tagName)); } result = finishNode(node); } + else if (opening.kind === 254) { + var node = createNode(253, opening.pos); + node.openingFragment = opening; + node.children = parseJsxChildren(node.openingFragment); + node.closingFragment = parseJsxClosingFragment(inExpressionContext); + result = finishNode(node); + } else { ts.Debug.assert(opening.kind === 250); result = opening; } if (inExpressionContext && token() === 27) { - var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(true); }); + var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElementOrFragment(true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); var badNode = createNode(194, result.pos); @@ -14761,11 +14823,11 @@ var ts; case 17: return parseJsxExpression(false); case 27: - return parseJsxElementOrSelfClosingElement(false); + return parseJsxElementOrSelfClosingElementOrFragment(false); } ts.Debug.fail("Unknown JSX child kind " + token()); } - function parseJsxChildren(openingTagName) { + function parseJsxChildren(openingTag) { var list = []; var listPos = getNodePos(); var saveParsingContext = parsingContext; @@ -14776,7 +14838,13 @@ var ts; break; } else if (token() === 1) { - parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTagName)); + if (ts.isJsxOpeningFragment(openingTag)) { + parseErrorAtPosition(openingTag.pos, openingTag.end - openingTag.pos, ts.Diagnostics.JSX_fragment_has_no_corresponding_closing_tag); + } + else { + var openingTagName = openingTag.tagName; + parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTagName)); + } break; } else if (token() === 7) { @@ -14791,13 +14859,18 @@ var ts; return createNodeArray(list, listPos); } function parseJsxAttributes() { - var jsxAttributes = createNode(254); + var jsxAttributes = createNode(257); jsxAttributes.properties = parseList(13, parseJsxAttribute); return finishNode(jsxAttributes); } - function parseJsxOpeningOrSelfClosingElement(inExpressionContext) { + function parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext) { var fullStart = scanner.getStartPos(); parseExpected(27); + if (token() === 29) { + parseExpected(29); + var node_1 = createNode(254, fullStart); + return finishNode(node_1); + } var tagName = parseJsxElementName(); var attributes = parseJsxAttributes(); var node; @@ -14833,7 +14906,7 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(256); + var node = createNode(259); parseExpected(17); if (token() !== 18) { node.dotDotDotToken = parseOptionalToken(24); @@ -14853,7 +14926,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(253); + var node = createNode(256); node.name = parseIdentifierName(); if (token() === 58) { switch (scanJsxAttributeValue()) { @@ -14868,7 +14941,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(255); + var node = createNode(258); parseExpected(17); parseExpected(24); node.expression = parseExpression(); @@ -14888,6 +14961,22 @@ var ts; } return finishNode(node); } + function parseJsxClosingFragment(inExpressionContext) { + var node = createNode(255); + parseExpected(28); + if (ts.tokenIsIdentifierOrKeyword(token())) { + var unexpectedTagName = parseJsxElementName(); + parseErrorAtPosition(unexpectedTagName.pos, unexpectedTagName.end - unexpectedTagName.pos, ts.Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment); + } + if (inExpressionContext) { + parseExpected(29); + } + else { + parseExpected(29, undefined, false); + scanJsxText(); + } + return finishNode(node); + } function parseTypeAssertion() { var node = createNode(184); parseExpected(27); @@ -15093,7 +15182,7 @@ var ts; var fullStart = scanner.getStartPos(); var dotDotDotToken = parseOptionalToken(24); if (dotDotDotToken) { - var spreadElement = createNode(263, fullStart); + var spreadElement = createNode(266, fullStart); spreadElement.expression = parseAssignmentExpressionOrHigher(); return addJSDocComment(finishNode(spreadElement)); } @@ -15112,7 +15201,7 @@ var ts; } var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 26 || token() === 18 || token() === 58); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(262, fullStart); + var shorthandDeclaration = createNode(265, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(58); @@ -15123,7 +15212,7 @@ var ts; return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(261, fullStart); + var propertyAssignment = createNode(264, fullStart); propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; @@ -15172,10 +15261,10 @@ var ts; var fullStart = scanner.getStartPos(); parseExpected(94); if (parseOptional(23)) { - var node_1 = createNode(204, fullStart); - node_1.keywordToken = 94; - node_1.name = parseIdentifierName(); - return finishNode(node_1); + var node_2 = createNode(204, fullStart); + node_2.keywordToken = 94; + node_2.name = parseIdentifierName(); + return finishNode(node_2); } var node = createNode(182, fullStart); node.expression = parseMemberExpressionOrHigher(); @@ -15326,7 +15415,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(257); + var node = createNode(260); parseExpected(73); node.expression = allowInAnd(parseExpression); parseExpected(56); @@ -15334,7 +15423,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(258); + var node = createNode(261); parseExpected(79); parseExpected(56); node.statements = parseList(3, parseStatement); @@ -15375,7 +15464,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(260); + var result = createNode(263); parseExpected(74); if (parseOptional(19)) { result.variableDeclaration = parseVariableDeclaration(); @@ -15999,7 +16088,7 @@ var ts; function parseHeritageClause() { var tok = token(); if (tok === 85 || tok === 108) { - var node = createNode(259); + var node = createNode(262); node.token = tok; nextToken(); node.types = parseDelimitedList(7, parseExpressionWithTypeArguments); @@ -16048,7 +16137,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseEnumMember() { - var node = createNode(264, scanner.getStartPos()); + var node = createNode(267, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return addJSDocComment(finishNode(node)); @@ -16422,7 +16511,7 @@ var ts; } JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; function parseJSDocTypeExpression(requireBraces) { - var result = createNode(267, scanner.getTokenPos()); + var result = createNode(270, scanner.getTokenPos()); if (!parseExpected(17) && requireBraces) { return undefined; } @@ -16591,7 +16680,7 @@ var ts; content.charCodeAt(start + 3) !== 42; } function createJSDocComment() { - var result = createNode(275, start); + var result = createNode(278, start); result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd); result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -16708,7 +16797,7 @@ var ts; return comments; } function parseUnknownTag(atToken, tagName) { - var result = createNode(276, atToken.pos); + var result = createNode(279, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -16760,8 +16849,8 @@ var ts; typeExpression = tryParseTypeExpression(); } var result = target === 1 ? - createNode(279, atToken.pos) : - createNode(284, atToken.pos); + createNode(282, atToken.pos) : + createNode(287, atToken.pos); var nestedTypeLiteral = parseNestedTypeLiteral(typeExpression, name); if (nestedTypeLiteral) { typeExpression = nestedTypeLiteral; @@ -16777,7 +16866,7 @@ var ts; } function parseNestedTypeLiteral(typeExpression, name) { if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) { - var typeLiteralExpression = createNode(267, scanner.getTokenPos()); + var typeLiteralExpression = createNode(270, scanner.getTokenPos()); var child = void 0; var jsdocTypeLiteral = void 0; var start_2 = scanner.getStartPos(); @@ -16789,7 +16878,7 @@ var ts; children.push(child); } if (children) { - jsdocTypeLiteral = createNode(285, start_2); + jsdocTypeLiteral = createNode(288, start_2); jsdocTypeLiteral.jsDocPropertyTags = children; if (typeExpression.type.kind === 164) { jsdocTypeLiteral.isArrayType = true; @@ -16800,27 +16889,27 @@ var ts; } } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 280; })) { + if (ts.forEach(tags, function (t) { return t.kind === 283; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } - var result = createNode(280, atToken.pos); + var result = createNode(283, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 281; })) { + if (ts.forEach(tags, function (t) { return t.kind === 284; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } - var result = createNode(281, atToken.pos); + var result = createNode(284, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = parseJSDocTypeExpression(true); return finishNode(result); } function parseAugmentsTag(atToken, tagName) { - var result = createNode(277, atToken.pos); + var result = createNode(280, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.class = parseExpressionWithTypeArgumentsForAugments(); @@ -16848,7 +16937,7 @@ var ts; return node; } function parseClassTag(atToken, tagName) { - var tag = createNode(278, atToken.pos); + var tag = createNode(281, atToken.pos); tag.atToken = atToken; tag.tagName = tagName; return finishNode(tag); @@ -16856,7 +16945,7 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(283, atToken.pos); + var typedefTag = createNode(286, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(0); @@ -16879,9 +16968,9 @@ var ts; var start_3 = scanner.getStartPos(); while (child = tryParse(function () { return parseChildParameterOrPropertyTag(0); })) { if (!jsdocTypeLiteral) { - jsdocTypeLiteral = createNode(285, start_3); + jsdocTypeLiteral = createNode(288, start_3); } - if (child.kind === 281) { + if (child.kind === 284) { if (childTypeTag) { break; } @@ -16943,7 +17032,7 @@ var ts; case 57: if (canParseTag) { var child = tryParseChildTag(target); - if (child && child.kind === 279 && + if (child && child.kind === 282 && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; } @@ -16993,7 +17082,7 @@ var ts; return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 282; })) { + if (ts.forEach(tags, function (t) { return t.kind === 285; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } var typeParameters = []; @@ -17017,7 +17106,7 @@ var ts; break; } } - var result = createNode(282, atToken.pos); + var result = createNode(285, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = createNodeArray(typeParameters, typeParametersPos); @@ -17560,14 +17649,14 @@ var ts; case 228: case 229: return (ts.hasModifier(node, 512) ? "default" : undefined); - case 273: + case 276: return (ts.isJSDocConstructSignature(node) ? "__new" : "__call"); case 146: - ts.Debug.assert(node.parent.kind === 273); + ts.Debug.assert(node.parent.kind === 276); var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "arg" + index; - case 283: + case 286: var name_2 = ts.getNameOfJSDocTypedef(node); return typeof name_2 !== "undefined" ? name_2.escapedText : undefined; } @@ -17641,9 +17730,9 @@ var ts; } } else { - if (node.kind === 283) + if (node.kind === 286) ts.Debug.assert(ts.isInJavaScriptFile(node)); - var isJSDocTypedefInJSDocNamespace = node.kind === 283 && + var isJSDocTypedefInJSDocNamespace = node.kind === 286 && node.name && node.name.kind === 71 && node.name.isInJSDocNamespace; @@ -17702,7 +17791,7 @@ var ts; if (hasExplicitReturn) node.flags |= 256; } - if (node.kind === 265) { + if (node.kind === 268) { node.flags |= emitFlags; } if (isIIFE) { @@ -17822,7 +17911,7 @@ var ts; case 235: bindCaseBlock(node); break; - case 257: + case 260: bindCaseClause(node); break; case 222: @@ -17849,10 +17938,10 @@ var ts; case 181: bindCallExpressionFlow(node); break; - case 275: + case 278: bindJSDocComment(node); break; - case 283: + case 286: bindJSDocTypedefTag(node); break; default: @@ -18210,7 +18299,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 258; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 261; }); node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; if (!hasDefault) { addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0)); @@ -18306,13 +18395,13 @@ var ts; else if (node.kind === 178) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 261) { + if (p.kind === 264) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 262) { + else if (p.kind === 265) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 263) { + else if (p.kind === 266) { bindAssignmentTargetFlow(p.expression); } } @@ -18418,7 +18507,7 @@ var ts; } function bindJSDocComment(node) { ts.forEachChild(node, function (n) { - if (n.kind !== 283) { + if (n.kind !== 286) { bind(n); } }); @@ -18458,8 +18547,8 @@ var ts; case 232: case 178: case 163: - case 285: - case 254: + case 288: + case 257: return 1; case 230: return 1 | 64; @@ -18467,7 +18556,7 @@ var ts; case 231: case 172: return 1 | 32; - case 265: + case 268: return 1 | 4 | 32; case 151: if (ts.isObjectLiteralOrClassExpressionMethod(node)) { @@ -18479,7 +18568,7 @@ var ts; case 153: case 154: case 155: - case 273: + case 276: case 160: case 156: case 157: @@ -18492,7 +18581,7 @@ var ts; return 4; case 149: return node.initializer ? 4 : 0; - case 260: + case 263: case 214: case 215: case 216: @@ -18513,7 +18602,7 @@ var ts; switch (container.kind) { case 233: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 265: + case 268: return declareSourceFileMember(node, symbolFlags, symbolExcludes); case 199: case 229: @@ -18521,10 +18610,10 @@ var ts; case 232: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); case 163: - case 285: + case 288: case 178: case 230: - case 254: + case 257: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); case 160: case 161: @@ -18539,7 +18628,7 @@ var ts; case 228: case 186: case 187: - case 273: + case 276: case 231: case 172: return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); @@ -18556,8 +18645,8 @@ var ts; : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 265 ? node : node.body; - if (body && (body.kind === 265 || body.kind === 234)) { + var body = node.kind === 268 ? node : node.body; + if (body && (body.kind === 268 || body.kind === 234)) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; if (stat.kind === 244 || stat.kind === 243) { @@ -18643,11 +18732,11 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 263 || prop.name.kind !== 71) { + if (prop.kind === 266 || prop.name.kind !== 71) { continue; } var identifier = prop.name; - var currentKind = prop.kind === 261 || prop.kind === 262 || prop.kind === 151 + var currentKind = prop.kind === 264 || prop.kind === 265 || prop.kind === 151 ? 1 : 2; var existingKind = seen.get(identifier.escapedText); @@ -18681,7 +18770,7 @@ var ts; case 233: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 265: + case 268: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -18770,7 +18859,7 @@ var ts; } function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2) { - if (blockScopeContainer.kind !== 265 && + if (blockScopeContainer.kind !== 268 && blockScopeContainer.kind !== 233 && !ts.isFunctionLike(blockScopeContainer)) { var errorSpan = ts.getErrorSpanForNode(file, node); @@ -18841,7 +18930,7 @@ var ts; } for (var _b = 0, _c = jsDoc.tags; _b < _c.length; _b++) { var tag = _c[_b]; - if (tag.kind === 283) { + if (tag.kind === 286) { var savedParent = parent; parent = jsDoc; bind(tag); @@ -18873,14 +18962,14 @@ var ts; case 71: if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 283) { + while (parentNode && parentNode.kind !== 286) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288, 793064); break; } case 99: - if (currentFlow && (ts.isExpression(node) || parent.kind === 262)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 265)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); @@ -18913,7 +19002,7 @@ var ts; ts.Debug.fail("Unknown special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 260: + case 263: return checkStrictModeCatchClause(node); case 188: return checkStrictModeDeleteExpression(node); @@ -18942,10 +19031,10 @@ var ts; case 149: case 148: return bindPropertyWorker(node); - case 261: - case 262: - return bindPropertyOrMethodOrAccessor(node, 4, 0); case 264: + case 265: + return bindPropertyOrMethodOrAccessor(node, 4, 0); + case 267: return bindPropertyOrMethodOrAccessor(node, 8, 900095); case 155: case 156: @@ -18963,11 +19052,11 @@ var ts; case 154: return bindPropertyOrMethodOrAccessor(node, 65536, 74687); case 160: - case 273: + case 276: case 161: return bindFunctionOrConstructorType(node); case 163: - case 285: + case 288: case 172: return bindAnonymousTypeWorker(node); case 178: @@ -18992,9 +19081,9 @@ var ts; return bindEnumDeclaration(node); case 233: return bindModuleDeclaration(node); - case 254: + case 257: return bindJsxAttributes(node); - case 253: + case 256: return bindJsxAttribute(node, 4, 0); case 237: case 240: @@ -19009,7 +19098,7 @@ var ts; return bindExportDeclaration(node); case 243: return bindExportAssignment(node); - case 265: + case 268: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); case 207: @@ -19018,17 +19107,17 @@ var ts; } case 234: return updateStrictModeStatementList(node.statements); - case 279: - if (node.parent.kind !== 285) { + case 282: + if (node.parent.kind !== 288) { break; } - case 284: + case 287: var propTag = node; - var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 272 ? + var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 275 ? 4 | 16777216 : 4; return declareSymbolAndAddToSymbolTable(propTag, flags, 0); - case 283: { + case 286: { var fullName = node.fullName; if (!fullName || fullName.kind === 71) { return bindBlockScopedDeclaration(node, 524288, 793064); @@ -19077,7 +19166,7 @@ var ts; if (node.modifiers && node.modifiers.length) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); } - if (node.parent.kind !== 265) { + if (node.parent.kind !== 268) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); return; } @@ -19368,9 +19457,9 @@ var ts; return computeClassDeclaration(node, subtreeFlags); case 199: return computeClassExpression(node, subtreeFlags); - case 259: + case 262: return computeHeritageClause(node, subtreeFlags); - case 260: + case 263: return computeCatchClause(node, subtreeFlags); case 201: return computeExpressionWithTypeArguments(node, subtreeFlags); @@ -19778,7 +19867,7 @@ var ts; case 124: case 76: case 232: - case 264: + case 267: case 184: case 202: case 203: @@ -19794,6 +19883,9 @@ var ts; case 254: case 255: case 256: + case 257: + case 258: + case 259: transformFlags |= 4; break; case 13: @@ -19802,7 +19894,7 @@ var ts; case 16: case 196: case 183: - case 262: + case 265: case 115: case 204: transformFlags |= 192; @@ -19871,7 +19963,7 @@ var ts; case 198: transformFlags |= 192 | 524288; break; - case 263: + case 266: transformFlags |= 8 | 1048576; break; case 97: @@ -19927,7 +20019,7 @@ var ts; transformFlags |= 192; } break; - case 265: + case 268: if (subtreeFlags & 32768) { transformFlags |= 192; } @@ -19989,7 +20081,7 @@ var ts; return -3; case 178: return 540087617; - case 260: + case 263: return 537920833; case 174: case 175: @@ -20822,7 +20914,7 @@ var ts; return type.flags & 32768 ? type.objectFlags : 0; } function isGlobalSourceFile(node) { - return node.kind === 265 && !ts.isExternalOrCommonJsModule(node); + return node.kind === 268 && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -20946,7 +21038,7 @@ var ts; if (result = lookup(location.locals, name, meaning)) { var useResult = true; if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) { - if (meaning & result.flags & 793064 && lastLocation.kind !== 275) { + if (meaning & result.flags & 793064 && lastLocation.kind !== 278) { useResult = result.flags & 262144 ? lastLocation === location.type || lastLocation.kind === 146 || @@ -20969,13 +21061,13 @@ var ts; } } switch (location.kind) { - case 265: + case 268: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; case 233: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 265 || ts.isAmbientModule(location)) { + if (location.kind === 268 || ts.isAmbientModule(location)) { if (result = moduleExports.get("default")) { var localSymbol = ts.getLocalSymbolForExportDefault(result); if (localSymbol && (result.flags & meaning) && localSymbol.escapedName === name) { @@ -21097,7 +21189,7 @@ var ts; } if (!result) { if (lastLocation) { - ts.Debug.assert(lastLocation.kind === 265); + ts.Debug.assert(lastLocation.kind === 268); if (lastLocation.commonJsModuleIndicator && name === "exports") { return lastLocation.symbol; } @@ -21819,7 +21911,7 @@ var ts; } } switch (location.kind) { - case 265: + case 268: if (!ts.isExternalOrCommonJsModule(location)) { break; } @@ -21967,7 +22059,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 265 && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 268 && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -22253,7 +22345,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 265 || declaration.parent.kind === 234; + return declaration.parent.kind === 268 || declaration.parent.kind === 234; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return ts.contains(context.symbolStack, symbol); @@ -22940,7 +23032,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.some(symbol.declarations, function (declaration) { - return declaration.parent.kind === 265 || declaration.parent.kind === 234; + return declaration.parent.kind === 268 || declaration.parent.kind === 234; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 4) || @@ -23341,7 +23433,7 @@ var ts; } var parent = getDeclarationContainer(node); if (!(ts.getCombinedModifierFlags(node) & 1) && - !(node.kind !== 237 && parent.kind !== 265 && ts.isInAmbientContext(parent))) { + !(node.kind !== 237 && parent.kind !== 268 && ts.isInAmbientContext(parent))) { return isGlobalSourceFile(parent); } return isDeclarationVisible(parent); @@ -23375,7 +23467,7 @@ var ts; case 242: return false; case 145: - case 265: + case 268: case 236: return true; case 243: @@ -23669,7 +23761,7 @@ var ts; if (ts.isJsxAttribute(declaration)) { return trueType; } - if (declaration.kind === 262) { + if (declaration.kind === 265) { return checkIdentifier(declaration.name); } if (ts.isBindingPattern(declaration.name)) { @@ -23783,7 +23875,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - if (declaration.kind === 261) { + if (declaration.kind === 264) { return type; } return getWidenedType(type); @@ -24045,13 +24137,13 @@ var ts; case 150: case 160: case 161: - case 273: + case 276: case 228: case 151: case 186: case 187: case 231: - case 282: + case 285: case 172: var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); if (node.kind === 172) { @@ -24309,9 +24401,9 @@ var ts; return unknownType; } var declaration = ts.find(symbol.declarations, function (d) { - return d.kind === 283 || d.kind === 231; + return d.kind === 286 || d.kind === 231; }); - var typeNode = declaration.kind === 283 ? declaration.typeExpression : declaration.type; + var typeNode = declaration.kind === 286 ? declaration.typeExpression : declaration.type; var type = typeNode ? getTypeFromTypeNode(typeNode) : unknownType; if (popTypeResolution()) { var typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); @@ -25296,7 +25388,7 @@ var ts; } function isJSDocOptionalParameter(node) { if (ts.isInJavaScriptFile(node)) { - if (node.type && node.type.kind === 272) { + if (node.type && node.type.kind === 275) { return true; } var paramTags = ts.getJSDocParameterTags(node); @@ -25307,7 +25399,7 @@ var ts; return true; } if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 272; + return paramTag.typeExpression.type.kind === 275; } } } @@ -25519,7 +25611,7 @@ var ts; case 154: case 186: case 187: - case 273: + case 276: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -26713,8 +26805,8 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 119: - case 268: - case 269: + case 271: + case 272: return anyType; case 136: return stringType; @@ -26755,18 +26847,18 @@ var ts; return getTypeFromUnionTypeNode(node); case 167: return getTypeFromIntersectionTypeNode(node); - case 270: + case 273: return getTypeFromJSDocNullableTypeNode(node); case 168: - case 271: - case 272: - case 267: + case 274: + case 275: + case 270: return getTypeFromTypeNode(node.type); case 160: case 161: case 163: - case 285: - case 273: + case 288: + case 276: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 170: return getTypeFromTypeOperatorNode(node); @@ -26778,7 +26870,7 @@ var ts; case 143: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); - case 274: + case 277: return getTypeFromJSDocVariadicType(node); default: return unknownType; @@ -27039,15 +27131,15 @@ var ts; case 194: return node.operatorToken.kind === 54 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 261: + case 264: return isContextSensitive(node.initializer); case 185: return isContextSensitive(node.expression); - case 254: + case 257: return ts.forEach(node.properties, isContextSensitive); - case 253: - return node.initializer && isContextSensitive(node.initializer); case 256: + return node.initializer && isContextSensitive(node.initializer); + case 259: return node.expression && isContextSensitive(node.expression); } return false; @@ -29422,7 +29514,7 @@ var ts; } function getAssignedTypeOfBinaryExpression(node) { var isDestructuringDefaultAssignment = node.parent.kind === 177 && isDestructuringAssignmentTarget(node.parent) || - node.parent.kind === 261 && isDestructuringAssignmentTarget(node.parent.parent); + node.parent.kind === 264 && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); @@ -29458,9 +29550,9 @@ var ts; return getAssignedTypeOfArrayLiteralElement(parent, node); case 198: return getAssignedTypeOfSpreadExpression(parent); - case 261: + case 264: return getAssignedTypeOfPropertyAssignment(parent); - case 262: + case 265: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return unknownType; @@ -29529,7 +29621,7 @@ var ts; getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 257) { + if (clause.kind === 260) { var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } @@ -30244,7 +30336,7 @@ var ts; return ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || node.kind === 234 || - node.kind === 265 || + node.kind === 268 || node.kind === 149; }); } @@ -30421,7 +30513,7 @@ var ts; function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 || (symbol.flags & (2 | 32)) === 0 || - symbol.valueDeclaration.parent.kind === 260) { + symbol.valueDeclaration.parent.kind === 263) { return; } var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); @@ -30583,7 +30675,7 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 273) { + if (jsdocType && jsdocType.kind === 276) { var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && @@ -30702,7 +30794,7 @@ var ts; return (func.kind === 151 || func.kind === 153 || func.kind === 154) && func.parent.kind === 178 ? func.parent : - func.kind === 186 && func.parent.kind === 261 ? func.parent.parent : + func.kind === 186 && func.parent.kind === 264 ? func.parent.parent : undefined; } function getThisTypeArgument(type) { @@ -30738,7 +30830,7 @@ var ts; if (thisType) { return instantiateType(thisType, getContextualMapper(containingLiteral)); } - if (literal.parent.kind !== 261) { + if (literal.parent.kind !== 264) { break; } literal = literal.parent.parent; @@ -30983,7 +31075,12 @@ var ts; function getContextualTypeForJsxExpression(node) { var jsxAttributes = ts.isJsxAttributeLike(node.parent) ? node.parent.parent : - node.parent.openingElement.attributes; + ts.isJsxElement(node.parent) ? + node.parent.openingElement.attributes : + undefined; + if (!jsxAttributes) { + return undefined; + } var attributesType = getContextualType(jsxAttributes); if (!attributesType || isTypeAny(attributesType)) { return undefined; @@ -31043,10 +31140,10 @@ var ts; return getTypeFromTypeNode(parent.type); case 194: return getContextualTypeForBinaryOperand(node); - case 261: - case 262: + case 264: + case 265: return getContextualTypeForObjectLiteralElement(parent); - case 263: + case 266: return getApparentTypeOfContextualType(parent.parent); case 177: { var arrayLiteral = parent; @@ -31062,10 +31159,10 @@ var ts; var tag = ts.isInJavaScriptFile(parent) ? ts.getJSDocTypeTag(parent) : undefined; return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(parent); } - case 256: + case 259: return getContextualTypeForJsxExpression(parent); - case 253: - case 255: + case 256: + case 258: return getContextualTypeForJsxAttribute(parent); case 251: case 250: @@ -31282,15 +31379,15 @@ var ts; var memberDecl = node.properties[i]; var member = memberDecl.symbol; var literalName = void 0; - if (memberDecl.kind === 261 || - memberDecl.kind === 262 || + if (memberDecl.kind === 264 || + memberDecl.kind === 265 || ts.isObjectLiteralMethod(memberDecl)) { var jsdocType = void 0; if (isInJSFile) { jsdocType = getTypeForDeclarationFromJSDocComment(memberDecl); } var type = void 0; - if (memberDecl.kind === 261) { + if (memberDecl.kind === 264) { if (memberDecl.name.kind === 144) { var t = checkComputedPropertyName(memberDecl.name); if (t.flags & 224) { @@ -31303,7 +31400,7 @@ var ts; type = checkObjectLiteralMethod(memberDecl, checkMode); } else { - ts.Debug.assert(memberDecl.kind === 262); + ts.Debug.assert(memberDecl.kind === 265); type = checkExpressionForMutableLocation(memberDecl.name, checkMode); } if (jsdocType) { @@ -31313,8 +31410,8 @@ var ts; typeFlags |= type.flags; var prop = createSymbol(4 | member.flags, literalName || member.escapedName); if (inDestructuringPattern) { - var isOptional = (memberDecl.kind === 261 && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 262 && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 264 && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 265 && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 16777216; } @@ -31340,7 +31437,7 @@ var ts; prop.target = member; member = prop; } - else if (memberDecl.kind === 263) { + else if (memberDecl.kind === 266) { if (languageVersion < 2) { checkExternalEmitHelpers(memberDecl, 2); } @@ -31423,11 +31520,11 @@ var ts; type.flags & 196608 && !ts.forEach(type.types, function (t) { return !isValidSpreadType(t); })); } function checkJsxSelfClosingElement(node) { - checkJsxOpeningLikeElement(node); + checkJsxOpeningLikeElementOrOpeningFragment(node); return getJsxGlobalElementType() || anyType; } function checkJsxElement(node) { - checkJsxOpeningLikeElement(node.openingElement); + checkJsxOpeningLikeElementOrOpeningFragment(node.openingElement); if (isJsxIntrinsicIdentifier(node.closingElement.tagName)) { getIntrinsicTagSymbol(node.closingElement); } @@ -31436,6 +31533,13 @@ var ts; } return getJsxGlobalElementType() || anyType; } + function checkJsxFragment(node) { + checkJsxOpeningLikeElementOrOpeningFragment(node.openingFragment); + if (compilerOptions.jsx === 2 && compilerOptions.jsxFactory) { + error(node, ts.Diagnostics.JSX_fragment_is_not_supported_when_using_jsxFactory); + } + return getJsxGlobalElementType() || anyType; + } function isUnhyphenatedJsxName(name) { return !ts.stringContains(name, "-"); } @@ -31481,7 +31585,7 @@ var ts; } } else { - ts.Debug.assert(attributeDecl.kind === 255); + ts.Debug.assert(attributeDecl.kind === 258); if (attributesArray.length > 0) { spread = getSpreadType(spread, createJsxAttributesType(attributes.symbol, attributesTable), openingLikeElement.symbol, 0); attributesArray = []; @@ -31516,18 +31620,7 @@ var ts; } var parent = openingLikeElement.parent.kind === 249 ? openingLikeElement.parent : undefined; if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) { - var childrenTypes = []; - for (var _c = 0, _d = parent.children; _c < _d.length; _c++) { - var child = _d[_c]; - if (child.kind === 10) { - if (!child.containsOnlyWhiteSpaces) { - childrenTypes.push(stringType); - } - } - else { - childrenTypes.push(checkExpression(child, checkMode)); - } - } + var childrenTypes = checkJsxChildren(parent, checkMode); if (!hasSpreadAnyType && jsxChildrenPropertyName && jsxChildrenPropertyName !== "") { if (explicitlySpecifyChildrenAttribute) { error(attributes, ts.Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, ts.unescapeLeadingUnderscores(jsxChildrenPropertyName)); @@ -31552,6 +31645,21 @@ var ts; return result; } } + function checkJsxChildren(node, checkMode) { + var childrenTypes = []; + for (var _i = 0, _a = node.children; _i < _a.length; _i++) { + var child = _a[_i]; + if (child.kind === 10) { + if (!child.containsOnlyWhiteSpaces) { + childrenTypes.push(stringType); + } + } + else { + childrenTypes.push(checkExpression(child, checkMode)); + } + } + return childrenTypes; + } function checkJsxAttributes(node, checkMode) { return createJsxAttributesTypeFromAttributesProperty(node.parent, undefined, checkMode); } @@ -31888,19 +31996,28 @@ var ts; } } } - function checkJsxOpeningLikeElement(node) { - checkGrammarJsxElement(node); + function checkJsxOpeningLikeElementOrOpeningFragment(node) { + var isNodeOpeningLikeElement = ts.isJsxOpeningLikeElement(node); + if (isNodeOpeningLikeElement) { + checkGrammarJsxElement(node); + } checkJsxPreconditions(node); var reactRefErr = diagnostics && compilerOptions.jsx === 2 ? ts.Diagnostics.Cannot_find_name_0 : undefined; var reactNamespace = getJsxNamespace(); - var reactSym = resolveName(node.tagName, reactNamespace, 107455, reactRefErr, reactNamespace, true); + var reactLocation = isNodeOpeningLikeElement ? node.tagName : node; + var reactSym = resolveName(reactLocation, reactNamespace, 107455, reactRefErr, reactNamespace, true); if (reactSym) { reactSym.isReferenced = true; if (reactSym.flags & 2097152 && !isConstEnumOrConstEnumOnlyModule(resolveAlias(reactSym))) { markAliasSymbolAsReferenced(reactSym); } } - checkJsxAttributesAssignableToTagNameAttributes(node); + if (isNodeOpeningLikeElement) { + checkJsxAttributesAssignableToTagNameAttributes(node); + } + else { + checkJsxChildren(node.parent); + } } function isKnownProperty(targetType, name, isComparingJsxAttributes) { if (targetType.flags & 32768) { @@ -32111,7 +32228,7 @@ var ts; switch (node.kind) { case 149: return true; - case 261: + case 264: return false; default: return ts.isPartOfExpression(node) ? false : "quit"; @@ -33965,7 +34082,7 @@ var ts; return sourceType; } function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { - if (property.kind === 261 || property.kind === 262) { + if (property.kind === 264 || property.kind === 265) { var name = property.name; if (name.kind === 144) { checkComputedPropertyName(name); @@ -33980,7 +34097,7 @@ var ts; isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1) || getIndexTypeOfType(objectLiteralType, 0); if (type) { - if (property.kind === 262) { + if (property.kind === 265) { return checkDestructuringAssignment(property, type); } else { @@ -33991,7 +34108,7 @@ var ts; error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name)); } } - else if (property.kind === 263) { + else if (property.kind === 266) { if (languageVersion < 5) { checkExternalEmitHelpers(property, 4); } @@ -34062,7 +34179,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode) { var target; - if (exprOrAssignment.kind === 262) { + if (exprOrAssignment.kind === 265) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { if (strictNullChecks && @@ -34090,7 +34207,7 @@ var ts; } function checkReferenceAssignment(target, sourceType, checkMode) { var targetType = checkExpression(target, checkMode); - var error = target.parent.kind === 263 ? + var error = target.parent.kind === 266 ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; if (checkReferenceExpression(target, error)) { @@ -34601,13 +34718,15 @@ var ts; return undefinedWideningType; case 197: return checkYieldExpression(node); - case 256: + case 259: return checkJsxExpression(node, checkMode); case 249: return checkJsxElement(node); case 250: return checkJsxSelfClosingElement(node); - case 254: + case 253: + return checkJsxFragment(node); + case 257: return checkJsxAttributes(node, checkMode); case 251: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); @@ -35434,7 +35553,7 @@ var ts; switch (d.kind) { case 230: case 231: - case 283: + case 286: return 2; case 233: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 @@ -35762,7 +35881,7 @@ var ts; error(classLike, ts.Diagnostics.JSDoc_0_is_not_attached_to_a_class, ts.idText(node.tagName)); return; } - var augmentsTags = ts.getAllJSDocTagsOfKind(classLike, 277); + var augmentsTags = ts.getAllJSDocTagsOfKind(classLike, 280); ts.Debug.assert(augmentsTags.length > 0); if (augmentsTags.length > 1) { error(augmentsTags[1], ts.Diagnostics.Class_declarations_cannot_have_more_than_one_augments_or_extends_tag); @@ -35834,7 +35953,7 @@ var ts; for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) { var node = deferredUnusedIdentifierNodes_1[_i]; switch (node.kind) { - case 265: + case 268: case 233: checkUnusedModuleMembers(node); break; @@ -36094,7 +36213,7 @@ var ts; return; } var parent = getDeclarationContainer(node); - if (parent.kind === 265 && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 268 && ts.isExternalOrCommonJsModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -36106,7 +36225,7 @@ var ts; return; } var parent = getDeclarationContainer(node); - if (parent.kind === 265 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) { + if (parent.kind === 268 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -36134,7 +36253,7 @@ var ts; (container.kind === 207 && ts.isFunctionLike(container.parent) || container.kind === 234 || container.kind === 233 || - container.kind === 265); + container.kind === 268); if (!namesShareScope) { var name = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); @@ -36688,7 +36807,7 @@ var ts; var expressionType = checkExpression(node.expression); var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 258 && !hasDuplicateDefaultClause) { + if (clause.kind === 261 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -36700,7 +36819,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 257) { + if (produceDiagnostics && clause.kind === 260) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); var caseIsLiteral = isLiteralType(caseType); @@ -37298,7 +37417,7 @@ var ts; var declaration = memberSymbol.valueDeclaration; if (declaration !== member) { if (isBlockScopedNameDeclaredBeforeUse(declaration, member)) { - return getNodeLinks(declaration).enumMemberValue; + return getEnumMemberValue(declaration); } error(expr, ts.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums); return 0; @@ -37533,7 +37652,7 @@ var ts; return false; } var inAmbientExternalModule = node.parent.kind === 234 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 265 && !inAmbientExternalModule) { + if (node.parent.kind !== 268 && !inAmbientExternalModule) { error(moduleName, node.kind === 244 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); @@ -37642,7 +37761,7 @@ var ts; var inAmbientExternalModule = node.parent.kind === 234 && ts.isAmbientModule(node.parent.parent); var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 234 && !node.moduleSpecifier && ts.isInAmbientContext(node); - if (node.parent.kind !== 265 && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + if (node.parent.kind !== 268 && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -37658,7 +37777,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 265 || node.parent.kind === 234 || node.parent.kind === 233; + var isInAppropriateContext = node.parent.kind === 268 || node.parent.kind === 234 || node.parent.kind === 233; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -37681,7 +37800,7 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) { return; } - var container = node.parent.kind === 265 ? node.parent : node.parent.parent; + var container = node.parent.kind === 268 ? node.parent : node.parent.parent; if (container.kind === 233 && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); @@ -37820,24 +37939,24 @@ var ts; case 168: case 170: return checkSourceElement(node.type); - case 277: + case 280: return checkJSDocAugmentsTag(node); - case 283: + case 286: return checkJSDocTypedefTag(node); - case 279: + case 282: return checkJSDocParameterTag(node); - case 273: + case 276: checkSignatureDeclaration(node); + case 277: case 274: + case 273: case 271: - case 270: - case 268: - case 269: + case 272: if (!ts.isInJavaScriptFile(node) && !ts.isInJSDoc(node)) { grammarErrorOnNode(node, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); } return; - case 267: + case 270: return checkSourceElement(node.type); case 171: return checkIndexedAccessType(node); @@ -38199,10 +38318,10 @@ var ts; return entityNameSymbol; } } - if (entityName.parent.kind === 279) { + if (entityName.parent.kind === 282) { return ts.getParameterSymbolFromJSDoc(entityName.parent); } - if (entityName.parent.kind === 145 && entityName.parent.parent.kind === 282) { + if (entityName.parent.kind === 145 && entityName.parent.parent.kind === 285) { ts.Debug.assert(!ts.isInJavaScriptFile(entityName)); var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent); return typeParameter && typeParameter.symbol; @@ -38235,7 +38354,7 @@ var ts; var meaning = entityName.parent.kind === 159 ? 793064 : 1920; return resolveEntityName(entityName, meaning, false, true); } - else if (entityName.parent.kind === 253) { + else if (entityName.parent.kind === 256) { return getJsxAttributePropertySymbol(entityName.parent); } if (entityName.parent.kind === 158) { @@ -38244,7 +38363,7 @@ var ts; return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 265) { + if (node.kind === 268) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } if (isInsideWithStatementBody(node)) { @@ -38316,7 +38435,7 @@ var ts; } } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 262) { + if (location && location.kind === 265) { return resolveEntityName(location.name, 107455 | 2097152); } return undefined; @@ -38384,7 +38503,7 @@ var ts; var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } - if (expr.parent.kind === 261) { + if (expr.parent.kind === 264) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); } @@ -38499,7 +38618,7 @@ var ts; } var parentSymbol_1 = getParentOfSymbol(symbol); if (parentSymbol_1) { - if (parentSymbol_1.flags & 512 && parentSymbol_1.valueDeclaration.kind === 265) { + if (parentSymbol_1.flags & 512 && parentSymbol_1.valueDeclaration.kind === 268) { var symbolFile = parentSymbol_1.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); var symbolIsUmdExport = symbolFile !== referenceFile; @@ -38588,7 +38707,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(node) { node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 265 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 268 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); @@ -38647,7 +38766,7 @@ var ts; } function canHaveConstantValue(node) { switch (node.kind) { - case 264: + case 267: case 179: case 180: return true; @@ -38655,7 +38774,7 @@ var ts; return false; } function getConstantValue(node) { - if (node.kind === 264) { + if (node.kind === 267) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -38891,7 +39010,7 @@ var ts; break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 265 && current.flags & 512) { + if (current.valueDeclaration && current.valueDeclaration.kind === 268 && current.flags & 512) { return false; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { @@ -38910,7 +39029,7 @@ var ts; if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 265); + return ts.getDeclarationOfKind(moduleSymbol, 268); } function initializeTypeChecker() { for (var _i = 0, _a = host.getSourceFiles(); _i < _a.length; _i++) { @@ -39072,7 +39191,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 234 || node.parent.kind === 265) { + else if (node.parent.kind === 234 || node.parent.kind === 268) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128) { @@ -39095,7 +39214,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 234 || node.parent.kind === 265) { + else if (node.parent.kind === 234 || node.parent.kind === 268) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } else if (node.kind === 146) { @@ -39139,7 +39258,7 @@ var ts; flags |= 1; break; case 79: - var container = node.parent.kind === 265 ? node.parent : node.parent.parent; + var container = node.parent.kind === 268 ? node.parent : node.parent.parent; if (container.kind === 233 && !ts.isAmbientModule(container)) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } @@ -39257,7 +39376,7 @@ var ts; case 146: return false; default: - if (node.parent.kind === 234 || node.parent.kind === 265) { + if (node.parent.kind === 234 || node.parent.kind === 268) { return false; } switch (node.kind) { @@ -39515,14 +39634,14 @@ var ts; var GetOrSetAccessor = GetAccessor | SetAccessor; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 263) { + if (prop.kind === 266) { continue; } var name = prop.name; if (name.kind === 144) { checkGrammarComputedPropertyName(name); } - if (prop.kind === 262 && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 265 && !inDestructuring && prop.objectAssignmentInitializer) { return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); } if (prop.modifiers) { @@ -39534,7 +39653,7 @@ var ts; } } var currentKind = void 0; - if (prop.kind === 261 || prop.kind === 262) { + if (prop.kind === 264 || prop.kind === 265) { checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name.kind === 8) { checkGrammarNumericLiteral(name); @@ -39583,7 +39702,7 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 255) { + if (attr.kind === 258) { continue; } var jsxAttr = attr; @@ -39595,7 +39714,7 @@ var ts; return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 256 && !initializer.expression) { + if (initializer && initializer.kind === 259 && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -39987,7 +40106,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 207 || node.parent.kind === 234 || node.parent.kind === 265) { + if (node.parent.kind === 207 || node.parent.kind === 234 || node.parent.kind === 268) { var links_1 = getNodeLinks(node.parent); if (!links_1.hasReportedStatementInAmbientContext) { return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -40006,7 +40125,7 @@ var ts; else if (ts.isChildOfNodeWithKind(node, 173)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 264)) { + else if (ts.isChildOfNodeWithKind(node, 267)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -41877,8 +41996,24 @@ var ts; : node; } ts.updateJsxClosingElement = updateJsxClosingElement; - function createJsxAttribute(name, initializer) { + function createJsxFragment(openingFragment, children, closingFragment) { var node = createSynthesizedNode(253); + node.openingFragment = openingFragment; + node.children = createNodeArray(children); + node.closingFragment = closingFragment; + return node; + } + ts.createJsxFragment = createJsxFragment; + function updateJsxFragment(node, openingFragment, children, closingFragment) { + return node.openingFragment !== openingFragment + || node.children !== children + || node.closingFragment !== closingFragment + ? updateNode(createJsxFragment(openingFragment, children, closingFragment), node) + : node; + } + ts.updateJsxFragment = updateJsxFragment; + function createJsxAttribute(name, initializer) { + var node = createSynthesizedNode(256); node.name = name; node.initializer = initializer; return node; @@ -41892,7 +42027,7 @@ var ts; } ts.updateJsxAttribute = updateJsxAttribute; function createJsxAttributes(properties) { - var node = createSynthesizedNode(254); + var node = createSynthesizedNode(257); node.properties = createNodeArray(properties); return node; } @@ -41904,7 +42039,7 @@ var ts; } ts.updateJsxAttributes = updateJsxAttributes; function createJsxSpreadAttribute(expression) { - var node = createSynthesizedNode(255); + var node = createSynthesizedNode(258); node.expression = expression; return node; } @@ -41916,7 +42051,7 @@ var ts; } ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; function createJsxExpression(dotDotDotToken, expression) { - var node = createSynthesizedNode(256); + var node = createSynthesizedNode(259); node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; @@ -41929,7 +42064,7 @@ var ts; } ts.updateJsxExpression = updateJsxExpression; function createCaseClause(expression, statements) { - var node = createSynthesizedNode(257); + var node = createSynthesizedNode(260); node.expression = ts.parenthesizeExpressionForList(expression); node.statements = createNodeArray(statements); return node; @@ -41943,7 +42078,7 @@ var ts; } ts.updateCaseClause = updateCaseClause; function createDefaultClause(statements) { - var node = createSynthesizedNode(258); + var node = createSynthesizedNode(261); node.statements = createNodeArray(statements); return node; } @@ -41955,7 +42090,7 @@ var ts; } ts.updateDefaultClause = updateDefaultClause; function createHeritageClause(token, types) { - var node = createSynthesizedNode(259); + var node = createSynthesizedNode(262); node.token = token; node.types = createNodeArray(types); return node; @@ -41968,7 +42103,7 @@ var ts; } ts.updateHeritageClause = updateHeritageClause; function createCatchClause(variableDeclaration, block) { - var node = createSynthesizedNode(260); + var node = createSynthesizedNode(263); node.variableDeclaration = ts.isString(variableDeclaration) ? createVariableDeclaration(variableDeclaration) : variableDeclaration; node.block = block; return node; @@ -41982,7 +42117,7 @@ var ts; } ts.updateCatchClause = updateCatchClause; function createPropertyAssignment(name, initializer) { - var node = createSynthesizedNode(261); + var node = createSynthesizedNode(264); node.name = asName(name); node.questionToken = undefined; node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined; @@ -41997,7 +42132,7 @@ var ts; } ts.updatePropertyAssignment = updatePropertyAssignment; function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - var node = createSynthesizedNode(262); + var node = createSynthesizedNode(265); node.name = asName(name); node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? ts.parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; @@ -42011,7 +42146,7 @@ var ts; } ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment; function createSpreadAssignment(expression) { - var node = createSynthesizedNode(263); + var node = createSynthesizedNode(266); node.expression = expression !== undefined ? ts.parenthesizeExpressionForList(expression) : undefined; return node; } @@ -42023,7 +42158,7 @@ var ts; } ts.updateSpreadAssignment = updateSpreadAssignment; function createEnumMember(name, initializer) { - var node = createSynthesizedNode(264); + var node = createSynthesizedNode(267); node.name = asName(name); node.initializer = initializer && ts.parenthesizeExpressionForList(initializer); return node; @@ -42038,7 +42173,7 @@ var ts; ts.updateEnumMember = updateEnumMember; function updateSourceFileNode(node, statements) { if (node.statements !== statements) { - var updated = createSynthesizedNode(265); + var updated = createSynthesizedNode(268); updated.flags |= node.flags; updated.statements = createNodeArray(statements); updated.endOfFileToken = node.endOfFileToken; @@ -42107,28 +42242,28 @@ var ts; } ts.getMutableClone = getMutableClone; function createNotEmittedStatement(original) { - var node = createSynthesizedNode(287); + var node = createSynthesizedNode(290); node.original = original; setTextRange(node, original); return node; } ts.createNotEmittedStatement = createNotEmittedStatement; function createEndOfDeclarationMarker(original) { - var node = createSynthesizedNode(291); + var node = createSynthesizedNode(294); node.emitNode = {}; node.original = original; return node; } ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker; function createMergeDeclarationMarker(original) { - var node = createSynthesizedNode(290); + var node = createSynthesizedNode(293); node.emitNode = {}; node.original = original; return node; } ts.createMergeDeclarationMarker = createMergeDeclarationMarker; function createPartiallyEmittedExpression(expression, original) { - var node = createSynthesizedNode(288); + var node = createSynthesizedNode(291); node.expression = expression; node.original = original; setTextRange(node, original); @@ -42144,7 +42279,7 @@ var ts; ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; function flattenCommaElements(node) { if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) { - if (node.kind === 289) { + if (node.kind === 292) { return node.elements; } if (ts.isBinaryExpression(node) && node.operatorToken.kind === 26) { @@ -42154,7 +42289,7 @@ var ts; return node; } function createCommaList(elements) { - var node = createSynthesizedNode(289); + var node = createSynthesizedNode(292); node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)); return node; } @@ -42166,7 +42301,7 @@ var ts; } ts.updateCommaList = updateCommaList; function createBundle(sourceFiles) { - var node = ts.createNode(266); + var node = ts.createNode(269); node.sourceFiles = sourceFiles; return node; } @@ -42269,7 +42404,7 @@ var ts; function getOrCreateEmitNode(node) { if (!node.emitNode) { if (ts.isParseTreeNode(node)) { - if (node.kind === 265) { + if (node.kind === 268) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = ts.getSourceFileOfNode(node); @@ -42597,6 +42732,25 @@ var ts; return ts.setTextRange(ts.createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement), undefined, argumentsList), location); } ts.createExpressionForJsxElement = createExpressionForJsxElement; + function createExpressionForJsxFragment(jsxFactoryEntity, reactNamespace, children, parentElement, location) { + var tagName = ts.createPropertyAccess(createReactNamespace(reactNamespace, parentElement), "Fragment"); + var argumentsList = [tagName]; + argumentsList.push(ts.createNull()); + if (children && children.length > 0) { + if (children.length > 1) { + for (var _i = 0, children_2 = children; _i < children_2.length; _i++) { + var child = children_2[_i]; + child.startsOnNewLine = true; + argumentsList.push(child); + } + } + else { + argumentsList.push(children[0]); + } + } + return ts.setTextRange(ts.createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement), undefined, argumentsList), location); + } + ts.createExpressionForJsxFragment = createExpressionForJsxFragment; function getHelperName(name) { return ts.setEmitFlags(ts.createIdentifier(name), 4096 | 2); } @@ -42777,9 +42931,9 @@ var ts; case 153: case 154: return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); - case 261: + case 264: return createExpressionForPropertyAssignment(property, receiver); - case 262: + case 265: return createExpressionForShorthandPropertyAssignment(property, receiver); case 151: return createExpressionForMethodDeclaration(property, receiver); @@ -43202,7 +43356,7 @@ var ts; case 179: node = node.expression; continue; - case 288: + case 291: node = node.expression; continue; } @@ -43232,7 +43386,7 @@ var ts; case 202: case 203: return (kinds & 2) !== 0; - case 288: + case 291: return (kinds & 4) !== 0; } return false; @@ -43276,7 +43430,7 @@ var ts; case 184: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression); case 202: return ts.updateAsExpression(outerExpression, expression, outerExpression.type); case 203: return ts.updateNonNullExpression(outerExpression, expression); - case 288: return ts.updatePartiallyEmittedExpression(outerExpression, expression); + case 291: return ts.updatePartiallyEmittedExpression(outerExpression, expression); } } function isIgnorableParen(node) { @@ -43408,11 +43562,11 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 261: + case 264: return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 262: + case 265: return bindingElement.name; - case 263: + case 266: return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } return undefined; @@ -43432,7 +43586,7 @@ var ts; case 176: return bindingElement.dotDotDotToken; case 198: - case 263: + case 266: return bindingElement; } return undefined; @@ -43448,7 +43602,7 @@ var ts; : propertyName; } break; - case 261: + case 264: if (bindingElement.name) { var propertyName = bindingElement.name; return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) @@ -43456,7 +43610,7 @@ var ts; : propertyName; } break; - case 263: + case 266: return bindingElement.name; } var target = getTargetOfBindingOrAssignmentElement(bindingElement); @@ -43868,34 +44022,36 @@ var ts; case 252: return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); case 253: - return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 254: - return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); - case 255: - return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateJsxFragment(node, visitNode(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingFragment, visitor, ts.isJsxClosingFragment)); case 256: - return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); case 257: - return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); + return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); case 258: - return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); case 259: - return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); + return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); case 260: - return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); + return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); case 261: - return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); + return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); case 262: - return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); + return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); case 263: - return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); case 264: - return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); + return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); case 265: + return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); + case 266: + return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); + case 267: + return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); + case 268: return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); - case 288: + case 291: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); - case 289: + case 292: return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression)); default: return node; @@ -43933,7 +44089,7 @@ var ts; case 209: case 200: case 225: - case 287: + case 290: break; case 143: result = reduceNode(node.left, cbNode, result); @@ -44240,61 +44396,66 @@ var ts; result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingElement, cbNode, result); break; + case 253: + result = reduceNode(node.openingFragment, cbNode, result); + result = ts.reduceLeft(node.children, cbNode, result); + result = reduceNode(node.closingFragment, cbNode, result); + break; case 250: case 251: result = reduceNode(node.tagName, cbNode, result); result = reduceNode(node.attributes, cbNode, result); break; - case 254: + case 257: result = reduceNodes(node.properties, cbNodes, result); break; case 252: result = reduceNode(node.tagName, cbNode, result); break; - case 253: + case 256: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 255: - result = reduceNode(node.expression, cbNode, result); - break; - case 256: - result = reduceNode(node.expression, cbNode, result); - break; - case 257: - result = reduceNode(node.expression, cbNode, result); case 258: - result = reduceNodes(node.statements, cbNodes, result); + result = reduceNode(node.expression, cbNode, result); break; case 259: - result = reduceNodes(node.types, cbNodes, result); + result = reduceNode(node.expression, cbNode, result); break; case 260: - result = reduceNode(node.variableDeclaration, cbNode, result); - result = reduceNode(node.block, cbNode, result); - break; + result = reduceNode(node.expression, cbNode, result); case 261: - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.initializer, cbNode, result); + result = reduceNodes(node.statements, cbNodes, result); break; case 262: - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.objectAssignmentInitializer, cbNode, result); + result = reduceNodes(node.types, cbNodes, result); break; case 263: - result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.variableDeclaration, cbNode, result); + result = reduceNode(node.block, cbNode, result); break; case 264: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; case 265: - result = reduceNodes(node.statements, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; - case 288: + case 266: result = reduceNode(node.expression, cbNode, result); break; - case 289: + case 267: + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + case 268: + result = reduceNodes(node.statements, cbNodes, result); + break; + case 291: + result = reduceNode(node.expression, cbNode, result); + break; + case 292: result = reduceNodes(node.elements, cbNodes, result); break; default: @@ -44965,7 +45126,7 @@ var ts; } function onBeforeVisitNode(node) { switch (node.kind) { - case 265: + case 268: case 235: case 234: case 207: @@ -45131,7 +45292,7 @@ var ts; return visitClassDeclaration(node); case 199: return visitClassExpression(node); - case 259: + case 262: return visitHeritageClause(node); case 201: return visitExpressionWithTypeArguments(node); @@ -46152,7 +46313,7 @@ var ts; function addVarForEnumOrModuleDeclaration(statements, node) { var statement = ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ ts.createVariableDeclaration(ts.getLocalName(node, false, true)) - ], currentScope.kind === 265 ? 0 : 1)); + ], currentScope.kind === 268 ? 0 : 1)); ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { @@ -46402,7 +46563,7 @@ var ts; if ((enabledSubstitutions & 2) === 0) { enabledSubstitutions |= 2; context.enableSubstitution(71); - context.enableSubstitution(262); + context.enableSubstitution(265); context.enableEmitNotification(233); } } @@ -46488,7 +46649,7 @@ var ts; function trySubstituteNamespaceExportedName(node) { if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var container = resolver.getReferencedExportContainer(node, false); - if (container && container.kind !== 265) { + if (container && container.kind !== 268) { var substitute = (applicableSubstitutions & 2 && container.kind === 233) || (applicableSubstitutions & 8 && container.kind === 232); if (substitute) { @@ -46899,7 +47060,7 @@ var ts; return visitExpressionStatement(node); case 185: return visitParenthesizedExpression(node, noDestructuringValue); - case 260: + case 263: return visitCatchClause(node); default: return ts.visitEachChild(node, visitor, context); @@ -46933,7 +47094,7 @@ var ts; var objects = []; for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { var e = elements_3[_i]; - if (e.kind === 263) { + if (e.kind === 266) { if (chunkObject) { objects.push(ts.createObjectLiteral(chunkObject)); chunkObject = undefined; @@ -46945,7 +47106,7 @@ var ts; if (!chunkObject) { chunkObject = []; } - if (e.kind === 261) { + if (e.kind === 264) { var p = e; chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); } @@ -47381,7 +47542,9 @@ var ts; return visitJsxElement(node, false); case 250: return visitJsxSelfClosingElement(node, false); - case 256: + case 253: + return visitJsxFragment(node, false); + case 259: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -47391,12 +47554,14 @@ var ts; switch (node.kind) { case 10: return visitJsxText(node); - case 256: + case 259: return visitJsxExpression(node); case 249: return visitJsxElement(node, true); case 250: return visitJsxSelfClosingElement(node, true); + case 253: + return visitJsxFragment(node, true); default: ts.Debug.failBadSyntaxKind(node); return undefined; @@ -47408,6 +47573,9 @@ var ts; function visitJsxSelfClosingElement(node, isChild) { return visitJsxOpeningLikeElement(node, undefined, isChild, node); } + function visitJsxFragment(node, isChild) { + return visitJsxOpeningFragment(node.openingFragment, node.children, isChild, node); + } function visitJsxOpeningLikeElement(node, children, isChild, location) { var tagName = getTagName(node); var objectProperties; @@ -47433,6 +47601,13 @@ var ts; } return element; } + function visitJsxOpeningFragment(node, children, isChild, location) { + var element = ts.createExpressionForJsxFragment(context.getEmitResolver().getJsxFactoryEntity(), compilerOptions.reactNamespace, ts.mapDefined(children, transformJsxChildToExpression), node, location); + if (isChild) { + ts.startOnNewLine(element); + } + return element; + } function transformJsxSpreadAttributeToExpression(node) { return ts.visitNode(node.expression, visitor, ts.isExpression); } @@ -47449,7 +47624,7 @@ var ts; var decoded = tryDecodeEntities(node.text); return decoded ? ts.setTextRange(ts.createLiteral(decoded), node) : node; } - else if (node.kind === 256) { + else if (node.kind === 259) { if (node.expression === undefined) { return ts.createTrue(); } @@ -48044,9 +48219,9 @@ var ts; return visitExpressionStatement(node); case 178: return visitObjectLiteralExpression(node); - case 260: + case 263: return visitCatchClause(node); - case 262: + case 265: return visitShorthandPropertyAssignment(node); case 144: return visitComputedPropertyName(node); @@ -49349,10 +49524,10 @@ var ts; case 151: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 261: + case 264: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 262: + case 265: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -50713,7 +50888,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 258 && defaultClauseIndex === -1) { + if (clause.kind === 261 && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -50723,7 +50898,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 257) { + if (clause.kind === 260) { var caseClause = clause; if (containsYield(caseClause.expression) && pendingClauses.length > 0) { break; @@ -51536,7 +51711,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; context.enableSubstitution(179); - context.enableSubstitution(261); + context.enableSubstitution(264); return transformSourceFile; function transformSourceFile(node) { return node; @@ -51613,8 +51788,8 @@ var ts; context.enableSubstitution(194); context.enableSubstitution(192); context.enableSubstitution(193); - context.enableSubstitution(262); - context.enableEmitNotification(265); + context.enableSubstitution(265); + context.enableEmitNotification(268); var moduleInfoMap = []; var deferredExports = []; var currentSourceFile; @@ -51795,9 +51970,9 @@ var ts; return visitFunctionDeclaration(node); case 229: return visitClassDeclaration(node); - case 290: + case 293: return visitMergeDeclarationMarker(node); - case 291: + case 294: return visitEndOfDeclarationMarker(node); default: return ts.visitEachChild(node, importCallExpressionVisitor, context); @@ -52206,7 +52381,7 @@ var ts; return node; } function onEmitNode(hint, node, emitCallback) { - if (node.kind === 265) { + if (node.kind === 268) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; noSubstitution = []; @@ -52266,7 +52441,7 @@ var ts; } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 265) { + if (exportContainer && exportContainer.kind === 268) { return ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node)), node); } var importDeclaration = resolver.getReferencedImportDeclaration(node); @@ -52366,7 +52541,7 @@ var ts; context.enableSubstitution(194); context.enableSubstitution(192); context.enableSubstitution(193); - context.enableEmitNotification(265); + context.enableEmitNotification(268); var moduleInfoMap = []; var deferredExports = []; var exportFunctionsMap = []; @@ -52702,7 +52877,7 @@ var ts; } function shouldHoistVariableDeclarationList(node) { return (ts.getEmitFlags(node) & 2097152) === 0 - && (enclosingBlockScopedContainer.kind === 265 + && (enclosingBlockScopedContainer.kind === 268 || (ts.getOriginalNode(node).flags & 3) === 0); } function transformInitializedVariable(node, isExportedDeclaration) { @@ -52884,19 +53059,19 @@ var ts; return visitSwitchStatement(node); case 235: return visitCaseBlock(node); - case 257: + case 260: return visitCaseClause(node); - case 258: + case 261: return visitDefaultClause(node); case 224: return visitTryStatement(node); - case 260: + case 263: return visitCatchClause(node); case 207: return visitBlock(node); - case 290: + case 293: return visitMergeDeclarationMarker(node); - case 291: + case 294: return visitEndOfDeclarationMarker(node); default: return destructuringAndImportCallVisitor(node); @@ -53036,7 +53211,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 265; + return container !== undefined && container.kind === 268; } else { return false; @@ -53051,7 +53226,7 @@ var ts; return node; } function onEmitNode(hint, node, emitCallback) { - if (node.kind === 265) { + if (node.kind === 268) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -53163,7 +53338,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, false); - if (exportContainer && exportContainer.kind === 265) { + if (exportContainer && exportContainer.kind === 268) { exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -53191,7 +53366,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(265); + context.enableEmitNotification(268); context.enableSubstitution(71); var currentSourceFile; return transformSourceFile; @@ -53312,7 +53487,7 @@ var ts; } ts.getTransformers = getTransformers; function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) { - var enabledSyntaxKindFeatures = new Array(292); + var enabledSyntaxKindFeatures = new Array(295); var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentVariableDeclarationsStack = []; @@ -53519,8 +53694,8 @@ var ts; } ts.getDeclarationDiagnostics = getDeclarationDiagnostics; function emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFileOrBundle, emitOnlyDtsFiles) { - var sourceFiles = sourceFileOrBundle.kind === 266 ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; - var isBundledEmit = sourceFileOrBundle.kind === 266; + var sourceFiles = sourceFileOrBundle.kind === 269 ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; + var isBundledEmit = sourceFileOrBundle.kind === 269; var newLine = host.getNewLine(); var compilerOptions = host.getCompilerOptions(); var write; @@ -54030,9 +54205,9 @@ var ts; writeModuleElement(node); } else if (node.kind === 237 || - (node.parent.kind === 265 && isCurrentFileExternalModule)) { + (node.parent.kind === 268 && isCurrentFileExternalModule)) { var isVisible = void 0; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 265) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 268) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -54082,7 +54257,7 @@ var ts; } } function emitModuleElementDeclarationFlags(node) { - if (node.parent.kind === 265) { + if (node.parent.kind === 268) { var modifiers = ts.getModifierFlags(node); if (modifiers & 1) { write("export "); @@ -55022,11 +55197,11 @@ var ts; case 149: case 148: return emitPropertyDeclaration(node); - case 264: + case 267: return emitEnumMemberDeclaration(node); case 243: return emitExportAssignment(node); - case 265: + case 268: return emitSourceFile(node); } } @@ -55045,7 +55220,7 @@ var ts; } return addedBundledEmitReference; function getDeclFileName(emitFileNames, sourceFileOrBundle) { - var isBundledEmit = sourceFileOrBundle.kind === 266; + var isBundledEmit = sourceFileOrBundle.kind === 269; if (isBundledEmit && !addBundledFileReference) { return; } @@ -55059,7 +55234,7 @@ var ts; var emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFileOrBundle, emitOnlyDtsFiles); var emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath) || host.getCompilerOptions().noEmit; if (!emitSkipped) { - var sourceFiles = sourceFileOrBundle.kind === 266 ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; + var sourceFiles = sourceFileOrBundle.kind === 269 ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; var declarationOutput = emitDeclarationResult.referencesOutput + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo); ts.writeFile(host, emitterDiagnostics, declarationFilePath, declarationOutput, host.getCompilerOptions().emitBOM, sourceFiles); @@ -55147,7 +55322,7 @@ var ts; } if (compilerOptions.mapRoot) { sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); - if (sourceFileOrBundle.kind === 265) { + if (sourceFileOrBundle.kind === 268) { sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFileOrBundle, host, sourceMapDir)); } if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { @@ -55254,7 +55429,7 @@ var ts; source = undefined; if (source) setSourceFile(source); - if (node.kind !== 287 + if (node.kind !== 290 && (emitFlags & 16) === 0 && pos >= 0) { emitPos(skipSourceTrivia(pos)); @@ -55271,7 +55446,7 @@ var ts; } if (source) setSourceFile(source); - if (node.kind !== 287 + if (node.kind !== 290 && (emitFlags & 32) === 0 && end >= 0) { emitPos(end); @@ -55413,7 +55588,7 @@ var ts; if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 287; + var isEmittedNode = node.kind !== 290; var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0 || node.kind === 10; var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0 || node.kind === 10; if (!skipLeadingComments) { @@ -55737,7 +55912,7 @@ var ts; return ".js"; } function getOriginalSourceFileOrBundle(sourceFileOrBundle) { - if (sourceFileOrBundle.kind === 266) { + if (sourceFileOrBundle.kind === 269) { return ts.updateBundle(sourceFileOrBundle, ts.sameMap(sourceFileOrBundle.sourceFiles, ts.getOriginalSourceFile)); } return ts.getOriginalSourceFile(sourceFileOrBundle); @@ -55803,8 +55978,8 @@ var ts; } } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle) { - var bundle = sourceFileOrBundle.kind === 266 ? sourceFileOrBundle : undefined; - var sourceFile = sourceFileOrBundle.kind === 265 ? sourceFileOrBundle : undefined; + var bundle = sourceFileOrBundle.kind === 269 ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 268 ? sourceFileOrBundle : undefined; var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFileOrBundle); if (bundle) { @@ -55840,7 +56015,7 @@ var ts; } function emitHelpers(node, writeLines) { var helpersEmitted = false; - var bundle = node.kind === 266 ? node : undefined; + var bundle = node.kind === 269 ? node : undefined; if (bundle && moduleKind === ts.ModuleKind.None) { return; } @@ -55913,8 +56088,8 @@ var ts; break; } switch (node.kind) { - case 265: return printFile(node); - case 266: return printBundle(node); + case 268: return printFile(node); + case 269: return printBundle(node); } writeNode(hint, node, sourceFile, beginPrint()); return endPrint(); @@ -56099,7 +56274,7 @@ var ts; return emitTypeReference(node); case 160: return emitFunctionType(node); - case 273: + case 276: return emitJSDocFunctionType(node); case 161: return emitConstructorType(node); @@ -56129,19 +56304,19 @@ var ts; return emitMappedType(node); case 173: return emitLiteralType(node); - case 268: + case 271: write("*"); return; - case 269: + case 272: write("?"); return; - case 270: + case 273: return emitJSDocNullableType(node); - case 271: - return emitJSDocNonNullableType(node); - case 272: - return emitJSDocOptionalType(node); case 274: + return emitJSDocNonNullableType(node); + case 275: + return emitJSDocOptionalType(node); + case 277: return emitJSDocVariadicType(node); case 174: return emitObjectBindingPattern(node); @@ -56240,32 +56415,34 @@ var ts; case 10: return emitJsxText(node); case 251: - return emitJsxOpeningElement(node); - case 252: - return emitJsxClosingElement(node); - case 253: - return emitJsxAttribute(node); case 254: - return emitJsxAttributes(node); + return emitJsxOpeningElementOrFragment(node); + case 252: case 255: - return emitJsxSpreadAttribute(node); + return emitJsxClosingElementOrFragment(node); case 256: - return emitJsxExpression(node); + return emitJsxAttribute(node); case 257: - return emitCaseClause(node); + return emitJsxAttributes(node); case 258: - return emitDefaultClause(node); + return emitJsxSpreadAttribute(node); case 259: - return emitHeritageClause(node); + return emitJsxExpression(node); case 260: - return emitCatchClause(node); + return emitCaseClause(node); case 261: - return emitPropertyAssignment(node); + return emitDefaultClause(node); case 262: - return emitShorthandPropertyAssignment(node); + return emitHeritageClause(node); case 263: - return emitSpreadAssignment(node); + return emitCatchClause(node); case 264: + return emitPropertyAssignment(node); + case 265: + return emitShorthandPropertyAssignment(node); + case 266: + return emitSpreadAssignment(node); + case 267: return emitEnumMember(node); } if (ts.isExpression(node)) { @@ -56353,9 +56530,11 @@ var ts; return emitJsxElement(node); case 250: return emitJsxSelfClosingElement(node); - case 288: + case 253: + return emitJsxFragment(node); + case 291: return emitPartiallyEmittedExpression(node); - case 289: + case 292: return emitCommaList(node); } } @@ -56415,7 +56594,7 @@ var ts; emit(node.name); } emitIfPresent(node.questionToken); - if (node.parent && node.parent.kind === 273 && !node.name) { + if (node.parent && node.parent.kind === 276 && !node.name) { emit(node.type); } else { @@ -57337,21 +57516,30 @@ var ts; } write("/>"); } - function emitJsxOpeningElement(node) { + function emitJsxFragment(node) { + emit(node.openingFragment); + emitList(node, node.children, 131072); + emit(node.closingFragment); + } + function emitJsxOpeningElementOrFragment(node) { write("<"); - emitJsxTagName(node.tagName); - writeIfAny(node.attributes.properties, " "); - if (node.attributes.properties && node.attributes.properties.length > 0) { - emit(node.attributes); + if (ts.isJsxOpeningElement(node)) { + emitJsxTagName(node.tagName); + if (node.attributes.properties && node.attributes.properties.length > 0) { + write(" "); + emit(node.attributes); + } } write(">"); } function emitJsxText(node) { writer.writeLiteral(getTextOfNode(node, true)); } - function emitJsxClosingElement(node) { + function emitJsxClosingElementOrFragment(node) { write(""); } function emitJsxAttributes(node) { @@ -57731,11 +57919,6 @@ var ts; function decreaseIndent() { writer.decreaseIndent(); } - function writeIfAny(nodes, text) { - if (ts.some(nodes)) { - write(text); - } - } function writeToken(token, pos, contextNode) { return onEmitSourceMapOfToken ? onEmitSourceMapOfToken(contextNode, token, pos, writeTokenText) @@ -58165,7 +58348,7 @@ var ts; ListFormat[ListFormat["EnumMembers"] = 81] = "EnumMembers"; ListFormat[ListFormat["CaseBlockClauses"] = 65] = "CaseBlockClauses"; ListFormat[ListFormat["NamedImportsOrExportsElements"] = 432] = "NamedImportsOrExportsElements"; - ListFormat[ListFormat["JsxElementChildren"] = 131072] = "JsxElementChildren"; + ListFormat[ListFormat["JsxElementOrFragmentChildren"] = 131072] = "JsxElementOrFragmentChildren"; ListFormat[ListFormat["JsxElementAttributes"] = 131328] = "JsxElementAttributes"; ListFormat[ListFormat["CaseOrDefaultClauseStatements"] = 81985] = "CaseOrDefaultClauseStatements"; ListFormat[ListFormat["HeritageClauseTypes"] = 272] = "HeritageClauseTypes"; @@ -59480,7 +59663,7 @@ var ts; return; } break; - case 259: + case 262: var heritageClause = node; if (heritageClause.token === 108) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); @@ -61221,7 +61404,7 @@ var ts; var result = {}; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 261) { + if (element.kind !== 264) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); continue; } @@ -62260,8 +62443,8 @@ var ts; case 176: case 149: case 148: - case 261: - case 262: + case 264: + case 265: case 151: case 150: case 152: @@ -62270,17 +62453,17 @@ var ts; case 228: case 186: case 187: - case 260: - case 253: + case 263: + case 256: return 1; case 145: case 230: case 231: case 163: return 2; - case 283: + case 286: return node.name === undefined ? 1 | 2 : 2; - case 264: + case 267: case 229: return 1 | 2; case 233: @@ -62301,14 +62484,14 @@ var ts; case 243: case 244: return 7; - case 265: + case 268: return 4 | 1; } return 7; } ts.getMeaningFromDeclaration = getMeaningFromDeclaration; function getMeaningFromLocation(node) { - if (node.kind === 265) { + if (node.kind === 268) { return 1; } else if (node.parent.kind === 243) { @@ -62374,7 +62557,7 @@ var ts; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 201 && root.parent.parent.kind === 259) { + if (!isLastClause && root.parent.kind === 201 && root.parent.parent.kind === 262) { var decl = root.parent.parent.parent; return (decl.kind === 229 && root.parent.parent.token === 108) || (decl.kind === 230 && root.parent.parent.token === 85); @@ -62461,8 +62644,8 @@ var ts; switch (node.parent.kind) { case 149: case 148: - case 261: case 264: + case 267: case 151: case 150: case 153: @@ -62484,7 +62667,7 @@ var ts; } ts.isExpressionOfExternalModuleImportEqualsDeclaration = isExpressionOfExternalModuleImportEqualsDeclaration; function getContainerNode(node) { - if (node.kind === 283) { + if (node.kind === 286) { node = node.parent.parent; } while (true) { @@ -62493,7 +62676,7 @@ var ts; return undefined; } switch (node.kind) { - case 265: + case 268: case 151: case 150: case 228: @@ -62511,7 +62694,7 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 265: + case 268: return ts.isExternalModule(node) ? "module" : "script"; case 233: return "module"; @@ -62542,7 +62725,7 @@ var ts; case 155: return "call"; case 152: return "constructor"; case 145: return "type parameter"; - case 264: return "enum member"; + case 267: return "enum member"; case 146: return ts.hasModifier(node, 92) ? "property" : "parameter"; case 237: case 242: @@ -62550,7 +62733,7 @@ var ts; case 246: case 240: return "alias"; - case 283: + case 286: return "type"; case 194: var kind = ts.getSpecialPropertyAssignmentKind(node); @@ -62646,7 +62829,7 @@ var ts; case 241: case 245: return nodeEndsWith(n, 18, sourceFile); - case 260: + case 263: return isCompletedNode(n.block, sourceFile); case 182: if (!n.arguments) { @@ -62697,8 +62880,8 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 22, sourceFile); - case 257: - case 258: + case 260: + case 261: return false; case 214: case 215: @@ -62846,8 +63029,8 @@ var ts; return n; } var children = n.getChildren(); - for (var _i = 0, children_2 = children; _i < children_2.length; _i++) { - var child = children_2[_i]; + for (var _i = 0, children_3 = children; _i < children_3.length; _i++) { + var child = children_3[_i]; var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); if (shouldDiveInChildNode && nodeHasTokens(child)) { @@ -62891,7 +63074,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 265 || ts.isJSDocCommentContainingNode(n)); + ts.Debug.assert(startNode !== undefined || n.kind === 268 || ts.isJSDocCommentContainingNode(n)); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate); @@ -62936,10 +63119,10 @@ var ts; if (token.kind === 27 && token.parent.kind === 10) { return true; } - if (token.kind === 27 && token.parent.kind === 256) { + if (token.kind === 27 && token.parent.kind === 259) { return true; } - if (token && token.kind === 18 && token.parent.kind === 256) { + if (token && token.kind === 18 && token.parent.kind === 259) { return true; } if (token.kind === 27 && token.parent.kind === 252) { @@ -63061,7 +63244,7 @@ var ts; node.parent.initializer === node) { return true; } - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 261 ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 264 ? node.parent.parent : node.parent)) { return true; } } @@ -63489,7 +63672,7 @@ var ts; } case 234: return spanInBlock(node); - case 260: + case 263: return spanInBlock(node.block); case 210: return textSpan(node.expression); @@ -63516,8 +63699,8 @@ var ts; return spanInInitializerOfForLike(node); case 221: return textSpanEndingAtNextToken(node, node.expression); - case 257: - case 258: + case 260: + case 261: return spanInNode(node.statements[0]); case 224: return spanInBlock(node.tryBlock); @@ -63537,7 +63720,7 @@ var ts; } case 229: case 232: - case 264: + case 267: case 176: return textSpan(node); case 220: @@ -63584,8 +63767,8 @@ var ts; } if ((node.kind === 71 || node.kind === 198 || - node.kind === 261 || - node.kind === 262) && + node.kind === 264 || + node.kind === 265) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { return textSpan(node); } @@ -63623,7 +63806,7 @@ var ts; break; } } - if (node.parent.kind === 261 && + if (node.parent.kind === 264 && node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); @@ -63807,7 +63990,7 @@ var ts; if (ts.isFunctionBlock(node.parent)) { return textSpan(node); } - case 260: + case 263: return spanInNode(ts.lastOrUndefined(node.parent.statements)); case 235: var caseBlock = node.parent; @@ -63875,7 +64058,7 @@ var ts; } function spanInColonToken(node) { if (ts.isFunctionLike(node.parent) || - node.parent.kind === 261 || + node.parent.kind === 264 || node.parent.kind === 146) { return spanInPreviousNode(node); } @@ -64433,16 +64616,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18); pos = tag.tagName.end; switch (tag.kind) { - case 279: + case 282: processJSDocParameterTag(tag); break; - case 282: + case 285: processJSDocTemplateTag(tag); break; - case 281: + case 284: processElement(tag.typeExpression); break; - case 280: + case 283: processElement(tag.typeExpression); break; } @@ -64538,7 +64721,7 @@ var ts; return 21; } break; - case 253: + case 256: if (token.parent.name === token) { return 22; } @@ -64561,7 +64744,7 @@ var ts; if (token.parent.kind === 226 || token.parent.kind === 149 || token.parent.kind === 146 || - token.parent.kind === 253) { + token.parent.kind === 256) { return 5; } } @@ -64578,7 +64761,7 @@ var ts; return 4; } else if (tokenKind === 9) { - return token.parent.kind === 253 ? 24 : 6; + return token.parent.kind === 256 ? 24 : 6; } else if (tokenKind === 12) { return 6; @@ -65060,7 +65243,7 @@ var ts; if (ts.isInString(sourceFile, position)) { return getStringLiteralCompletionEntries(sourceFile, position, typeChecker, compilerOptions, host, log); } - var completionData = getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, options); + var completionData = getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, options, compilerOptions.target); if (!completionData) { return undefined; } @@ -65123,7 +65306,7 @@ var ts; }); } function createCompletionEntry(symbol, location, performCharacterChecks, typeChecker, target, allowStringLiteral, origin) { - var displayName = getCompletionEntryDisplayNameForSymbol(symbol, target, performCharacterChecks, allowStringLiteral); + var displayName = getCompletionEntryDisplayNameForSymbol(symbol, target, performCharacterChecks, allowStringLiteral, origin); if (!displayName) { return undefined; } @@ -65168,7 +65351,7 @@ var ts; if (!node || node.kind !== 9) { return undefined; } - if (node.parent.kind === 261 && + if (node.parent.kind === 264 && node.parent.parent.kind === 178 && node.parent.name === node) { return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent, typeChecker, compilerOptions.target, log); @@ -65267,7 +65450,7 @@ var ts; } function getSymbolCompletionFromEntryId(typeChecker, log, compilerOptions, sourceFile, position, _a, allSourceFiles) { var name = _a.name, source = _a.source; - var completionData = getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, { includeExternalModuleExports: true }); + var completionData = getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, { includeExternalModuleExports: true }, compilerOptions.target); if (!completionData) { return { type: "none" }; } @@ -65276,13 +65459,17 @@ var ts; return { type: "request", request: request }; } var symbol = ts.find(symbols, function (s) { - return getCompletionEntryDisplayNameForSymbol(s, compilerOptions.target, false, allowStringLiteral) === name - && getSourceFromOrigin(symbolToOriginInfoMap[ts.getSymbolId(s)]) === source; + var origin = symbolToOriginInfoMap[ts.getSymbolId(s)]; + return getCompletionEntryDisplayNameForSymbol(s, compilerOptions.target, false, allowStringLiteral, origin) === name + && getSourceFromOrigin(origin) === source; }); return symbol ? { type: "symbol", symbol: symbol, location: location, symbolToOriginInfoMap: symbolToOriginInfoMap } : { type: "none" }; } - function getCompletionEntryDetails(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles, host, rulesProvider) { - var name = entryId.name, source = entryId.source; + function getSymbolName(symbol, origin, target) { + return origin && origin.isDefaultExport && symbol.name === "default" ? ts.codefix.moduleSymbolToValidIdentifier(origin.moduleSymbol, target) : symbol.name; + } + function getCompletionEntryDetails(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles, host, rulesProvider, getCanonicalFileName) { + var name = entryId.name; var symbolCompletion = getSymbolCompletionFromEntryId(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles); switch (symbolCompletion.type) { case "request": { @@ -65300,10 +65487,10 @@ var ts; } case "symbol": { var symbol = symbolCompletion.symbol, location = symbolCompletion.location, symbolToOriginInfoMap = symbolCompletion.symbolToOriginInfoMap; - var codeActions = getCompletionEntryCodeActions(symbolToOriginInfoMap, symbol, typeChecker, host, compilerOptions, sourceFile, rulesProvider); + var _a = getCompletionEntryCodeActionsAndSourceDisplay(symbolToOriginInfoMap, symbol, typeChecker, host, compilerOptions, sourceFile, rulesProvider, getCanonicalFileName), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; var kindModifiers = ts.SymbolDisplay.getSymbolModifiers(symbol); - var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location, location, 7), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind, tags = _a.tags; - return { name: name, kindModifiers: kindModifiers, kind: symbolKind, displayParts: displayParts, documentation: documentation, tags: tags, codeActions: codeActions, source: source === undefined ? undefined : [ts.textPart(source)] }; + var _b = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location, location, 7), displayParts = _b.displayParts, documentation = _b.documentation, symbolKind = _b.symbolKind, tags = _b.tags; + return { name: name, kindModifiers: kindModifiers, kind: symbolKind, displayParts: displayParts, documentation: documentation, tags: tags, codeActions: codeActions, source: sourceDisplay }; } case "none": { if (ts.some(getKeywordCompletions(0), function (c) { return c.name === name; })) { @@ -65323,31 +65510,33 @@ var ts; } } Completions.getCompletionEntryDetails = getCompletionEntryDetails; - function getCompletionEntryCodeActions(symbolToOriginInfoMap, symbol, checker, host, compilerOptions, sourceFile, rulesProvider) { + function getCompletionEntryCodeActionsAndSourceDisplay(symbolToOriginInfoMap, symbol, checker, host, compilerOptions, sourceFile, rulesProvider, getCanonicalFileName) { var symbolOriginInfo = symbolToOriginInfoMap[ts.getSymbolId(symbol)]; if (!symbolOriginInfo) { - return undefined; + return { codeActions: undefined, sourceDisplay: undefined }; } var moduleSymbol = symbolOriginInfo.moduleSymbol, isDefaultExport = symbolOriginInfo.isDefaultExport; - return ts.codefix.getCodeActionForImport(moduleSymbol, { + var sourceDisplay = [ts.textPart(ts.codefix.getModuleSpecifierForNewImport(sourceFile, moduleSymbol, compilerOptions, getCanonicalFileName, host))]; + var codeActions = ts.codefix.getCodeActionForImport(moduleSymbol, { host: host, checker: checker, newLineCharacter: host.getNewLine(), compilerOptions: compilerOptions, sourceFile: sourceFile, rulesProvider: rulesProvider, - symbolName: symbol.name, - getCanonicalFileName: ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames ? host.useCaseSensitiveFileNames() : false), + symbolName: getSymbolName(symbol, symbolOriginInfo, compilerOptions.target), + getCanonicalFileName: getCanonicalFileName, symbolToken: undefined, kind: isDefaultExport ? 1 : 0, }); + return { sourceDisplay: sourceDisplay, codeActions: codeActions }; } function getCompletionEntrySymbol(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles) { var completion = getSymbolCompletionFromEntryId(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles); return completion.type === "symbol" ? completion.symbol : undefined; } Completions.getCompletionEntrySymbol = getCompletionEntrySymbol; - function getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, options) { + function getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, options, target) { var isJavaScriptFile = ts.isSourceFileJavaScript(sourceFile); var request; var start = ts.timestamp(); @@ -65374,11 +65563,11 @@ var ts; if (tag.tagName.pos <= position && position <= tag.tagName.end) { request = { kind: "JsDocTagName" }; } - if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 267) { + if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 270) { currentToken = ts.getTokenAtPosition(sourceFile, position, true); if (!currentToken || (!ts.isDeclarationName(currentToken) && - (currentToken.parent.kind !== 284 || + (currentToken.parent.kind !== 287 || currentToken.parent.name !== currentToken))) { insideJsDocTagTypeExpression = isCurrentlyEditingNode(tag.typeExpression); } @@ -65506,11 +65695,11 @@ var ts; return { symbols: symbols, isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, allowStringLiteral: allowStringLiteral, isNewIdentifierLocation: isNewIdentifierLocation, location: location, isRightOfDot: (isRightOfDot || isRightOfOpenTag), request: request, keywordFilters: keywordFilters, symbolToOriginInfoMap: symbolToOriginInfoMap }; function isTagWithTypeExpression(tag) { switch (tag.kind) { - case 279: - case 284: - case 280: - case 281: + case 282: + case 287: case 283: + case 284: + case 286: return true; } } @@ -65537,7 +65726,7 @@ var ts; symbols.push(symbol_2); } } - if (!isTypeLocation && symbol.declarations.some(function (d) { return d.kind !== 265 && d.kind !== 233 && d.kind !== 232; })) { + if (!isTypeLocation && symbol.declarations.some(function (d) { return d.kind !== 268 && d.kind !== 233 && d.kind !== 232; })) { addTypeProperties(typeChecker.getTypeOfSymbolAtLocation(symbol, node)); } return; @@ -65607,15 +65796,15 @@ var ts; var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile; if (scopeNode) { isGlobalCompletion = - scopeNode.kind === 265 || + scopeNode.kind === 268 || scopeNode.kind === 196 || - scopeNode.kind === 256 || + scopeNode.kind === 259 || ts.isStatement(scopeNode); } var symbolMeanings = 793064 | 107455 | 1920 | 2097152; symbols = typeChecker.getSymbolsInScope(scopeNode, symbolMeanings); if (options.includeExternalModuleExports) { - getSymbolsFromOtherSourceFileExports(symbols, previousToken && ts.isIdentifier(previousToken) ? previousToken.text : ""); + getSymbolsFromOtherSourceFileExports(symbols, previousToken && ts.isIdentifier(previousToken) ? previousToken.text : "", target); } filterGlobalCompletion(symbols); return true; @@ -65674,7 +65863,7 @@ var ts; return ts.forEach(exportedSymbols, symbolCanBeReferencedAtTypeLocation); } } - function getSymbolsFromOtherSourceFileExports(symbols, tokenText) { + function getSymbolsFromOtherSourceFileExports(symbols, tokenText, target) { var tokenTextLowerCase = tokenText.toLowerCase(); ts.codefix.forEachExternalModule(typeChecker, allSourceFiles, function (moduleSymbol) { if (moduleSymbol === sourceFile.symbol) { @@ -65690,6 +65879,9 @@ var ts; symbol = localSymbol; name = localSymbol.name; } + else { + name = ts.codefix.moduleSymbolToValidIdentifier(moduleSymbol, target); + } } if (symbol.declarations && symbol.declarations.some(function (d) { return ts.isExportSpecifier(d) && !!d.parent.parent.moduleSpecifier; })) { continue; @@ -65978,7 +66170,7 @@ var ts; } } } - if (location && location.kind === 286 && ts.isClassLike(location.parent)) { + if (location && location.kind === 289 && ts.isClassLike(location.parent)) { return location.parent; } return undefined; @@ -66005,28 +66197,28 @@ var ts; case 41: case 71: case 179: - case 254: - case 253: - case 255: + case 257: + case 256: + case 258: if (parent && (parent.kind === 250 || parent.kind === 251)) { return parent; } - else if (parent.kind === 253) { + else if (parent.kind === 256) { return parent.parent.parent; } break; case 9: - if (parent && ((parent.kind === 253) || (parent.kind === 255))) { + if (parent && ((parent.kind === 256) || (parent.kind === 258))) { return parent.parent.parent; } break; case 18: if (parent && - parent.kind === 256 && - parent.parent && parent.parent.kind === 253) { + parent.kind === 259 && + parent.parent && parent.parent.kind === 256) { return parent.parent.parent.parent; } - if (parent && parent.kind === 255) { + if (parent && parent.kind === 258) { return parent.parent.parent; } break; @@ -66056,7 +66248,7 @@ var ts; case 21: return containingNodeKind === 175; case 19: - return containingNodeKind === 260 || + return containingNodeKind === 263 || isFunctionLikeButNotConstructor(containingNodeKind); case 17: return containingNodeKind === 232 || @@ -66167,8 +66359,8 @@ var ts; var existingMemberNames = ts.createUnderscoreEscapedMap(); for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; - if (m.kind !== 261 && - m.kind !== 262 && + if (m.kind !== 264 && + m.kind !== 265 && m.kind !== 176 && m.kind !== 151 && m.kind !== 153 && @@ -66244,7 +66436,7 @@ var ts; if (isCurrentlyEditingNode(attr)) { continue; } - if (attr.kind === 253) { + if (attr.kind === 256) { seenNames.set(attr.name.escapedText, true); } } @@ -66254,8 +66446,8 @@ var ts; return node.getStart() <= position && position <= node.getEnd(); } } - function getCompletionEntryDisplayNameForSymbol(symbol, target, performCharacterChecks, allowStringLiteral) { - var name = symbol.name; + function getCompletionEntryDisplayNameForSymbol(symbol, target, performCharacterChecks, allowStringLiteral, origin) { + var name = getSymbolName(symbol, origin, target); if (!name) return undefined; if (symbol.flags & 1920) { @@ -66551,7 +66743,7 @@ var ts; var child = throwStatement; while (child.parent) { var parent_2 = child.parent; - if (ts.isFunctionBlock(parent_2) || parent_2.kind === 265) { + if (ts.isFunctionBlock(parent_2) || parent_2.kind === 268) { return parent_2; } if (parent_2.kind === 224) { @@ -66623,10 +66815,10 @@ var ts; var container = declaration.parent; switch (container.kind) { case 234: - case 265: + case 268: case 207: - case 257: - case 258: + case 260: + case 261: if (modifierFlag & 128) { return declaration.members.concat([declaration]); } @@ -66671,7 +66863,7 @@ var ts; return container.kind === 229 || container.kind === 199; case 84: case 124: - return container.kind === 234 || container.kind === 265; + return container.kind === 234 || container.kind === 268; case 117: return container.kind === 229 || declaration.kind === 229; default: @@ -67055,7 +67247,7 @@ var ts; } else if (!isAvailableThroughGlobal) { var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration); - ts.Debug.assert(sourceFileLike.kind === 265 || sourceFileLike.kind === 233); + ts.Debug.assert(sourceFileLike.kind === 268 || sourceFileLike.kind === 233); if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) { addIndirectUsers(sourceFileLike); } @@ -67199,7 +67391,7 @@ var ts; for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) { var referencingFile = sourceFiles_4[_i]; var searchSourceFile = searchModuleSymbol.valueDeclaration; - if (searchSourceFile.kind === 265) { + if (searchSourceFile.kind === 268) { for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) { var ref = _b[_a]; if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) { @@ -67244,7 +67436,7 @@ var ts; return map; } function forEachPossibleImportOrExportStatement(sourceFileLike, action) { - return ts.forEach(sourceFileLike.kind === 265 ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { + return ts.forEach(sourceFileLike.kind === 268 ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { return action(statement) || (isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action)); }); } @@ -67397,7 +67589,7 @@ var ts; if (parent.kind === 226) { var p = parent; return p.name !== node ? undefined : - p.parent.kind === 260 ? undefined : p.parent.parent.kind === 208 ? p.parent.parent : undefined; + p.parent.kind === 263 ? undefined : p.parent.parent.kind === 208 ? p.parent.parent : undefined; } else { return parent; @@ -67453,7 +67645,7 @@ var ts; return node.getSourceFile(); } var parent = node.parent; - if (parent.kind === 265) { + if (parent.kind === 268) { return parent; } ts.Debug.assert(parent.kind === 234 && isAmbientModuleDeclaration(parent.parent)); @@ -67500,11 +67692,11 @@ var ts; } FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition; function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node) { - if (node.kind === 265) { + if (node.kind === 268) { return undefined; } var checker = program.getTypeChecker(); - if (node.parent.kind === 262) { + if (node.parent.kind === 265) { var result_5 = []; FindAllReferences.Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_5.push(nodeEntry(node)); }); return result_5; @@ -67538,29 +67730,29 @@ var ts; var info = (function () { switch (def.type) { case "symbol": { - var symbol = def.symbol, node_2 = def.node; - var _a = getDefinitionKindAndDisplayParts(symbol, node_2, checker), displayParts_1 = _a.displayParts, kind_1 = _a.kind; + var symbol = def.symbol, node_3 = def.node; + var _a = getDefinitionKindAndDisplayParts(symbol, node_3, checker), displayParts_1 = _a.displayParts, kind_1 = _a.kind; var name_4 = displayParts_1.map(function (p) { return p.text; }).join(""); - return { node: node_2, name: name_4, kind: kind_1, displayParts: displayParts_1 }; + return { node: node_3, name: name_4, kind: kind_1, displayParts: displayParts_1 }; } case "label": { - var node_3 = def.node; - return { node: node_3, name: node_3.text, kind: "label", displayParts: [ts.displayPart(node_3.text, ts.SymbolDisplayPartKind.text)] }; + var node_4 = def.node; + return { node: node_4, name: node_4.text, kind: "label", displayParts: [ts.displayPart(node_4.text, ts.SymbolDisplayPartKind.text)] }; } case "keyword": { - var node_4 = def.node; - var name_5 = ts.tokenToString(node_4.kind); - return { node: node_4, name: name_5, kind: "keyword", displayParts: [{ text: name_5, kind: "keyword" }] }; + var node_5 = def.node; + var name_5 = ts.tokenToString(node_5.kind); + return { node: node_5, name: name_5, kind: "keyword", displayParts: [{ text: name_5, kind: "keyword" }] }; } case "this": { - var node_5 = def.node; - var symbol = checker.getSymbolAtLocation(node_5); - var displayParts_2 = symbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node_5.getSourceFile(), ts.getContainerNode(node_5), node_5).displayParts; - return { node: node_5, name: "this", kind: "var", displayParts: displayParts_2 }; + var node_6 = def.node; + var symbol = checker.getSymbolAtLocation(node_6); + var displayParts_2 = symbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node_6.getSourceFile(), ts.getContainerNode(node_6), node_6).displayParts; + return { node: node_6, name: "this", kind: "var", displayParts: displayParts_2 }; } case "string": { - var node_6 = def.node; - return { node: node_6, name: node_6.text, kind: "var", displayParts: [ts.displayPart(ts.getTextOfNode(node_6), ts.SymbolDisplayPartKind.stringLiteral)] }; + var node_7 = def.node; + return { node: node_7, name: node_7.text, kind: "var", displayParts: [ts.displayPart(ts.getTextOfNode(node_7), ts.SymbolDisplayPartKind.stringLiteral)] }; } } })(); @@ -67666,7 +67858,7 @@ var ts; (function (Core) { function getReferencedSymbolsForNode(node, program, sourceFiles, cancellationToken, options) { if (options === void 0) { options = {}; } - if (node.kind === 265) { + if (node.kind === 268) { return undefined; } if (!options.implementations) { @@ -67722,7 +67914,7 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; switch (decl.kind) { - case 265: + case 268: break; case 233: references.push({ type: "node", node: decl.name }); @@ -67942,7 +68134,7 @@ var ts; if (scope && scope !== container) { return undefined; } - if (!container || container.kind === 265 && !ts.isExternalOrCommonJsModule(container)) { + if (!container || container.kind === 268 && !ts.isExternalOrCommonJsModule(container)) { return undefined; } scope = container; @@ -68215,7 +68407,7 @@ var ts; if (refNode.kind !== 71) { return; } - if (refNode.parent.kind === 262) { + if (refNode.parent.kind === 265) { getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference); } var containingClass = getContainingClassIfInHeritageClause(refNode); @@ -68273,7 +68465,7 @@ var ts; function getContainingClassIfInHeritageClause(node) { if (node && node.parent) { if (node.kind === 201 - && node.parent.kind === 259 + && node.parent.kind === 262 && ts.isClassLike(node.parent.parent)) { return node.parent.parent; } @@ -68398,7 +68590,7 @@ var ts; staticFlag &= ts.getModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; break; - case 265: + case 268: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } @@ -68410,7 +68602,7 @@ var ts; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 265) { + if (searchSpaceNode.kind === 268) { ts.forEach(sourceFiles, function (sourceFile) { cancellationToken.throwIfCancellationRequested(); possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this"); @@ -68452,8 +68644,8 @@ var ts; result.push(FindAllReferences.nodeEntry(node)); } break; - case 265: - if (container.kind === 265 && !ts.isExternalModule(container)) { + case 268: + if (container.kind === 268 && !ts.isExternalModule(container)) { result.push(FindAllReferences.nodeEntry(node)); } break; @@ -68476,9 +68668,9 @@ var ts; function getReferencesForStringLiteralInFile(sourceFile, searchText, possiblePositions, references) { for (var _i = 0, possiblePositions_4 = possiblePositions; _i < possiblePositions_4.length; _i++) { var position = possiblePositions_4[_i]; - var node_7 = ts.getTouchingWord(sourceFile, position, false); - if (node_7 && node_7.kind === 9 && node_7.text === searchText) { - references.push(FindAllReferences.nodeEntry(node_7, true)); + var node_8 = ts.getTouchingWord(sourceFile, position, false); + if (node_8 && node_8.kind === 9 && node_8.text === searchText) { + references.push(FindAllReferences.nodeEntry(node_8, true)); } } } @@ -68487,7 +68679,7 @@ var ts; var result = [symbol]; var containingObjectLiteralElement = ts.getContainingObjectLiteralElement(location); if (containingObjectLiteralElement) { - if (containingObjectLiteralElement.kind !== 262) { + if (containingObjectLiteralElement.kind !== 265) { var propertySymbol = getPropertySymbolOfDestructuringAssignment(location, checker); if (propertySymbol) { result.push(propertySymbol); @@ -68770,7 +68962,7 @@ var ts; symbol = aliased; } } - if (node.parent.kind === 262) { + if (node.parent.kind === 265) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -69040,7 +69232,7 @@ var ts; forEachUnique(declarations, function (declaration) { for (var _i = 0, _a = ts.getJSDocTags(declaration); _i < _a.length; _i++) { var tag = _a[_i]; - if (tag.kind === 276) { + if (tag.kind === 279) { tags.push({ name: tag.tagName.text, text: tag.comment }); } } @@ -69192,7 +69384,7 @@ var ts; : undefined; return { commentOwner: commentOwner, parameters: parameters_1 }; } - case 265: + case 268: return undefined; case 233: return commentOwner.parent.kind === 233 ? undefined : { commentOwner: commentOwner }; @@ -69335,7 +69527,7 @@ var ts; if (!ts.hasJavaScriptFileExtension(j)) return undefined; var inferredTypingName = ts.removeFileExtension(ts.getBaseFileName(j.toLowerCase())); - var cleanedTypingName = inferredTypingName.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); + var cleanedTypingName = ts.removeMinAndVersionNumbers(inferredTypingName); return safeList.get(cleanedTypingName); }); if (fromFileNames.length) { @@ -69805,7 +69997,7 @@ var ts; if (ts.hasJSDocNodes(node)) { ts.forEach(node.jsDoc, function (jsDoc) { ts.forEach(jsDoc.tags, function (tag) { - if (tag.kind === 283) { + if (tag.kind === 286) { addLeafNode(tag); } }); @@ -69905,7 +70097,7 @@ var ts; case 187: case 199: return getFunctionOrClassName(node); - case 283: + case 286: return getJSDocTypedefTagName(node); default: return undefined; @@ -69923,7 +70115,7 @@ var ts; } } switch (node.kind) { - case 265: + case 268: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" @@ -69945,7 +70137,7 @@ var ts; return "()"; case 157: return "[]"; - case 283: + case 286: return getJSDocTypedefTagName(node); default: return ""; @@ -69990,9 +70182,9 @@ var ts; case 232: case 230: case 233: - case 265: + case 268: case 231: - case 283: + case 286: return true; case 152: case 151: @@ -70013,7 +70205,7 @@ var ts; } switch (navigationBarNodeKind(item.parent)) { case 234: - case 265: + case 268: case 151: case 152: return true; @@ -70091,7 +70283,7 @@ var ts; return !member.name || member.name.kind === 144; } function getNodeSpan(node) { - return node.kind === 265 + return node.kind === 268 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromNode(node, curSourceFile); } @@ -70112,7 +70304,7 @@ var ts; node.parent.operatorToken.kind === 58) { return nodeText(node.parent.left).replace(whiteSpaceRegex, ""); } - else if (node.parent.kind === 261 && node.parent.name) { + else if (node.parent.kind === 264 && node.parent.name) { return nodeText(node.parent.name); } else if (ts.getModifierFlags(node) & 512) { @@ -70264,7 +70456,7 @@ var ts; parent.kind === 211 || parent.kind === 213 || parent.kind === 220 || - parent.kind === 260) { + parent.kind === 263) { addOutliningSpan(parent, openBrace_1, closeBrace_1, autoCollapse(n), true); break; } @@ -71311,7 +71503,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node, position, sourceFile) { - for (var n = node; n.kind !== 265; n = n.parent) { + for (var n = node; n.kind !== 268; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -71708,7 +71900,7 @@ var ts; symbolKind = "enum member"; addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 264) { + if (declaration.kind === 267) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -71809,7 +72001,7 @@ var ts; documentation = symbol.getDocumentationComment(); tags = symbol.getJsDocTags(); if (documentation.length === 0 && symbolFlags & 4) { - if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 265; })) { + if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 268; })) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (!declaration.parent || declaration.parent.kind !== 194) { @@ -71901,7 +72093,7 @@ var ts; return false; } for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { - if (parent.kind === 265 || parent.kind === 234) { + if (parent.kind === 268 || parent.kind === 234) { return false; } } @@ -72085,7 +72277,7 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 253: + case 256: case 251: case 252: case 250: @@ -72692,7 +72884,7 @@ var ts; case 237: case 226: case 146: - case 264: + case 267: case 149: case 148: return context.currentTokenSpan.kind === 58 || context.nextTokenSpan.kind === 58; @@ -72787,7 +72979,7 @@ var ts; case 229: case 233: case 232: - case 260: + case 263: case 234: case 221: return true; @@ -72811,7 +73003,7 @@ var ts; case 224: case 212: case 220: - case 260: + case 263: return true; default: return false; @@ -72845,13 +73037,13 @@ var ts; return context.contextNode.kind !== 249; }; Rules.IsJsxExpressionContext = function (context) { - return context.contextNode.kind === 256; + return context.contextNode.kind === 259; }; Rules.IsNextTokenParentJsxAttribute = function (context) { - return context.nextTokenParent.kind === 253; + return context.nextTokenParent.kind === 256; }; Rules.IsJsxAttributeContext = function (context) { - return context.contextNode.kind === 253; + return context.contextNode.kind === 256; }; Rules.IsJsxSelfClosingElementContext = function (context) { return context.contextNode.kind === 250; @@ -73299,11 +73491,11 @@ var ts; case 233: var body = parent.body; return body && body.kind === 234 && ts.rangeContainsRange(body.statements, node); - case 265: + case 268: case 207: case 234: return ts.rangeContainsRange(parent.statements, node); - case 260: + case 263: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -74203,7 +74395,7 @@ var ts; } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && - (parent.kind === 265 || !parentAndChildShareLine); + (parent.kind === 268 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -74394,8 +74586,8 @@ var ts; case 172: case 165: case 235: - case 258: - case 257: + case 261: + case 260: case 185: case 179: case 181: @@ -74409,7 +74601,7 @@ var ts; case 174: case 251: case 250: - case 256: + case 259: case 150: case 155: case 156: @@ -74423,7 +74615,7 @@ var ts; case 241: case 246: case 242: - case 261: + case 264: case 149: return true; } @@ -75389,11 +75581,11 @@ var ts; if (!ts.isStringLiteral(token)) { throw ts.Debug.fail(); } - var action = tryGetCodeActionForInstallPackageTypes(context.host, token.text); + var action = tryGetCodeActionForInstallPackageTypes(context.host, sourceFile.fileName, token.text); return action && [action]; }, }); - function tryGetCodeActionForInstallPackageTypes(host, moduleName) { + function tryGetCodeActionForInstallPackageTypes(host, fileName, moduleName) { var packageName = ts.getPackageName(moduleName).packageName; if (!host.isKnownTypesPackageName(packageName)) { return undefined; @@ -75402,7 +75594,7 @@ var ts; return { description: "Install '" + typesPackageName + "'", changes: [], - commands: [{ type: "install package", packageName: typesPackageName }], + commands: [{ type: "install package", file: fileName, packageName: typesPackageName }], }; } codefix.tryGetCodeActionForInstallPackageTypes = tryGetCodeActionForInstallPackageTypes; @@ -75784,7 +75976,7 @@ var ts; var original = ts.getTextOfNode(jsdocType); var type = checker.getTypeFromTypeNode(jsdocType); var actions = [createAction(jsdocType, sourceFile.fileName, original, checker.typeToString(type, undefined, 8))]; - if (jsdocType.kind === 270) { + if (jsdocType.kind === 273) { var replacementWithUndefined = checker.typeToString(checker.getNullableType(type, 2048), undefined, 8); actions.push(createAction(jsdocType, sourceFile.fileName, original, replacementWithUndefined)); } @@ -75972,9 +76164,11 @@ var ts; return parent; case 248: return parent.parent; - default: - ts.Debug.assert(parent.kind === 244); + case 244: + case 181: return undefined; + default: + ts.Debug.fail(); } } function getCodeActionForNewImport(context, moduleSpecifier) { @@ -76021,6 +76215,7 @@ var ts; options.rootDirs && tryGetModuleNameFromRootDirs(options.rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName) || ts.removeFileExtension(getRelativePath(moduleFileName, sourceDirectory, getCanonicalFileName)); } + codefix.getModuleSpecifierForNewImport = getModuleSpecifierForNewImport; function tryGetModuleNameFromAmbientModule(moduleSymbol) { var decl = moduleSymbol.valueDeclaration; if (ts.isModuleDeclaration(decl) && ts.isStringLiteral(decl.name)) { @@ -76286,8 +76481,9 @@ var ts; var defaultExport = checker.tryGetMemberInModuleExports("default", moduleSymbol); if (defaultExport) { var localSymbol = ts.getLocalSymbolForExportDefault(defaultExport); - if (localSymbol && localSymbol.escapedName === symbolName && checkSymbolHasMeaning(localSymbol, currentTokenMeaning)) { - var symbolId = ts.getUniqueSymbolId(localSymbol, checker); + if ((localSymbol && localSymbol.escapedName === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, context.compilerOptions.target) === symbolName) + && checkSymbolHasMeaning(localSymbol || defaultExport, currentTokenMeaning)) { + var symbolId = ts.getUniqueSymbolId(localSymbol || defaultExport, checker); symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol, __assign({}, context, { kind: 1 }))); } } @@ -76316,6 +76512,35 @@ var ts; } } codefix.forEachExternalModule = forEachExternalModule; + function moduleSymbolToValidIdentifier(moduleSymbol, target) { + return moduleSpecifierToValidIdentifier(ts.removeFileExtension(ts.getBaseFileName(moduleSymbol.name)), target); + } + codefix.moduleSymbolToValidIdentifier = moduleSymbolToValidIdentifier; + function moduleSpecifierToValidIdentifier(moduleSpecifier, target) { + var res = ""; + var lastCharWasValid = true; + var firstCharCode = moduleSpecifier.charCodeAt(0); + if (ts.isIdentifierStart(firstCharCode, target)) { + res += String.fromCharCode(firstCharCode); + } + else { + lastCharWasValid = false; + } + for (var i = 1; i < moduleSpecifier.length; i++) { + var ch = moduleSpecifier.charCodeAt(i); + var isValid = ts.isIdentifierPart(ch, target); + if (isValid) { + var char = String.fromCharCode(ch); + if (!lastCharWasValid) { + char = char.toUpperCase(); + } + res += char; + } + lastCharWasValid = isValid; + } + var token = ts.stringToToken(res); + return token === undefined || !ts.isNonContextualKeyword(token) ? res || "_" : "_" + res; + } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); var ts; @@ -76832,8 +77057,8 @@ var ts; case 194: inferTypeFromBinaryExpressionContext(node, node.parent, checker, usageContext); break; - case 257: - case 258: + case 260: + case 261: inferTypeFromSwitchStatementLabelContext(node.parent, checker, usageContext); break; case 181: @@ -77238,18 +77463,18 @@ var ts; return undefined; } switch (node.kind) { - case 268: - case 269: - return ts.createTypeReferenceNode("any", ts.emptyArray); - case 272: - return transformJSDocOptionalType(node); case 271: - return transformJSDocType(node.type); - case 270: - return transformJSDocNullableType(node); + case 272: + return ts.createTypeReferenceNode("any", ts.emptyArray); + case 275: + return transformJSDocOptionalType(node); case 274: - return transformJSDocVariadicType(node); + return transformJSDocType(node.type); case 273: + return transformJSDocNullableType(node); + case 277: + return transformJSDocVariadicType(node); + case 276: return transformJSDocFunctionType(node); case 146: return transformJSDocParameter(node); @@ -77276,7 +77501,7 @@ var ts; } function transformJSDocParameter(node) { var index = node.parent.parameters.indexOf(node); - var isRest = node.type.kind === 274 && index === node.parent.parameters.length - 1; + var isRest = node.type.kind === 277 && index === node.parent.parameters.length - 1; var name = node.name || (isRest ? "rest" : "arg" + index); var dotdotdot = isRest ? ts.createToken(24) : node.dotDotDotToken; return ts.createParameter(node.decorators, node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer); @@ -77793,7 +78018,7 @@ var ts; switch (node.kind) { case 228: case 229: - if (node.parent.kind === 265 && node.parent.externalModuleIndicator === undefined) { + if (node.parent.kind === 268 && node.parent.externalModuleIndicator === undefined) { (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.FunctionWillNotBeVisibleInTheNewScope)); } break; @@ -77813,7 +78038,7 @@ var ts; permittedJumps = 4; } break; - case 257: + case 260: permittedJumps |= 1; break; default: @@ -77905,7 +78130,7 @@ var ts; } if (isScope(current)) { scopes.push(current); - if (current.kind === 265) { + if (current.kind === 268) { return scopes; } } @@ -78815,7 +79040,7 @@ var ts; } function isExtractableExpression(node) { switch (node.parent.kind) { - case 264: + case 267: return false; } switch (node.kind) { @@ -78836,9 +79061,9 @@ var ts; function isBlockLike(node) { switch (node.kind) { case 207: - case 265: + case 268: case 234: - case 257: + case 260: return true; default: return false; @@ -78895,7 +79120,7 @@ var ts; var file = context.file, startPosition = context.startPosition; var node = ts.getTokenAtPosition(file, startPosition, false); if (ts.isStringLiteral(node) && isModuleIdentifier(node) && ts.getResolvedModule(file, node.text) === undefined) { - return ts.codefix.tryGetCodeActionForInstallPackageTypes(context.host, node.text); + return ts.codefix.tryGetCodeActionForInstallPackageTypes(context.host, file.fileName, node.text); } } function isModuleIdentifier(node) { @@ -78976,7 +79201,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(286, nodes.pos, nodes.end, this); + var list = createNode(289, nodes.pos, nodes.end, this); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_9 = nodes; _i < nodes_9.length; _i++) { @@ -78999,9 +79224,9 @@ var ts; return; } if (ts.isJSDocCommentContainingNode(this)) { - var children_3 = []; - this.forEachChild(function (child) { children_3.push(child); }); - this._children = children_3; + var children_4 = []; + this.forEachChild(function (child) { children_4.push(child); }); + this._children = children_4; return; } var children = []; @@ -79053,7 +79278,7 @@ var ts; if (!children.length) { return undefined; } - var child = ts.find(children, function (kid) { return kid.kind < 267 || kid.kind > 285; }); + var child = ts.find(children, function (kid) { return kid.kind < 270 || kid.kind > 288; }); return child.kind < 143 ? child : child.getFirstToken(sourceFile); @@ -79383,7 +79608,7 @@ var ts; visit(decl.initializer); } } - case 264: + case 267: case 149: case 148: addDeclaration(node); @@ -79830,7 +80055,7 @@ var ts; function getCompletionEntryDetails(fileName, position, name, formattingOptions, source) { synchronizeHostData(); var ruleProvider = formattingOptions ? getRuleProvider(formattingOptions) : undefined; - return ts.Completions.getCompletionEntryDetails(program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position, { name: name, source: source }, program.getSourceFiles(), host, ruleProvider); + return ts.Completions.getCompletionEntryDetails(program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position, { name: name, source: source }, program.getSourceFiles(), host, ruleProvider, getCanonicalFileName); } function getCompletionEntrySymbol(fileName, position, name, source) { synchronizeHostData(); @@ -80160,12 +80385,15 @@ var ts; return ts.codefix.getFixes({ errorCode: errorCode, sourceFile: sourceFile, span: span, program: program, newLineCharacter: newLineCharacter, host: host, cancellationToken: cancellationToken, rulesProvider: rulesProvider }); }); } - function applyCodeActionCommand(fileName, action) { - fileName = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + function applyCodeActionCommand(fileName, actionOrUndefined) { + var action = typeof fileName === "string" ? actionOrUndefined : fileName; + return ts.isArray(action) ? Promise.all(action.map(applySingleCodeActionCommand)) : applySingleCodeActionCommand(action); + } + function applySingleCodeActionCommand(action) { switch (action.type) { case "install package": return host.installPackage - ? host.installPackage({ fileName: fileName, packageName: action.packageName }) + ? host.installPackage({ fileName: ts.toPath(action.file, currentDirectory, getCanonicalFileName), packageName: action.packageName }) : Promise.reject("Host does not implement `installPackage`"); default: ts.Debug.fail(); @@ -80368,10 +80596,10 @@ var ts; } function isObjectLiteralElement(node) { switch (node.kind) { - case 253: - case 255: - case 261: - case 262: + case 256: + case 258: + case 264: + case 265: case 151: case 153: case 154: @@ -80388,7 +80616,7 @@ var ts; } case 71: return isObjectLiteralElement(node.parent) && - (node.parent.parent.kind === 178 || node.parent.parent.kind === 254) && + (node.parent.parent.kind === 178 || node.parent.parent.kind === 257) && node.parent.name === node ? node.parent : undefined; } return undefined; @@ -81424,7 +81652,7 @@ var ts; CommandTypes["Completions"] = "completions"; CommandTypes["CompletionsFull"] = "completions-full"; CommandTypes["CompletionDetails"] = "completionEntryDetails"; - CommandTypes["CompletionDetailsFull"] = "completionEntryDetailsFull"; + CommandTypes["CompletionDetailsFull"] = "completionEntryDetails-full"; CommandTypes["CompileOnSaveAffectedFileList"] = "compileOnSaveAffectedFileList"; CommandTypes["CompileOnSaveEmitFile"] = "compileOnSaveEmitFile"; CommandTypes["Configure"] = "configure"; @@ -81688,9 +81916,10 @@ var ts; this.markContainingProjectsAsDirty(); } }; - ScriptInfo.prototype.close = function () { + ScriptInfo.prototype.close = function (fileExists) { + if (fileExists === void 0) { fileExists = true; } this.textStorage.isOpen = false; - if (this.isDynamicOrHasMixedContent()) { + if (this.isDynamicOrHasMixedContent() || !fileExists) { if (this.textStorage.reload("")) { this.markContainingProjectsAsDirty(); } @@ -81848,6 +82077,12 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { + var ConfigFileProgramReloadLevel; + (function (ConfigFileProgramReloadLevel) { + ConfigFileProgramReloadLevel[ConfigFileProgramReloadLevel["None"] = 0] = "None"; + ConfigFileProgramReloadLevel[ConfigFileProgramReloadLevel["Partial"] = 1] = "Partial"; + ConfigFileProgramReloadLevel[ConfigFileProgramReloadLevel["Full"] = 2] = "Full"; + })(ConfigFileProgramReloadLevel = ts.ConfigFileProgramReloadLevel || (ts.ConfigFileProgramReloadLevel = {})); function updateMissingFilePathsWatch(program, missingFileWatches, createMissingFileWatch) { var missingFilePaths = program.getMissingFilePaths(); var newMissingFilePathMap = ts.arrayToSet(missingFilePaths); @@ -82534,6 +82769,10 @@ var ts; return counts.ts === 0 && counts.tsx === 0; } server.allFilesAreJsOrDts = allFilesAreJsOrDts; + function hasNoTypeScriptSource(fileNames) { + return !fileNames.some(function (fileName) { return (ts.fileExtensionIs(fileName, ".ts") && !ts.fileExtensionIs(fileName, ".d.ts")) || ts.fileExtensionIs(fileName, ".tsx"); }); + } + server.hasNoTypeScriptSource = hasNoTypeScriptSource; var UnresolvedImportsMap = (function () { function UnresolvedImportsMap() { this.perFileMap = ts.createMap(); @@ -82667,7 +82906,7 @@ var ts; return ts.addRange(result, this.typingFiles) || ts.emptyArray; }; Project.prototype.getOrCreateScriptInfoAndAttachToProject = function (fileName) { - var scriptInfo = this.projectService.getOrCreateScriptInfoNotOpenedByClient(fileName, this.directoryStructureHost); + var scriptInfo = this.projectService.getOrCreateScriptInfoNotOpenedByClient(fileName, this.currentDirectory, this.directoryStructureHost); if (scriptInfo) { var existingValue = this.rootFilesMap.get(scriptInfo.path); if (existingValue !== scriptInfo && existingValue !== undefined) { @@ -82728,7 +82967,7 @@ var ts; return this.directoryStructureHost.getDirectories(path); }; Project.prototype.toPath = function (fileName) { - return this.projectService.toPath(fileName); + return ts.toPath(fileName, this.currentDirectory, this.projectService.toCanonicalFileName); }; Project.prototype.watchDirectoryOfFailedLookupLocation = function (directory, cb, flags) { return this.projectService.watchDirectory(this.projectService.host, directory, cb, flags, "Directory of Failed lookup locations in module resolution", this); @@ -82955,7 +83194,7 @@ var ts; return this.isRoot(info) || (this.program && this.program.getSourceFileByPath(info.path) !== undefined); }; Project.prototype.containsFile = function (filename, requireOpen) { - var info = this.projectService.getScriptInfoForNormalizedPath(filename); + var info = this.projectService.getScriptInfoForPath(this.toPath(filename)); if (info && (info.isScriptOpen() || !requireOpen)) { return this.containsScriptInfo(info); } @@ -83099,7 +83338,7 @@ var ts; var oldExternalFiles = this.externalFiles || server.emptyArray; this.externalFiles = this.getExternalFiles(); server.enumerateInsertsAndDeletes(this.externalFiles, oldExternalFiles, function (inserted) { - var scriptInfo = _this.projectService.getOrCreateScriptInfoNotOpenedByClient(inserted, _this.directoryStructureHost); + var scriptInfo = _this.projectService.getOrCreateScriptInfoNotOpenedByClient(inserted, _this.currentDirectory, _this.directoryStructureHost); scriptInfo.attachToProject(_this); }, function (removed) { return _this.detachScriptInfoFromProject(removed); }); var elapsed = ts.timestamp() - start; @@ -83131,7 +83370,7 @@ var ts; return this.missingFilesMap && this.missingFilesMap.has(path); }; Project.prototype.getScriptInfoForNormalizedPath = function (fileName) { - var scriptInfo = this.projectService.getScriptInfoForNormalizedPath(fileName); + var scriptInfo = this.projectService.getScriptInfoForPath(this.toPath(fileName)); if (scriptInfo && !scriptInfo.isAttached(this)) { return server.Errors.ThrowProjectDoesNotContainDocument(fileName, this); } @@ -83304,12 +83543,17 @@ var ts; return _this; } ConfiguredProject.prototype.updateGraph = function () { - if (this.pendingReload) { - this.pendingReload = false; - this.projectService.reloadConfiguredProject(this); - return true; + var reloadLevel = this.pendingReload; + this.pendingReload = ts.ConfigFileProgramReloadLevel.None; + switch (reloadLevel) { + case ts.ConfigFileProgramReloadLevel.Partial: + return this.projectService.reloadFileNamesOfConfiguredProject(this); + case ts.ConfigFileProgramReloadLevel.Full: + this.projectService.reloadConfiguredProject(this); + return true; + default: + return _super.prototype.updateGraph.call(this); } - return _super.prototype.updateGraph.call(this); }; ConfiguredProject.prototype.getCachedDirectoryStructureHost = function () { return this.directoryStructureHost; @@ -83499,24 +83743,10 @@ var ts; return this.typeAcquisition; }; ExternalProject.prototype.setTypeAcquisition = function (newTypeAcquisition) { - if (!newTypeAcquisition) { - newTypeAcquisition = { - enable: allRootFilesAreJsOrDts(this), - include: [], - exclude: [] - }; - } - else { - if (newTypeAcquisition.enable === undefined) { - newTypeAcquisition.enable = allRootFilesAreJsOrDts(this); - } - if (!newTypeAcquisition.include) { - newTypeAcquisition.include = []; - } - if (!newTypeAcquisition.exclude) { - newTypeAcquisition.exclude = []; - } - } + ts.Debug.assert(!!newTypeAcquisition, "newTypeAcquisition may not be null/undefined"); + ts.Debug.assert(!!newTypeAcquisition.include, "newTypeAcquisition.include may not be null/undefined"); + ts.Debug.assert(!!newTypeAcquisition.exclude, "newTypeAcquisition.exclude may not be null/undefined"); + ts.Debug.assert(typeof newTypeAcquisition.enable === "boolean", "newTypeAcquisition.enable may not be null/undefined"); this.typeAcquisition = newTypeAcquisition; }; return ExternalProject; @@ -83573,8 +83803,8 @@ var ts; "exclude": [["^", 1, "/.*"]], "types": ["office"] }, - "Minified files": { - "match": /^(.+\.min\.js)$/i, + "References": { + "match": /^(.*\/_references\.js)$/i, "exclude": [["^", 1, "$"]] } }; @@ -83682,10 +83912,12 @@ var ts; this.inferredProjects = []; this.configuredProjects = ts.createMap(); this.openFiles = []; + this.openFilesWithNonRootedDiskPath = ts.createMap(); this.compilerOptionsForInferredProjectsPerProjectRoot = ts.createMap(); this.projectToSizeMap = ts.createMap(); this.configFileExistenceInfoCache = ts.createMap(); this.safelist = defaultTypeSafeList; + this.legacySafelist = {}; this.pendingProjectUpdates = ts.createMap(); this.seenProjects = ts.createMap(); this.host = opts.host; @@ -83704,9 +83936,12 @@ var ts; this.currentDirectory = this.host.getCurrentDirectory(); this.toCanonicalFileName = ts.createGetCanonicalFileName(this.host.useCaseSensitiveFileNames); this.throttledOperations = new server.ThrottledOperations(this.host, this.logger); - if (opts.typesMapLocation) { + if (this.typesMapLocation) { this.loadTypesMap(); } + else { + this.logger.info("No types map provided; using the default"); + } this.typingsInstaller.attach(this); this.typingsCache = new server.TypingsCache(this.typingsInstaller); this.hostConfiguration = { @@ -83777,10 +84012,12 @@ var ts; raw.typesMap[k].match = new RegExp(raw.typesMap[k].match, "i"); } this.safelist = raw.typesMap; + this.legacySafelist = raw.simpleMap; } catch (e) { this.logger.info("Error loading types map: " + e); this.safelist = defaultTypeSafeList; + this.legacySafelist = {}; } }; ProjectService.prototype.updateTypingsForProject = function (response) { @@ -83989,15 +84226,12 @@ var ts; var fileOrDirectoryPath = _this.toPath(fileOrDirectory); project.getCachedDirectoryStructureHost().addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath); var configFilename = project.getConfigFilePath(); - if (fileOrDirectoryPath !== directory && !ts.isSupportedSourceFileName(fileOrDirectory, project.getCompilationSettings(), _this.hostConfiguration.extraFileExtensions)) { + if (fileOrDirectoryPath !== directory && ts.hasExtension(fileOrDirectoryPath) && !ts.isSupportedSourceFileName(fileOrDirectory, project.getCompilationSettings(), _this.hostConfiguration.extraFileExtensions)) { _this.logger.info("Project: " + configFilename + " Detected file add/remove of non supported extension: " + fileOrDirectory); return; } - if (!project.pendingReload) { - var configFileSpecs = project.configFileSpecs; - var result = ts.getFileNamesFromConfigSpecs(configFileSpecs, ts.getDirectoryPath(configFilename), project.getCompilationSettings(), project.getCachedDirectoryStructureHost(), _this.hostConfiguration.extraFileExtensions); - project.updateErrorOnNoInputFiles(result.fileNames.length !== 0); - _this.updateNonInferredProjectFiles(project, result.fileNames, fileNamePropertyReader); + if (project.pendingReload !== ts.ConfigFileProgramReloadLevel.Full) { + project.pendingReload = ts.ConfigFileProgramReloadLevel.Partial; _this.delayUpdateProjectGraphAndInferredProjectsRefresh(project); } }, flags, "Wild card directory", project); @@ -84015,7 +84249,7 @@ var ts; } else { this.logConfigFileWatchUpdate(project.getConfigFilePath(), project.canonicalConfigFilePath, configFileExistenceInfo, "Reloading configured projects for only inferred root files"); - project.pendingReload = true; + project.pendingReload = ts.ConfigFileProgramReloadLevel.Full; this.delayUpdateProjectGraph(project); this.delayReloadConfiguredProjectForFiles(configFileExistenceInfo, true); } @@ -84070,10 +84304,14 @@ var ts; return project; }; ProjectService.prototype.closeOpenFile = function (info) { - info.close(); + var fileExists = this.host.fileExists(info.fileName); + info.close(fileExists); this.stopWatchingConfigFilesForClosedScriptInfo(info); ts.unorderedRemoveItem(this.openFiles, info); - var fileExists = this.host.fileExists(info.fileName); + var canonicalFileName = this.toCanonicalFileName(info.fileName); + if (this.openFilesWithNonRootedDiskPath.get(canonicalFileName) === info) { + this.openFilesWithNonRootedDiskPath.delete(canonicalFileName); + } var projectsToRemove; for (var _i = 0, _a = info.containingProjects; _i < _a.length; _i++) { var p = _a[_i]; @@ -84384,9 +84622,10 @@ var ts; this.projectToSizeMap.set(name, totalNonTsFileSize); return false; }; - ProjectService.prototype.createExternalProject = function (projectFileName, files, options, typeAcquisition) { + ProjectService.prototype.createExternalProject = function (projectFileName, files, options, typeAcquisition, excludedFiles) { var compilerOptions = convertCompilerOptions(options); var project = new server.ExternalProject(projectFileName, this, this.documentRegistry, compilerOptions, !this.exceededTotalSizeLimitForNonTsFiles(projectFileName, compilerOptions, files, externalFilePropertyReader), options.compileOnSave === undefined ? true : options.compileOnSave); + project.excludedFiles = excludedFiles; this.addFilesToNonInferredProjectAndUpdateGraph(project, files, externalFilePropertyReader, typeAcquisition); this.externalProjects.push(project); this.sendProjectTelemetry(projectFileName, project); @@ -84478,7 +84717,7 @@ var ts; else { var scriptKind = propertyReader.getScriptKind(f, this.hostConfiguration.extraFileExtensions); var hasMixedContent = propertyReader.hasMixedContent(f, this.hostConfiguration.extraFileExtensions); - scriptInfo = this.getOrCreateScriptInfoNotOpenedByClientForNormalizedPath(normalizedPath, scriptKind, hasMixedContent, project.directoryStructureHost); + scriptInfo = this.getOrCreateScriptInfoNotOpenedByClientForNormalizedPath(normalizedPath, project.currentDirectory, scriptKind, hasMixedContent, project.directoryStructureHost); path = scriptInfo.path; if (!project.isRoot(scriptInfo)) { project.addRoot(scriptInfo); @@ -84510,6 +84749,14 @@ var ts; } this.addFilesToNonInferredProjectAndUpdateGraph(project, newUncheckedFiles, propertyReader, newTypeAcquisition); }; + ProjectService.prototype.reloadFileNamesOfConfiguredProject = function (project) { + var configFileSpecs = project.configFileSpecs; + var configFileName = project.getConfigFilePath(); + var fileNamesResult = ts.getFileNamesFromConfigSpecs(configFileSpecs, ts.getDirectoryPath(configFileName), project.getCompilationSettings(), project.getCachedDirectoryStructureHost(), this.hostConfiguration.extraFileExtensions); + project.updateErrorOnNoInputFiles(fileNamesResult.fileNames.length !== 0); + this.updateNonInferredProjectFiles(project, fileNamesResult.fileNames, fileNamePropertyReader); + return project.updateGraph(); + }; ProjectService.prototype.reloadConfiguredProject = function (project) { var host = project.getCachedDirectoryStructureHost(); host.clearCache(); @@ -84585,8 +84832,8 @@ var ts; } return project; }; - ProjectService.prototype.getOrCreateScriptInfoNotOpenedByClient = function (uncheckedFileName, hostToQueryFileExistsOn) { - return this.getOrCreateScriptInfoNotOpenedByClientForNormalizedPath(server.toNormalizedPath(uncheckedFileName), undefined, undefined, hostToQueryFileExistsOn); + ProjectService.prototype.getOrCreateScriptInfoNotOpenedByClient = function (uncheckedFileName, currentDirectory, hostToQueryFileExistsOn) { + return this.getOrCreateScriptInfoNotOpenedByClientForNormalizedPath(server.toNormalizedPath(uncheckedFileName), currentDirectory, undefined, undefined, hostToQueryFileExistsOn); }; ProjectService.prototype.getScriptInfo = function (uncheckedFileName) { return this.getScriptInfoForNormalizedPath(server.toNormalizedPath(uncheckedFileName)); @@ -84605,17 +84852,22 @@ var ts; info.fileWatcher = undefined; } }; - ProjectService.prototype.getOrCreateScriptInfoNotOpenedByClientForNormalizedPath = function (fileName, scriptKind, hasMixedContent, hostToQueryFileExistsOn) { - return this.getOrCreateScriptInfoForNormalizedPath(fileName, false, undefined, scriptKind, hasMixedContent, hostToQueryFileExistsOn); + ProjectService.prototype.getOrCreateScriptInfoNotOpenedByClientForNormalizedPath = function (fileName, currentDirectory, scriptKind, hasMixedContent, hostToQueryFileExistsOn) { + return this.getOrCreateScriptInfoWorker(fileName, currentDirectory, false, undefined, scriptKind, hasMixedContent, hostToQueryFileExistsOn); }; - ProjectService.prototype.getOrCreateScriptInfoOpenedByClientForNormalizedPath = function (fileName, fileContent, scriptKind, hasMixedContent, hostToQueryFileExistsOn) { - return this.getOrCreateScriptInfoForNormalizedPath(fileName, true, fileContent, scriptKind, hasMixedContent, hostToQueryFileExistsOn); + ProjectService.prototype.getOrCreateScriptInfoOpenedByClientForNormalizedPath = function (fileName, currentDirectory, fileContent, scriptKind, hasMixedContent) { + return this.getOrCreateScriptInfoWorker(fileName, currentDirectory, true, fileContent, scriptKind, hasMixedContent); }; ProjectService.prototype.getOrCreateScriptInfoForNormalizedPath = function (fileName, openedByClient, fileContent, scriptKind, hasMixedContent, hostToQueryFileExistsOn) { + return this.getOrCreateScriptInfoWorker(fileName, this.currentDirectory, openedByClient, fileContent, scriptKind, hasMixedContent, hostToQueryFileExistsOn); + }; + ProjectService.prototype.getOrCreateScriptInfoWorker = function (fileName, currentDirectory, openedByClient, fileContent, scriptKind, hasMixedContent, hostToQueryFileExistsOn) { ts.Debug.assert(fileContent === undefined || openedByClient, "ScriptInfo needs to be opened by client to be able to set its user defined content"); - var path = server.normalizedPathToPath(fileName, this.currentDirectory, this.toCanonicalFileName); + var path = server.normalizedPathToPath(fileName, currentDirectory, this.toCanonicalFileName); var info = this.getScriptInfoForPath(path); if (!info) { + ts.Debug.assert(ts.isRootedDiskPath(fileName) || openedByClient, "Script info with relative file name can only be open script info"); + ts.Debug.assert(!ts.isRootedDiskPath(fileName) || this.currentDirectory === currentDirectory || !this.openFilesWithNonRootedDiskPath.has(this.toCanonicalFileName(fileName)), "Open script files with non rooted disk path opened with current directory context cannot have same canonical names"); var isDynamic = server.isDynamicFileName(fileName); if (!openedByClient && !isDynamic && !(hostToQueryFileExistsOn || this.host).fileExists(fileName)) { return; @@ -84625,6 +84877,9 @@ var ts; if (!openedByClient) { this.watchClosedScriptInfo(info); } + else if (!ts.isRootedDiskPath(fileName) && currentDirectory !== this.currentDirectory) { + this.openFilesWithNonRootedDiskPath.set(this.toCanonicalFileName(fileName), info); + } } if (openedByClient && !info.isScriptOpen()) { this.stopWatchingScriptInfo(info); @@ -84639,7 +84894,8 @@ var ts; return info; }; ProjectService.prototype.getScriptInfoForNormalizedPath = function (fileName) { - return this.getScriptInfoForPath(server.normalizedPathToPath(fileName, this.currentDirectory, this.toCanonicalFileName)); + return !ts.isRootedDiskPath(fileName) && this.openFilesWithNonRootedDiskPath.get(this.toCanonicalFileName(fileName)) || + this.getScriptInfoForPath(server.normalizedPathToPath(fileName, this.currentDirectory, this.toCanonicalFileName)); }; ProjectService.prototype.getScriptInfoForPath = function (fileName) { return this.filenameToScriptInfo.get(fileName); @@ -84702,7 +84958,7 @@ var ts; } else if (!updatedProjects.has(configFileName)) { if (delayReload) { - project.pendingReload = true; + project.pendingReload = ts.ConfigFileProgramReloadLevel.Full; this.delayUpdateProjectGraph(project); } else { @@ -84753,7 +85009,7 @@ var ts; var configFileName; var sendConfigFileDiagEvent = false; var configFileErrors; - var info = this.getOrCreateScriptInfoOpenedByClientForNormalizedPath(fileName, fileContent, scriptKind, hasMixedContent); + var info = this.getOrCreateScriptInfoOpenedByClientForNormalizedPath(fileName, projectRootPath ? this.getNormalizedAbsolutePath(projectRootPath) : this.currentDirectory, fileContent, scriptKind, hasMixedContent); var project = this.findContainingExternalProject(fileName); if (!project) { configFileName = this.getConfigFileNameForFile(info, projectRootPath); @@ -84915,7 +85171,11 @@ var ts; ProjectService.prototype.applySafeList = function (proj) { var _this = this; var rootFiles = proj.rootFiles, typeAcquisition = proj.typeAcquisition; - var types = (typeAcquisition && typeAcquisition.include) || []; + ts.Debug.assert(!!typeAcquisition, "proj.typeAcquisition should be set by now"); + if (typeAcquisition.enable === false) { + return []; + } + var typeAcqInclude = typeAcquisition.include || (typeAcquisition.include = []); var excludeRules = []; var normalizedNames = rootFiles.map(function (f) { return ts.normalizeSlashes(f.fileName); }); var excludedFiles = []; @@ -84924,12 +85184,12 @@ var ts; for (var _i = 0, normalizedNames_1 = normalizedNames; _i < normalizedNames_1.length; _i++) { var root = normalizedNames_1[_i]; if (rule.match.test(root)) { - this_2.logger.info("Excluding files based on rule " + name); + this_2.logger.info("Excluding files based on rule " + name + " matching file '" + root + "'"); if (rule.types) { for (var _a = 0, _b = rule.types; _a < _b.length; _a++) { var type = _b[_a]; - if (types.indexOf(type) < 0) { - types.push(type); + if (typeAcqInclude.indexOf(type) < 0) { + typeAcqInclude.push(type); } } } @@ -84968,10 +85228,6 @@ var ts; } } } - if (types.length > 0) { - proj.typeAcquisition = proj.typeAcquisition || {}; - proj.typeAcquisition.include = types; - } }; var this_2 = this; for (var _i = 0, _a = Object.keys(this.safelist); _i < _a.length; _i++) { @@ -84985,9 +85241,34 @@ var ts; excludedFiles.push(normalizedNames[i]); } else { - filesToKeep.push(proj.rootFiles[i]); + var exclude = false; + if (typeAcquisition.enable || typeAcquisition.enableAutoDiscovery) { + var baseName = ts.getBaseFileName(normalizedNames[i].toLowerCase()); + if (ts.fileExtensionIs(baseName, "js")) { + var inferredTypingName = ts.removeFileExtension(baseName); + var cleanedTypingName = ts.removeMinAndVersionNumbers(inferredTypingName); + if (this_3.legacySafelist[cleanedTypingName]) { + this_3.logger.info("Excluded '" + normalizedNames[i] + "' because it matched " + cleanedTypingName + " from the legacy safelist"); + excludedFiles.push(normalizedNames[i]); + exclude = true; + var typeName = this_3.legacySafelist[cleanedTypingName]; + if (typeAcqInclude.indexOf(typeName) < 0) { + typeAcqInclude.push(typeName); + } + } + } + } + if (!exclude) { + if (/^.+[\.-]min\.js$/.test(normalizedNames[i])) { + excludedFiles.push(normalizedNames[i]); + } + else { + filesToKeep.push(proj.rootFiles[i]); + } + } } }; + var this_3 = this; for (var i = 0; i < proj.rootFiles.length; i++) { _loop_13(i); } @@ -85000,6 +85281,12 @@ var ts; var typeAcquisition = ts.convertEnableAutoDiscoveryToEnable(proj.typingOptions); proj.typeAcquisition = typeAcquisition; } + proj.typeAcquisition = proj.typeAcquisition || {}; + proj.typeAcquisition.include = proj.typeAcquisition.include || []; + proj.typeAcquisition.exclude = proj.typeAcquisition.exclude || []; + if (proj.typeAcquisition.enable === undefined) { + proj.typeAcquisition.enable = server.hasNoTypeScriptSource(proj.rootFiles.map(function (f) { return f.fileName; })); + } var excludedFiles = this.applySafeList(proj); var tsConfigFiles; var rootFiles = []; @@ -85079,8 +85366,7 @@ var ts; } else { this.externalProjectToConfiguredProjectMap.delete(proj.projectFileName); - var newProj = this.createExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition); - newProj.excludedFiles = excludedFiles; + this.createExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition, excludedFiles); } if (!suppressRefreshOfInferredProjects) { this.ensureProjectStructuresUptoDate(true); @@ -86588,13 +86874,17 @@ var ts; }; Session.prototype.applyCodeActionCommand = function (commandName, requestSeq, args) { var _this = this; - var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; - var output = function (success, message) { return _this.doOutput({}, commandName, requestSeq, success, message); }; - var command = args.command; - project.getLanguageService().applyCodeActionCommand(file, command).then(function (_a) { - var successMessage = _a.successMessage; - output(true, successMessage); - }, function (error) { output(false, error); }); + var commands = args.command; + var _loop_14 = function (command) { + var project = this_4.getFileAndProject(command).project; + var output = function (success, message) { return _this.doOutput({}, commandName, requestSeq, success, message); }; + project.getLanguageService().applyCodeActionCommand(command).then(function (result) { output(true, result.successMessage); }, function (error) { output(false, error); }); + }; + var this_4 = this; + for (var _i = 0, _a = ts.toArray(commands); _i < _a.length; _i++) { + var command = _a[_i]; + _loop_14(command); + } }; Session.prototype.getStartAndEndPosition = function (args, scriptInfo) { var startPosition = undefined, endPosition = undefined; diff --git a/lib/tsserverlibrary.d.ts b/lib/tsserverlibrary.d.ts index ce37e446884..522cfc906c0 100644 --- a/lib/tsserverlibrary.d.ts +++ b/lib/tsserverlibrary.d.ts @@ -313,46 +313,49 @@ declare namespace ts { JsxSelfClosingElement = 250, JsxOpeningElement = 251, JsxClosingElement = 252, - JsxAttribute = 253, - JsxAttributes = 254, - JsxSpreadAttribute = 255, - JsxExpression = 256, - CaseClause = 257, - DefaultClause = 258, - HeritageClause = 259, - CatchClause = 260, - PropertyAssignment = 261, - ShorthandPropertyAssignment = 262, - SpreadAssignment = 263, - EnumMember = 264, - SourceFile = 265, - Bundle = 266, - JSDocTypeExpression = 267, - JSDocAllType = 268, - JSDocUnknownType = 269, - JSDocNullableType = 270, - JSDocNonNullableType = 271, - JSDocOptionalType = 272, - JSDocFunctionType = 273, - JSDocVariadicType = 274, - JSDocComment = 275, - JSDocTag = 276, - JSDocAugmentsTag = 277, - JSDocClassTag = 278, - JSDocParameterTag = 279, - JSDocReturnTag = 280, - JSDocTypeTag = 281, - JSDocTemplateTag = 282, - JSDocTypedefTag = 283, - JSDocPropertyTag = 284, - JSDocTypeLiteral = 285, - SyntaxList = 286, - NotEmittedStatement = 287, - PartiallyEmittedExpression = 288, - CommaListExpression = 289, - MergeDeclarationMarker = 290, - EndOfDeclarationMarker = 291, - Count = 292, + JsxFragment = 253, + JsxOpeningFragment = 254, + JsxClosingFragment = 255, + JsxAttribute = 256, + JsxAttributes = 257, + JsxSpreadAttribute = 258, + JsxExpression = 259, + CaseClause = 260, + DefaultClause = 261, + HeritageClause = 262, + CatchClause = 263, + PropertyAssignment = 264, + ShorthandPropertyAssignment = 265, + SpreadAssignment = 266, + EnumMember = 267, + SourceFile = 268, + Bundle = 269, + JSDocTypeExpression = 270, + JSDocAllType = 271, + JSDocUnknownType = 272, + JSDocNullableType = 273, + JSDocNonNullableType = 274, + JSDocOptionalType = 275, + JSDocFunctionType = 276, + JSDocVariadicType = 277, + JSDocComment = 278, + JSDocTag = 279, + JSDocAugmentsTag = 280, + JSDocClassTag = 281, + JSDocParameterTag = 282, + JSDocReturnTag = 283, + JSDocTypeTag = 284, + JSDocTemplateTag = 285, + JSDocTypedefTag = 286, + JSDocPropertyTag = 287, + JSDocTypeLiteral = 288, + SyntaxList = 289, + NotEmittedStatement = 290, + PartiallyEmittedExpression = 291, + CommaListExpression = 292, + MergeDeclarationMarker = 293, + EndOfDeclarationMarker = 294, + Count = 295, FirstAssignment = 58, LastAssignment = 70, FirstCompoundAssignment = 59, @@ -378,10 +381,10 @@ declare namespace ts { FirstBinaryOperator = 27, LastBinaryOperator = 70, FirstNode = 143, - FirstJSDocNode = 267, - LastJSDocNode = 285, - FirstJSDocTagNode = 276, - LastJSDocTagNode = 285, + FirstJSDocNode = 270, + LastJSDocNode = 288, + FirstJSDocTagNode = 279, + LastJSDocTagNode = 288, } enum NodeFlags { None = 0, @@ -1061,6 +1064,20 @@ declare namespace ts { tagName: JsxTagNameExpression; attributes: JsxAttributes; } + interface JsxFragment extends PrimaryExpression { + kind: SyntaxKind.JsxFragment; + openingFragment: JsxOpeningFragment; + children: NodeArray; + closingFragment: JsxClosingFragment; + } + interface JsxOpeningFragment extends Expression { + kind: SyntaxKind.JsxOpeningFragment; + parent?: JsxFragment; + } + interface JsxClosingFragment extends Expression { + kind: SyntaxKind.JsxClosingFragment; + parent?: JsxFragment; + } interface JsxAttribute extends ObjectLiteralElement { kind: SyntaxKind.JsxAttribute; parent?: JsxAttributes; @@ -1088,7 +1105,7 @@ declare namespace ts { containsOnlyWhiteSpaces: boolean; parent?: JsxElement; } - type JsxChild = JsxText | JsxExpression | JsxElement | JsxSelfClosingElement; + type JsxChild = JsxText | JsxExpression | JsxElement | JsxSelfClosingElement | JsxFragment; interface Statement extends Node { _statementBrand: any; } @@ -3001,6 +3018,9 @@ declare namespace ts { function isJsxSelfClosingElement(node: Node): node is JsxSelfClosingElement; function isJsxOpeningElement(node: Node): node is JsxOpeningElement; function isJsxClosingElement(node: Node): node is JsxClosingElement; + function isJsxFragment(node: Node): node is JsxFragment; + function isJsxOpeningFragment(node: Node): node is JsxOpeningFragment; + function isJsxClosingFragment(node: Node): node is JsxClosingFragment; function isJsxAttribute(node: Node): node is JsxAttribute; function isJsxAttributes(node: Node): node is JsxAttributes; function isJsxSpreadAttribute(node: Node): node is JsxSpreadAttribute; @@ -3500,6 +3520,8 @@ declare namespace ts { function updateJsxOpeningElement(node: JsxOpeningElement, tagName: JsxTagNameExpression, attributes: JsxAttributes): JsxOpeningElement; function createJsxClosingElement(tagName: JsxTagNameExpression): JsxClosingElement; function updateJsxClosingElement(node: JsxClosingElement, tagName: JsxTagNameExpression): JsxClosingElement; + function createJsxFragment(openingFragment: JsxOpeningFragment, children: ReadonlyArray, closingFragment: JsxClosingFragment): JsxFragment; + function updateJsxFragment(node: JsxFragment, openingFragment: JsxOpeningFragment, children: ReadonlyArray, closingFragment: JsxClosingFragment): JsxFragment; function createJsxAttribute(name: Identifier, initializer: StringLiteral | JsxExpression): JsxAttribute; function updateJsxAttribute(node: JsxAttribute, name: Identifier, initializer: StringLiteral | JsxExpression): JsxAttribute; function createJsxAttributes(properties: ReadonlyArray): JsxAttributes; @@ -3945,7 +3967,15 @@ declare namespace ts { isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean; getSpanOfEnclosingComment(fileName: string, position: number, onlyMultiLine: boolean): TextSpan; getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[], formatOptions: FormatCodeSettings): CodeAction[]; + applyCodeActionCommand(action: CodeActionCommand): Promise; + applyCodeActionCommand(action: CodeActionCommand[]): Promise; + applyCodeActionCommand(action: CodeActionCommand | CodeActionCommand[]): Promise; + /** @deprecated `fileName` will be ignored */ applyCodeActionCommand(fileName: string, action: CodeActionCommand): Promise; + /** @deprecated `fileName` will be ignored */ + applyCodeActionCommand(fileName: string, action: CodeActionCommand[]): Promise; + /** @deprecated `fileName` will be ignored */ + applyCodeActionCommand(fileName: string, action: CodeActionCommand | CodeActionCommand[]): Promise; getApplicableRefactors(fileName: string, positionOrRaneg: number | TextRange): ApplicableRefactorInfo[]; getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string): RefactorEditInfo | undefined; getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput; @@ -5238,7 +5268,8 @@ declare namespace ts.server.protocol { */ errorCodes?: number[]; } - interface ApplyCodeActionCommandRequestArgs extends FileRequestArgs { + interface ApplyCodeActionCommandRequestArgs { + /** May also be an array of commands. */ command: {}; } /** @@ -7031,7 +7062,7 @@ declare namespace ts.server { constructor(host: ServerHost, fileName: NormalizedPath, scriptKind: ScriptKind, hasMixedContent: boolean, path: Path); isScriptOpen(): boolean; open(newText: string): void; - close(): void; + close(fileExists?: boolean): void; getSnapshot(): IScriptSnapshot; getFormatCodeSettings(): FormatCodeSettings; attachToProject(project: Project): boolean; @@ -7399,7 +7430,9 @@ declare namespace ts.server { } interface TypesMapFile { typesMap: SafeList; - simpleMap: string[]; + simpleMap: { + [libName: string]: string; + }; } function convertFormatOptions(protocolOptions: protocol.FormatCodeSettings): FormatCodeSettings; function convertCompilerOptions(protocolOptions: protocol.ExternalProjectCompilerOptions): CompilerOptions & protocol.CompileOnSaveMixin; @@ -7459,6 +7492,10 @@ declare namespace ts.server { * list of open files */ readonly openFiles: ScriptInfo[]; + /** + * Map of open files that are opened without complete path but have projectRoot as current directory + */ + private readonly openFilesWithNonRootedDiskPath; private compilerOptionsForInferredProjects; private compilerOptionsForInferredProjectsPerProjectRoot; /** @@ -7476,6 +7513,7 @@ declare namespace ts.server { private readonly throttledOperations; private readonly hostConfiguration; private safelist; + private legacySafelist; private changedFiles; private pendingProjectUpdates; private pendingInferredProjectUpdate; @@ -7584,7 +7622,7 @@ declare namespace ts.server { private findExternalProjectByProjectName(projectFileName); private convertConfigFileContentToProjectOptions(configFilename, cachedDirectoryStructureHost); private exceededTotalSizeLimitForNonTsFiles(name, options, fileNames, propertyReader); - private createExternalProject(projectFileName, files, options, typeAcquisition); + private createExternalProject(projectFileName, files, options, typeAcquisition, excludedFiles); private sendProjectTelemetry(projectKey, project, projectOptions?); private addFilesToNonInferredProjectAndUpdateGraph(project, files, propertyReader, typeAcquisition); private createConfiguredProject(configFileName); @@ -7598,6 +7636,10 @@ declare namespace ts.server { private watchClosedScriptInfo(info); private stopWatchingScriptInfo(info); getOrCreateScriptInfoForNormalizedPath(fileName: NormalizedPath, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, hostToQueryFileExistsOn?: DirectoryStructureHost): ScriptInfo; + private getOrCreateScriptInfoWorker(fileName, currentDirectory, openedByClient, fileContent?, scriptKind?, hasMixedContent?, hostToQueryFileExistsOn?); + /** + * This gets the script info for the normalized path. If the path is not rooted disk path then the open script info with project root context is preferred + */ getScriptInfoForNormalizedPath(fileName: NormalizedPath): ScriptInfo; getScriptInfoForPath(fileName: Path): ScriptInfo; setHostConfiguration(args: protocol.ConfigureRequestArguments): void; diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index d2645931a9a..e279d2020df 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -313,56 +313,59 @@ var ts; SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 250] = "JsxSelfClosingElement"; SyntaxKind[SyntaxKind["JsxOpeningElement"] = 251] = "JsxOpeningElement"; SyntaxKind[SyntaxKind["JsxClosingElement"] = 252] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 253] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxAttributes"] = 254] = "JsxAttributes"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 255] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 256] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxFragment"] = 253] = "JsxFragment"; + SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 254] = "JsxOpeningFragment"; + SyntaxKind[SyntaxKind["JsxClosingFragment"] = 255] = "JsxClosingFragment"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 256] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxAttributes"] = 257] = "JsxAttributes"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 258] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 259] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 257] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 258] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 259] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 260] = "CatchClause"; + SyntaxKind[SyntaxKind["CaseClause"] = 260] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 261] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 262] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 263] = "CatchClause"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 261] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 262] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 263] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 264] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 265] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 266] = "SpreadAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 264] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 267] = "EnumMember"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 265] = "SourceFile"; - SyntaxKind[SyntaxKind["Bundle"] = 266] = "Bundle"; + SyntaxKind[SyntaxKind["SourceFile"] = 268] = "SourceFile"; + SyntaxKind[SyntaxKind["Bundle"] = 269] = "Bundle"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 267] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 270] = "JSDocTypeExpression"; // The * type - SyntaxKind[SyntaxKind["JSDocAllType"] = 268] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 271] = "JSDocAllType"; // The ? type - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 269] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 270] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 271] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 272] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 273] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 274] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocComment"] = 275] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocTag"] = 276] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 277] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocClassTag"] = 278] = "JSDocClassTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 279] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 280] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 281] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 282] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 283] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 284] = "JSDocPropertyTag"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 285] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 272] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 273] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 274] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 275] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 276] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 277] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 278] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTag"] = 279] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 280] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocClassTag"] = 281] = "JSDocClassTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 282] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 283] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 284] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 285] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 286] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 287] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 288] = "JSDocTypeLiteral"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 286] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 289] = "SyntaxList"; // Transformation nodes - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 287] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 288] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["CommaListExpression"] = 289] = "CommaListExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 290] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 291] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 290] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 291] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["CommaListExpression"] = 292] = "CommaListExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 293] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 294] = "EndOfDeclarationMarker"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 292] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 295] = "Count"; // Markers SyntaxKind[SyntaxKind["FirstAssignment"] = 58] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 70] = "LastAssignment"; @@ -389,10 +392,12 @@ var ts; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 27] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 70] = "LastBinaryOperator"; SyntaxKind[SyntaxKind["FirstNode"] = 143] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 267] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 285] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 276] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 285] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 270] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 288] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 279] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 288] = "LastJSDocTagNode"; + /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 117] = "FirstContextualKeyword"; + /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 142] = "LastContextualKeyword"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); var NodeFlags; (function (NodeFlags) { @@ -2513,6 +2518,10 @@ var ts; return Array.isArray ? Array.isArray(value) : value instanceof Array; } ts.isArray = isArray; + function toArray(value) { + return isArray(value) ? value : [value]; + } + ts.toArray = toArray; /** * Tests whether a value is string */ @@ -3555,6 +3564,16 @@ var ts; return (removeFileExtension(path) + newExtension); } ts.changeExtension = changeExtension; + /** + * Takes a string like "jquery-min.4.2.3" and returns "jquery" + */ + function removeMinAndVersionNumbers(fileName) { + // Match a "." or "-" followed by a version number or 'min' at the end of the name + var trailingMinOrVersion = /[.-]((min)|(\d+(\.\d+)*))$/; + // The "min" or version may both be present, in either order, so try applying the above twice. + return fileName.replace(trailingMinOrVersion, "").replace(trailingMinOrVersion, ""); + } + ts.removeMinAndVersionNumbers = removeMinAndVersionNumbers; function Symbol(flags, name) { this.flags = flags; this.escapedName = name; @@ -3964,10 +3983,9 @@ var ts; function addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath) { var existingResult = getCachedFileSystemEntries(fileOrDirectoryPath); if (existingResult) { - // This was a folder already present, remove it if this doesnt exist any more - if (!host.directoryExists(fileOrDirectory)) { - cachedReadDirectoryResult.delete(fileOrDirectoryPath); - } + // Just clear the cache for now + // For now just clear the cache, since this could mean that multiple level entries might need to be re-evaluated + clearCache(); } else { // This was earlier a file (hence not in cached directory contents) @@ -3980,8 +3998,14 @@ var ts; fileExists: host.fileExists(fileOrDirectoryPath), directoryExists: host.directoryExists(fileOrDirectoryPath) }; - updateFilesOfFileSystemEntry(parentResult, baseName, fsQueryResult.fileExists); - updateFileSystemEntry(parentResult.directories, baseName, fsQueryResult.directoryExists); + if (fsQueryResult.directoryExists || hasEntry(parentResult.directories, baseName)) { + // Folder added or removed, clear the cache instead of updating the folder and its structure + clearCache(); + } + else { + // No need to update the directory structure, just files + updateFilesOfFileSystemEntry(parentResult, baseName, fsQueryResult.fileExists); + } return fsQueryResult; } } @@ -5394,6 +5418,9 @@ var ts; super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: diag(17011, ts.DiagnosticCategory.Error, "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", "'super' must be called before accessing a property of 'super' in the constructor of a derived class."), _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2: diag(17012, ts.DiagnosticCategory.Error, "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012", "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'?"), Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: diag(17013, ts.DiagnosticCategory.Error, "Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013", "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor."), + JSX_fragment_has_no_corresponding_closing_tag: diag(17014, ts.DiagnosticCategory.Error, "JSX_fragment_has_no_corresponding_closing_tag_17014", "JSX fragment has no corresponding closing tag."), + Expected_corresponding_closing_tag_for_JSX_fragment: diag(17015, ts.DiagnosticCategory.Error, "Expected_corresponding_closing_tag_for_JSX_fragment_17015", "Expected corresponding closing tag for JSX fragment."), + JSX_fragment_is_not_supported_when_using_jsxFactory: diag(17016, ts.DiagnosticCategory.Error, "JSX_fragment_is_not_supported_when_using_jsxFactory_17016", "JSX fragment is not supported when using --jsxFactory"), Circularity_detected_while_resolving_configuration_Colon_0: diag(18000, ts.DiagnosticCategory.Error, "Circularity_detected_while_resolving_configuration_Colon_0_18000", "Circularity detected while resolving configuration: {0}"), A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: diag(18001, ts.DiagnosticCategory.Error, "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", "A path in an 'extends' option must be relative or rooted, but '{0}' is not."), The_files_list_in_config_file_0_is_empty: diag(18002, ts.DiagnosticCategory.Error, "The_files_list_in_config_file_0_is_empty_18002", "The 'files' list in config file '{0}' is empty."), @@ -5569,7 +5596,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 265 /* SourceFile */) { + while (node && node.kind !== 268 /* SourceFile */) { node = node.parent; } return node; @@ -5690,7 +5717,7 @@ var ts; // the syntax list itself considers them as normal trivia. Therefore if we simply skip // trivia for the list, we may have skipped the JSDocComment as well. So we should process its // first child to determine the actual position of its first token. - if (node.kind === 286 /* SyntaxList */ && node._children.length > 0) { + if (node.kind === 289 /* SyntaxList */ && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); @@ -5807,7 +5834,7 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 226 /* VariableDeclaration */ && node.parent.kind === 260 /* CatchClause */; + return node.kind === 226 /* VariableDeclaration */ && node.parent.kind === 263 /* CatchClause */; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { @@ -5833,7 +5860,7 @@ var ts; return node && node.kind === 233 /* ModuleDeclaration */ && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 265 /* SourceFile */ || + return node.kind === 268 /* SourceFile */ || node.kind === 233 /* ModuleDeclaration */ || ts.isFunctionLike(node); } @@ -5850,7 +5877,7 @@ var ts; return false; } switch (node.parent.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: return ts.isExternalModule(node.parent); case 234 /* ModuleBlock */: return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); @@ -5865,9 +5892,9 @@ var ts; /* @internal */ function isBlockScope(node, parentNode) { switch (node.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 235 /* CaseBlock */: - case 260 /* CatchClause */: + case 263 /* CatchClause */: case 233 /* ModuleDeclaration */: case 214 /* ForStatement */: case 215 /* ForInStatement */: @@ -5896,12 +5923,12 @@ var ts; case 157 /* IndexSignature */: case 160 /* FunctionType */: case 161 /* ConstructorType */: - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: case 229 /* ClassDeclaration */: case 199 /* ClassExpression */: case 230 /* InterfaceDeclaration */: case 231 /* TypeAliasDeclaration */: - case 282 /* JSDocTemplateTag */: + case 285 /* JSDocTemplateTag */: case 228 /* FunctionDeclaration */: case 151 /* MethodDeclaration */: case 152 /* Constructor */: @@ -6022,7 +6049,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file @@ -6038,7 +6065,7 @@ var ts; case 230 /* InterfaceDeclaration */: case 233 /* ModuleDeclaration */: case 232 /* EnumDeclaration */: - case 264 /* EnumMember */: + case 267 /* EnumMember */: case 228 /* FunctionDeclaration */: case 186 /* FunctionExpression */: case 151 /* MethodDeclaration */: @@ -6225,11 +6252,11 @@ var ts; case 216 /* ForOfStatement */: case 220 /* WithStatement */: case 221 /* SwitchStatement */: - case 257 /* CaseClause */: - case 258 /* DefaultClause */: + case 260 /* CaseClause */: + case 261 /* DefaultClause */: case 222 /* LabeledStatement */: case 224 /* TryStatement */: - case 260 /* CatchClause */: + case 263 /* CatchClause */: return ts.forEachChild(node, traverse); } } @@ -6297,12 +6324,12 @@ var ts; if (node) { switch (node.kind) { case 176 /* BindingElement */: - case 264 /* EnumMember */: + case 267 /* EnumMember */: case 146 /* Parameter */: - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: case 226 /* VariableDeclaration */: return true; } @@ -6360,7 +6387,7 @@ var ts; ts.isThisTypePredicate = isThisTypePredicate; function getPropertyAssignment(objectLiteral, key, key2) { return ts.filter(objectLiteral.properties, function (property) { - if (property.kind === 261 /* PropertyAssignment */) { + if (property.kind === 264 /* PropertyAssignment */) { var propName = getTextOfPropertyName(property.name); return key === propName || (key2 && key2 === propName); } @@ -6429,7 +6456,7 @@ var ts; case 156 /* ConstructSignature */: case 157 /* IndexSignature */: case 232 /* EnumDeclaration */: - case 265 /* SourceFile */: + case 268 /* SourceFile */: return node; } } @@ -6635,6 +6662,7 @@ var ts; case 200 /* OmittedExpression */: case 249 /* JsxElement */: case 250 /* JsxSelfClosingElement */: + case 253 /* JsxFragment */: case 197 /* YieldExpression */: case 191 /* AwaitExpression */: case 204 /* MetaProperty */: @@ -6665,8 +6693,8 @@ var ts; case 146 /* Parameter */: case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: - case 264 /* EnumMember */: - case 261 /* PropertyAssignment */: + case 267 /* EnumMember */: + case 264 /* PropertyAssignment */: case 176 /* BindingElement */: return parent.initializer === node; case 210 /* ExpressionStatement */: @@ -6676,7 +6704,7 @@ var ts; case 219 /* ReturnStatement */: case 220 /* WithStatement */: case 221 /* SwitchStatement */: - case 257 /* CaseClause */: + case 260 /* CaseClause */: case 223 /* ThrowStatement */: return parent.expression === node; case 214 /* ForStatement */: @@ -6697,9 +6725,9 @@ var ts; case 144 /* ComputedPropertyName */: return node === parent.expression; case 147 /* Decorator */: - case 256 /* JsxExpression */: - case 255 /* JsxSpreadAttribute */: - case 263 /* SpreadAssignment */: + case 259 /* JsxExpression */: + case 258 /* JsxSpreadAttribute */: + case 266 /* SpreadAssignment */: return true; case 201 /* ExpressionWithTypeArguments */: return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent); @@ -6881,8 +6909,8 @@ var ts; case 146 /* Parameter */: case 151 /* MethodDeclaration */: case 150 /* MethodSignature */: - case 262 /* ShorthandPropertyAssignment */: - case 261 /* PropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: + case 264 /* PropertyAssignment */: case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: return node.questionToken !== undefined; @@ -6892,7 +6920,7 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 273 /* JSDocFunctionType */ && + return node.kind === 276 /* JSDocFunctionType */ && node.parameters.length > 0 && node.parameters[0].name && node.parameters[0].name.escapedText === "new"; @@ -6945,7 +6973,7 @@ var ts; // * @returns {number} // */ // var x = function(name) { return name.length; } - if (parent && (parent.kind === 261 /* PropertyAssignment */ || getNestedModuleDeclaration(parent))) { + if (parent && (parent.kind === 264 /* PropertyAssignment */ || getNestedModuleDeclaration(parent))) { getJSDocCommentsAndTagsWorker(parent); } if (parent && parent.parent && @@ -6990,7 +7018,7 @@ var ts; } ts.getParameterSymbolFromJSDoc = getParameterSymbolFromJSDoc; function getJSDocHost(node) { - ts.Debug.assert(node.parent.kind === 275 /* JSDocComment */); + ts.Debug.assert(node.parent.kind === 278 /* JSDocComment */); return node.parent.parent; } ts.getJSDocHost = getJSDocHost; @@ -7036,13 +7064,13 @@ var ts; case 198 /* SpreadElement */: node = parent; break; - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: if (parent.name !== node) { return 0 /* None */; } node = parent.parent; break; - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: if (parent.name === node) { return 0 /* None */; } @@ -7086,7 +7114,7 @@ var ts; ts.isNodeDescendantOf = isNodeDescendantOf; function isInAmbientContext(node) { while (node) { - if (hasModifier(node, 2 /* Ambient */) || (node.kind === 265 /* SourceFile */ && node.isDeclarationFile)) { + if (hasModifier(node, 2 /* Ambient */) || (node.kind === 268 /* SourceFile */ && node.isDeclarationFile)) { return true; } node = node.parent; @@ -7139,8 +7167,8 @@ var ts; case 150 /* MethodSignature */: case 153 /* GetAccessor */: case 154 /* SetAccessor */: - case 264 /* EnumMember */: - case 261 /* PropertyAssignment */: + case 267 /* EnumMember */: + case 264 /* PropertyAssignment */: case 179 /* PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; @@ -7158,7 +7186,7 @@ var ts; // Property name in binding element or import specifier return parent.propertyName === node; case 246 /* ExportSpecifier */: - case 253 /* JsxAttribute */: + case 256 /* JsxAttribute */: // Any name in an export specifier or JSX Attribute return true; } @@ -7267,6 +7295,14 @@ var ts; return 72 /* FirstKeyword */ <= token && token <= 142 /* LastKeyword */; } ts.isKeyword = isKeyword; + function isContextualKeyword(token) { + return 117 /* FirstContextualKeyword */ <= token && token <= 142 /* LastContextualKeyword */; + } + ts.isContextualKeyword = isContextualKeyword; + function isNonContextualKeyword(token) { + return isKeyword(token) && !isContextualKeyword(token); + } + ts.isNonContextualKeyword = isNonContextualKeyword; function isTrivia(token) { return 2 /* FirstTriviaToken */ <= token && token <= 7 /* LastTriviaToken */; } @@ -7432,7 +7468,7 @@ var ts; || kind === 153 /* GetAccessor */ || kind === 154 /* SetAccessor */ || kind === 233 /* ModuleDeclaration */ - || kind === 265 /* SourceFile */; + || kind === 268 /* SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(range) { @@ -7524,6 +7560,7 @@ var ts; case 199 /* ClassExpression */: case 249 /* JsxElement */: case 250 /* JsxSelfClosingElement */: + case 253 /* JsxFragment */: case 12 /* RegularExpressionLiteral */: case 13 /* NoSubstitutionTemplateLiteral */: case 196 /* TemplateExpression */: @@ -7610,7 +7647,7 @@ var ts; return 2; case 198 /* SpreadElement */: return 1; - case 289 /* CommaListExpression */: + case 292 /* CommaListExpression */: return 0; default: return -1; @@ -9292,8 +9329,8 @@ var ts; return undefined; } switch (declaration.kind) { - case 284 /* JSDocPropertyTag */: - case 279 /* JSDocParameterTag */: { + case 287 /* JSDocPropertyTag */: + case 282 /* JSDocParameterTag */: { var name = declaration.name; if (name.kind === 143 /* QualifiedName */) { return name.right; @@ -9312,7 +9349,7 @@ var ts; return undefined; } } - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return getNameOfJSDocTypedef(declaration); case 243 /* ExportAssignment */: { var expression = declaration.expression; @@ -9351,33 +9388,33 @@ var ts; * for example on a variable declaration whose initializer is a function expression. */ function hasJSDocParameterTags(node) { - return !!getFirstJSDocTag(node, 279 /* JSDocParameterTag */); + return !!getFirstJSDocTag(node, 282 /* JSDocParameterTag */); } ts.hasJSDocParameterTags = hasJSDocParameterTags; /** Gets the JSDoc augments tag for the node if present */ function getJSDocAugmentsTag(node) { - return getFirstJSDocTag(node, 277 /* JSDocAugmentsTag */); + return getFirstJSDocTag(node, 280 /* JSDocAugmentsTag */); } ts.getJSDocAugmentsTag = getJSDocAugmentsTag; /** Gets the JSDoc class tag for the node if present */ function getJSDocClassTag(node) { - return getFirstJSDocTag(node, 278 /* JSDocClassTag */); + return getFirstJSDocTag(node, 281 /* JSDocClassTag */); } ts.getJSDocClassTag = getJSDocClassTag; /** Gets the JSDoc return tag for the node if present */ function getJSDocReturnTag(node) { - return getFirstJSDocTag(node, 280 /* JSDocReturnTag */); + return getFirstJSDocTag(node, 283 /* JSDocReturnTag */); } ts.getJSDocReturnTag = getJSDocReturnTag; /** Gets the JSDoc template tag for the node if present */ function getJSDocTemplateTag(node) { - return getFirstJSDocTag(node, 282 /* JSDocTemplateTag */); + return getFirstJSDocTag(node, 285 /* JSDocTemplateTag */); } ts.getJSDocTemplateTag = getJSDocTemplateTag; /** Gets the JSDoc type tag for the node if present and valid */ function getJSDocTypeTag(node) { // We should have already issued an error if there were multiple type jsdocs, so just use the first one. - var tag = getFirstJSDocTag(node, 281 /* JSDocTypeTag */); + var tag = getFirstJSDocTag(node, 284 /* JSDocTypeTag */); if (tag && tag.typeExpression && tag.typeExpression.type) { return tag; } @@ -9396,7 +9433,7 @@ var ts; * tag directly on the node would be returned. */ function getJSDocType(node) { - var tag = getFirstJSDocTag(node, 281 /* JSDocTypeTag */); + var tag = getFirstJSDocTag(node, 284 /* JSDocTypeTag */); if (!tag && node.kind === 146 /* Parameter */) { var paramTags = getJSDocParameterTags(node); if (paramTags) { @@ -9658,7 +9695,7 @@ var ts; } ts.isParenthesizedExpression = isParenthesizedExpression; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 288 /* PartiallyEmittedExpression */) { + while (node.kind === 291 /* PartiallyEmittedExpression */) { node = node.expression; } return node; @@ -9936,137 +9973,149 @@ var ts; return node.kind === 252 /* JsxClosingElement */; } ts.isJsxClosingElement = isJsxClosingElement; + function isJsxFragment(node) { + return node.kind === 253 /* JsxFragment */; + } + ts.isJsxFragment = isJsxFragment; + function isJsxOpeningFragment(node) { + return node.kind === 254 /* JsxOpeningFragment */; + } + ts.isJsxOpeningFragment = isJsxOpeningFragment; + function isJsxClosingFragment(node) { + return node.kind === 255 /* JsxClosingFragment */; + } + ts.isJsxClosingFragment = isJsxClosingFragment; function isJsxAttribute(node) { - return node.kind === 253 /* JsxAttribute */; + return node.kind === 256 /* JsxAttribute */; } ts.isJsxAttribute = isJsxAttribute; function isJsxAttributes(node) { - return node.kind === 254 /* JsxAttributes */; + return node.kind === 257 /* JsxAttributes */; } ts.isJsxAttributes = isJsxAttributes; function isJsxSpreadAttribute(node) { - return node.kind === 255 /* JsxSpreadAttribute */; + return node.kind === 258 /* JsxSpreadAttribute */; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxExpression(node) { - return node.kind === 256 /* JsxExpression */; + return node.kind === 259 /* JsxExpression */; } ts.isJsxExpression = isJsxExpression; // Clauses function isCaseClause(node) { - return node.kind === 257 /* CaseClause */; + return node.kind === 260 /* CaseClause */; } ts.isCaseClause = isCaseClause; function isDefaultClause(node) { - return node.kind === 258 /* DefaultClause */; + return node.kind === 261 /* DefaultClause */; } ts.isDefaultClause = isDefaultClause; function isHeritageClause(node) { - return node.kind === 259 /* HeritageClause */; + return node.kind === 262 /* HeritageClause */; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 260 /* CatchClause */; + return node.kind === 263 /* CatchClause */; } ts.isCatchClause = isCatchClause; // Property assignments function isPropertyAssignment(node) { - return node.kind === 261 /* PropertyAssignment */; + return node.kind === 264 /* PropertyAssignment */; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 262 /* ShorthandPropertyAssignment */; + return node.kind === 265 /* ShorthandPropertyAssignment */; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isSpreadAssignment(node) { - return node.kind === 263 /* SpreadAssignment */; + return node.kind === 266 /* SpreadAssignment */; } ts.isSpreadAssignment = isSpreadAssignment; // Enum function isEnumMember(node) { - return node.kind === 264 /* EnumMember */; + return node.kind === 267 /* EnumMember */; } ts.isEnumMember = isEnumMember; // Top-level nodes function isSourceFile(node) { - return node.kind === 265 /* SourceFile */; + return node.kind === 268 /* SourceFile */; } ts.isSourceFile = isSourceFile; function isBundle(node) { - return node.kind === 266 /* Bundle */; + return node.kind === 269 /* Bundle */; } ts.isBundle = isBundle; // JSDoc function isJSDocTypeExpression(node) { - return node.kind === 267 /* JSDocTypeExpression */; + return node.kind === 270 /* JSDocTypeExpression */; } ts.isJSDocTypeExpression = isJSDocTypeExpression; function isJSDocAllType(node) { - return node.kind === 268 /* JSDocAllType */; + return node.kind === 271 /* JSDocAllType */; } ts.isJSDocAllType = isJSDocAllType; function isJSDocUnknownType(node) { - return node.kind === 269 /* JSDocUnknownType */; + return node.kind === 272 /* JSDocUnknownType */; } ts.isJSDocUnknownType = isJSDocUnknownType; function isJSDocNullableType(node) { - return node.kind === 270 /* JSDocNullableType */; + return node.kind === 273 /* JSDocNullableType */; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 271 /* JSDocNonNullableType */; + return node.kind === 274 /* JSDocNonNullableType */; } ts.isJSDocNonNullableType = isJSDocNonNullableType; function isJSDocOptionalType(node) { - return node.kind === 272 /* JSDocOptionalType */; + return node.kind === 275 /* JSDocOptionalType */; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 273 /* JSDocFunctionType */; + return node.kind === 276 /* JSDocFunctionType */; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 274 /* JSDocVariadicType */; + return node.kind === 277 /* JSDocVariadicType */; } ts.isJSDocVariadicType = isJSDocVariadicType; function isJSDoc(node) { - return node.kind === 275 /* JSDocComment */; + return node.kind === 278 /* JSDocComment */; } ts.isJSDoc = isJSDoc; function isJSDocAugmentsTag(node) { - return node.kind === 277 /* JSDocAugmentsTag */; + return node.kind === 280 /* JSDocAugmentsTag */; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocParameterTag(node) { - return node.kind === 279 /* JSDocParameterTag */; + return node.kind === 282 /* JSDocParameterTag */; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 280 /* JSDocReturnTag */; + return node.kind === 283 /* JSDocReturnTag */; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocTypeTag(node) { - return node.kind === 281 /* JSDocTypeTag */; + return node.kind === 284 /* JSDocTypeTag */; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 282 /* JSDocTemplateTag */; + return node.kind === 285 /* JSDocTemplateTag */; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 283 /* JSDocTypedefTag */; + return node.kind === 286 /* JSDocTypedefTag */; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocPropertyTag(node) { - return node.kind === 284 /* JSDocPropertyTag */; + return node.kind === 287 /* JSDocPropertyTag */; } ts.isJSDocPropertyTag = isJSDocPropertyTag; function isJSDocPropertyLikeTag(node) { - return node.kind === 284 /* JSDocPropertyTag */ || node.kind === 279 /* JSDocParameterTag */; + return node.kind === 287 /* JSDocPropertyTag */ || node.kind === 282 /* JSDocParameterTag */; } ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; function isJSDocTypeLiteral(node) { - return node.kind === 285 /* JSDocTypeLiteral */; + return node.kind === 288 /* JSDocTypeLiteral */; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; })(ts || (ts = {})); @@ -10077,7 +10126,7 @@ var ts; (function (ts) { /* @internal */ function isSyntaxList(n) { - return n.kind === 286 /* SyntaxList */; + return n.kind === 289 /* SyntaxList */; } ts.isSyntaxList = isSyntaxList; /* @internal */ @@ -10223,7 +10272,7 @@ var ts; case 156 /* ConstructSignature */: case 157 /* IndexSignature */: case 160 /* FunctionType */: - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: case 161 /* ConstructorType */: return true; default: @@ -10270,9 +10319,9 @@ var ts; ts.isTypeElement = isTypeElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 261 /* PropertyAssignment */ - || kind === 262 /* ShorthandPropertyAssignment */ - || kind === 263 /* SpreadAssignment */ + return kind === 264 /* PropertyAssignment */ + || kind === 265 /* ShorthandPropertyAssignment */ + || kind === 266 /* SpreadAssignment */ || kind === 151 /* MethodDeclaration */ || kind === 153 /* GetAccessor */ || kind === 154 /* SetAccessor */ @@ -10294,13 +10343,13 @@ var ts; || kind === 95 /* NullKeyword */ || kind === 130 /* NeverKeyword */ || kind === 201 /* ExpressionWithTypeArguments */ - || kind === 268 /* JSDocAllType */ - || kind === 269 /* JSDocUnknownType */ - || kind === 270 /* JSDocNullableType */ - || kind === 271 /* JSDocNonNullableType */ - || kind === 272 /* JSDocOptionalType */ - || kind === 273 /* JSDocFunctionType */ - || kind === 274 /* JSDocVariadicType */; + || kind === 271 /* JSDocAllType */ + || kind === 272 /* JSDocUnknownType */ + || kind === 273 /* JSDocNullableType */ + || kind === 274 /* JSDocNonNullableType */ + || kind === 275 /* JSDocOptionalType */ + || kind === 276 /* JSDocFunctionType */ + || kind === 277 /* JSDocVariadicType */; } /** * Node test that determines whether a node is a valid type node. @@ -10438,6 +10487,7 @@ var ts; case 181 /* CallExpression */: case 249 /* JsxElement */: case 250 /* JsxSelfClosingElement */: + case 253 /* JsxFragment */: case 183 /* TaggedTemplateExpression */: case 177 /* ArrayLiteralExpression */: case 185 /* ParenthesizedExpression */: @@ -10513,8 +10563,8 @@ var ts; case 198 /* SpreadElement */: case 202 /* AsExpression */: case 200 /* OmittedExpression */: - case 289 /* CommaListExpression */: - case 288 /* PartiallyEmittedExpression */: + case 292 /* CommaListExpression */: + case 291 /* PartiallyEmittedExpression */: return true; default: return isUnaryExpressionKind(kind); @@ -10528,12 +10578,12 @@ var ts; ts.isAssertionExpression = isAssertionExpression; /* @internal */ function isPartiallyEmittedExpression(node) { - return node.kind === 288 /* PartiallyEmittedExpression */; + return node.kind === 291 /* PartiallyEmittedExpression */; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; /* @internal */ function isNotEmittedStatement(node) { - return node.kind === 287 /* NotEmittedStatement */; + return node.kind === 290 /* NotEmittedStatement */; } ts.isNotEmittedStatement = isNotEmittedStatement; /* @internal */ @@ -10621,7 +10671,7 @@ var ts; || kind === 199 /* ClassExpression */ || kind === 152 /* Constructor */ || kind === 232 /* EnumDeclaration */ - || kind === 264 /* EnumMember */ + || kind === 267 /* EnumMember */ || kind === 246 /* ExportSpecifier */ || kind === 228 /* FunctionDeclaration */ || kind === 186 /* FunctionExpression */ @@ -10630,22 +10680,22 @@ var ts; || kind === 237 /* ImportEqualsDeclaration */ || kind === 242 /* ImportSpecifier */ || kind === 230 /* InterfaceDeclaration */ - || kind === 253 /* JsxAttribute */ + || kind === 256 /* JsxAttribute */ || kind === 151 /* MethodDeclaration */ || kind === 150 /* MethodSignature */ || kind === 233 /* ModuleDeclaration */ || kind === 236 /* NamespaceExportDeclaration */ || kind === 240 /* NamespaceImport */ || kind === 146 /* Parameter */ - || kind === 261 /* PropertyAssignment */ + || kind === 264 /* PropertyAssignment */ || kind === 149 /* PropertyDeclaration */ || kind === 148 /* PropertySignature */ || kind === 154 /* SetAccessor */ - || kind === 262 /* ShorthandPropertyAssignment */ + || kind === 265 /* ShorthandPropertyAssignment */ || kind === 231 /* TypeAliasDeclaration */ || kind === 145 /* TypeParameter */ || kind === 226 /* VariableDeclaration */ - || kind === 283 /* JSDocTypedefTag */; + || kind === 286 /* JSDocTypedefTag */; } function isDeclarationStatementKind(kind) { return kind === 228 /* FunctionDeclaration */ @@ -10680,14 +10730,14 @@ var ts; || kind === 208 /* VariableStatement */ || kind === 213 /* WhileStatement */ || kind === 220 /* WithStatement */ - || kind === 287 /* NotEmittedStatement */ - || kind === 291 /* EndOfDeclarationMarker */ - || kind === 290 /* MergeDeclarationMarker */; + || kind === 290 /* NotEmittedStatement */ + || kind === 294 /* EndOfDeclarationMarker */ + || kind === 293 /* MergeDeclarationMarker */; } /* @internal */ function isDeclaration(node) { if (node.kind === 145 /* TypeParameter */) { - return node.parent.kind !== 282 /* JSDocTemplateTag */ || ts.isInJavaScriptFile(node); + return node.parent.kind !== 285 /* JSDocTemplateTag */ || ts.isInJavaScriptFile(node); } return isDeclarationKind(node.kind); } @@ -10717,7 +10767,7 @@ var ts; if (node.kind !== 207 /* Block */) return false; if (node.parent !== undefined) { - if (node.parent.kind === 224 /* TryStatement */ || node.parent.kind === 260 /* CatchClause */) { + if (node.parent.kind === 224 /* TryStatement */ || node.parent.kind === 263 /* CatchClause */) { return false; } } @@ -10745,23 +10795,24 @@ var ts; function isJsxChild(node) { var kind = node.kind; return kind === 249 /* JsxElement */ - || kind === 256 /* JsxExpression */ + || kind === 259 /* JsxExpression */ || kind === 250 /* JsxSelfClosingElement */ - || kind === 10 /* JsxText */; + || kind === 10 /* JsxText */ + || kind === 253 /* JsxFragment */; } ts.isJsxChild = isJsxChild; /* @internal */ function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 253 /* JsxAttribute */ - || kind === 255 /* JsxSpreadAttribute */; + return kind === 256 /* JsxAttribute */ + || kind === 258 /* JsxSpreadAttribute */; } ts.isJsxAttributeLike = isJsxAttributeLike; /* @internal */ function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 9 /* StringLiteral */ - || kind === 256 /* JsxExpression */; + || kind === 259 /* JsxExpression */; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isJsxOpeningLikeElement(node) { @@ -10773,26 +10824,26 @@ var ts; // Clauses function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 257 /* CaseClause */ - || kind === 258 /* DefaultClause */; + return kind === 260 /* CaseClause */ + || kind === 261 /* DefaultClause */; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; // JSDoc /** True if node is of some JSDoc syntax kind. */ /* @internal */ function isJSDocNode(node) { - return node.kind >= 267 /* FirstJSDocNode */ && node.kind <= 285 /* LastJSDocNode */; + return node.kind >= 270 /* FirstJSDocNode */ && node.kind <= 288 /* LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; /** True if node is of a kind that may contain comment text. */ function isJSDocCommentContainingNode(node) { - return node.kind === 275 /* JSDocComment */ || isJSDocTag(node); + return node.kind === 278 /* JSDocComment */ || isJSDocTag(node); } ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode; // TODO: determine what this does before making it public. /* @internal */ function isJSDocTag(node) { - return node.kind >= 276 /* FirstJSDocTagNode */ && node.kind <= 285 /* LastJSDocTagNode */; + return node.kind >= 279 /* FirstJSDocTagNode */ && node.kind <= 288 /* LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function isSetAccessor(node) { @@ -10819,6 +10870,11 @@ var ts; return token >= 71 /* Identifier */; } ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; + /* @internal */ + function tokenIsIdentifierOrKeywordOrGreaterThan(token) { + return token === 29 /* GreaterThanToken */ || tokenIsIdentifierOrKeyword(token); + } + ts.tokenIsIdentifierOrKeywordOrGreaterThan = tokenIsIdentifierOrKeywordOrGreaterThan; var textToToken = ts.createMapFromTemplate({ "abstract": 117 /* AbstractKeyword */, "any": 119 /* AnyKeyword */, @@ -12616,7 +12672,7 @@ var ts; var IdentifierConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 265 /* SourceFile */) { + if (kind === 268 /* SourceFile */) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 71 /* Identifier */) { @@ -12673,19 +12729,19 @@ var ts; visitNode(cbNode, node.constraint) || visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: return visitNode(cbNode, node.expression); case 146 /* Parameter */: case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: case 226 /* VariableDeclaration */: case 176 /* BindingElement */: return visitNodes(cbNode, cbNodes, node.decorators) || @@ -12817,7 +12873,7 @@ var ts; case 207 /* Block */: case 234 /* ModuleBlock */: return visitNodes(cbNode, cbNodes, node.statements); - case 265 /* SourceFile */: + case 268 /* SourceFile */: return visitNodes(cbNode, cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); case 208 /* VariableStatement */: @@ -12865,10 +12921,10 @@ var ts; visitNode(cbNode, node.caseBlock); case 235 /* CaseBlock */: return visitNodes(cbNode, cbNodes, node.clauses); - case 257 /* CaseClause */: + case 260 /* CaseClause */: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.statements); - case 258 /* DefaultClause */: + case 261 /* DefaultClause */: return visitNodes(cbNode, cbNodes, node.statements); case 222 /* LabeledStatement */: return visitNode(cbNode, node.label) || @@ -12879,7 +12935,7 @@ var ts; return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 147 /* Decorator */: @@ -12910,7 +12966,7 @@ var ts; visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.members); - case 264 /* EnumMember */: + case 267 /* EnumMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 233 /* ModuleDeclaration */: @@ -12957,7 +13013,7 @@ var ts; return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 144 /* ComputedPropertyName */: return visitNode(cbNode, node.expression); - case 259 /* HeritageClause */: + case 262 /* HeritageClause */: return visitNodes(cbNode, cbNodes, node.types); case 201 /* ExpressionWithTypeArguments */: return visitNode(cbNode, node.expression) || @@ -12966,45 +13022,49 @@ var ts; return visitNode(cbNode, node.expression); case 247 /* MissingDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators); - case 289 /* CommaListExpression */: + case 292 /* CommaListExpression */: return visitNodes(cbNode, cbNodes, node.elements); case 249 /* JsxElement */: return visitNode(cbNode, node.openingElement) || visitNodes(cbNode, cbNodes, node.children) || visitNode(cbNode, node.closingElement); + case 253 /* JsxFragment */: + return visitNode(cbNode, node.openingFragment) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingFragment); case 250 /* JsxSelfClosingElement */: case 251 /* JsxOpeningElement */: return visitNode(cbNode, node.tagName) || visitNode(cbNode, node.attributes); - case 254 /* JsxAttributes */: + case 257 /* JsxAttributes */: return visitNodes(cbNode, cbNodes, node.properties); - case 253 /* JsxAttribute */: + case 256 /* JsxAttribute */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 255 /* JsxSpreadAttribute */: + case 258 /* JsxSpreadAttribute */: return visitNode(cbNode, node.expression); - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: return visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.expression); case 252 /* JsxClosingElement */: return visitNode(cbNode, node.tagName); - case 267 /* JSDocTypeExpression */: + case 270 /* JSDocTypeExpression */: return visitNode(cbNode, node.type); - case 271 /* JSDocNonNullableType */: + case 274 /* JSDocNonNullableType */: return visitNode(cbNode, node.type); - case 270 /* JSDocNullableType */: + case 273 /* JSDocNullableType */: return visitNode(cbNode, node.type); - case 272 /* JSDocOptionalType */: + case 275 /* JSDocOptionalType */: return visitNode(cbNode, node.type); - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: return visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 274 /* JSDocVariadicType */: + case 277 /* JSDocVariadicType */: return visitNode(cbNode, node.type); - case 275 /* JSDocComment */: + case 278 /* JSDocComment */: return visitNodes(cbNode, cbNodes, node.tags); - case 279 /* JSDocParameterTag */: - case 284 /* JSDocPropertyTag */: + case 282 /* JSDocParameterTag */: + case 287 /* JSDocPropertyTag */: if (node.isNameFirst) { return visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression); @@ -13013,17 +13073,17 @@ var ts; return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); } - case 280 /* JSDocReturnTag */: + case 283 /* JSDocReturnTag */: return visitNode(cbNode, node.typeExpression); - case 281 /* JSDocTypeTag */: + case 284 /* JSDocTypeTag */: return visitNode(cbNode, node.typeExpression); - case 277 /* JSDocAugmentsTag */: + case 280 /* JSDocAugmentsTag */: return visitNode(cbNode, node.class); - case 282 /* JSDocTemplateTag */: + case 285 /* JSDocTemplateTag */: return visitNodes(cbNode, cbNodes, node.typeParameters); - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: if (node.typeExpression && - node.typeExpression.kind === 267 /* JSDocTypeExpression */) { + node.typeExpression.kind === 270 /* JSDocTypeExpression */) { return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName); } @@ -13031,7 +13091,7 @@ var ts; return visitNode(cbNode, node.fullName) || visitNode(cbNode, node.typeExpression); } - case 285 /* JSDocTypeLiteral */: + case 288 /* JSDocTypeLiteral */: if (node.jsDocPropertyTags) { for (var _i = 0, _a = node.jsDocPropertyTags; _i < _a.length; _i++) { var tag = _a[_i]; @@ -13039,7 +13099,7 @@ var ts; } } return; - case 288 /* PartiallyEmittedExpression */: + case 291 /* PartiallyEmittedExpression */: return visitNode(cbNode, node.expression); } } @@ -13348,7 +13408,7 @@ var ts; function createSourceFile(fileName, languageVersion, scriptKind) { // code from createNode is inlined here so createNode won't have to deal with special case of creating source files // this is quite rare comparing to other nodes and createNode should be as fast as possible - var sourceFile = new SourceFileConstructor(265 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); + var sourceFile = new SourceFileConstructor(268 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -13885,6 +13945,10 @@ var ts; nextToken(); return ts.tokenIsIdentifierOrKeyword(token()); } + function nextTokenIsIdentifierOrKeywordOrGreaterThan() { + nextToken(); + return ts.tokenIsIdentifierOrKeywordOrGreaterThan(token()); + } function isHeritageClauseExtendsOrImplementsKeyword() { if (token() === 108 /* ImplementsKeyword */ || token() === 85 /* ExtendsKeyword */) { @@ -14145,8 +14209,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 257 /* CaseClause */: - case 258 /* DefaultClause */: + case 260 /* CaseClause */: + case 261 /* DefaultClause */: return true; } } @@ -14190,7 +14254,7 @@ var ts; return false; } function isReusableEnumMember(node) { - return node.kind === 264 /* EnumMember */; + return node.kind === 267 /* EnumMember */; } function isReusableTypeMember(node) { if (node) { @@ -14476,7 +14540,7 @@ var ts; return finishNode(node); } function parseJSDocAllType() { - var result = createNode(268 /* JSDocAllType */); + var result = createNode(271 /* JSDocAllType */); nextToken(); return finishNode(result); } @@ -14499,18 +14563,18 @@ var ts; token() === 29 /* GreaterThanToken */ || token() === 58 /* EqualsToken */ || token() === 49 /* BarToken */) { - var result = createNode(269 /* JSDocUnknownType */, pos); + var result = createNode(272 /* JSDocUnknownType */, pos); return finishNode(result); } else { - var result = createNode(270 /* JSDocNullableType */, pos); + var result = createNode(273 /* JSDocNullableType */, pos); result.type = parseType(); return finishNode(result); } } function parseJSDocFunctionType() { if (lookAhead(nextTokenIsOpenParen)) { - var result = createNode(273 /* JSDocFunctionType */); + var result = createNode(276 /* JSDocFunctionType */); nextToken(); fillSignature(56 /* ColonToken */, 4 /* Type */ | 32 /* JSDoc */, result); return addJSDocComment(finishNode(result)); @@ -14945,9 +15009,9 @@ var ts; case 89 /* FunctionKeyword */: return parseJSDocFunctionType(); case 24 /* DotDotDotToken */: - return parseJSDocNodeWithType(274 /* JSDocVariadicType */); + return parseJSDocNodeWithType(277 /* JSDocVariadicType */); case 51 /* ExclamationToken */: - return parseJSDocNodeWithType(271 /* JSDocNonNullableType */); + return parseJSDocNodeWithType(274 /* JSDocNonNullableType */); case 13 /* NoSubstitutionTemplateLiteral */: case 9 /* StringLiteral */: case 8 /* NumericLiteral */: @@ -15032,13 +15096,13 @@ var ts; if (!(contextFlags & 1048576 /* JSDoc */)) { return type; } - type = createJSDocPostfixType(272 /* JSDocOptionalType */, type); + type = createJSDocPostfixType(275 /* JSDocOptionalType */, type); break; case 51 /* ExclamationToken */: - type = createJSDocPostfixType(271 /* JSDocNonNullableType */, type); + type = createJSDocPostfixType(274 /* JSDocNonNullableType */, type); break; case 55 /* QuestionToken */: - type = createJSDocPostfixType(270 /* JSDocNullableType */, type); + type = createJSDocPostfixType(273 /* JSDocNullableType */, type); break; case 21 /* OpenBracketToken */: parseExpected(21 /* OpenBracketToken */); @@ -15983,9 +16047,9 @@ var ts; node.operand = parseLeftHandSideExpressionOrHigher(); return finishNode(node); } - else if (sourceFile.languageVariant === 1 /* JSX */ && token() === 27 /* LessThanToken */ && lookAhead(nextTokenIsIdentifierOrKeyword)) { + else if (sourceFile.languageVariant === 1 /* JSX */ && token() === 27 /* LessThanToken */ && lookAhead(nextTokenIsIdentifierOrKeywordOrGreaterThan)) { // JSXElement is part of primaryExpression - return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true); + return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ true); } var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); @@ -16126,19 +16190,26 @@ var ts; return lhs.name.escapedText === rhs.name.escapedText && tagNamesAreEquivalent(lhs.expression, rhs.expression); } - function parseJsxElementOrSelfClosingElement(inExpressionContext) { - var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); + function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext) { + var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); var result; if (opening.kind === 251 /* JsxOpeningElement */) { var node = createNode(249 /* JsxElement */, opening.pos); node.openingElement = opening; - node.children = parseJsxChildren(node.openingElement.tagName); + node.children = parseJsxChildren(node.openingElement); node.closingElement = parseJsxClosingElement(inExpressionContext); if (!tagNamesAreEquivalent(node.openingElement.tagName, node.closingElement.tagName)) { parseErrorAtPosition(node.closingElement.pos, node.closingElement.end - node.closingElement.pos, ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNodeFromSourceText(sourceText, node.openingElement.tagName)); } result = finishNode(node); } + else if (opening.kind === 254 /* JsxOpeningFragment */) { + var node = createNode(253 /* JsxFragment */, opening.pos); + node.openingFragment = opening; + node.children = parseJsxChildren(node.openingFragment); + node.closingFragment = parseJsxClosingFragment(inExpressionContext); + result = finishNode(node); + } else { ts.Debug.assert(opening.kind === 250 /* JsxSelfClosingElement */); // Nothing else to do for self-closing elements @@ -16152,7 +16223,7 @@ var ts; // Since JSX elements are invalid < operands anyway, this lookahead parse will only occur in error scenarios // of one sort or another. if (inExpressionContext && token() === 27 /* LessThanToken */) { - var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true); }); + var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); var badNode = createNode(194 /* BinaryExpression */, result.pos); @@ -16180,11 +16251,11 @@ var ts; case 17 /* OpenBraceToken */: return parseJsxExpression(/*inExpressionContext*/ false); case 27 /* LessThanToken */: - return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ false); + return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ false); } ts.Debug.fail("Unknown JSX child kind " + token()); } - function parseJsxChildren(openingTagName) { + function parseJsxChildren(openingTag) { var list = []; var listPos = getNodePos(); var saveParsingContext = parsingContext; @@ -16198,7 +16269,13 @@ var ts; else if (token() === 1 /* EndOfFileToken */) { // If we hit EOF, issue the error at the tag that lacks the closing element // rather than at the end of the file (which is useless) - parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTagName)); + if (ts.isJsxOpeningFragment(openingTag)) { + parseErrorAtPosition(openingTag.pos, openingTag.end - openingTag.pos, ts.Diagnostics.JSX_fragment_has_no_corresponding_closing_tag); + } + else { + var openingTagName = openingTag.tagName; + parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTagName)); + } break; } else if (token() === 7 /* ConflictMarkerTrivia */) { @@ -16213,13 +16290,18 @@ var ts; return createNodeArray(list, listPos); } function parseJsxAttributes() { - var jsxAttributes = createNode(254 /* JsxAttributes */); + var jsxAttributes = createNode(257 /* JsxAttributes */); jsxAttributes.properties = parseList(13 /* JsxAttributes */, parseJsxAttribute); return finishNode(jsxAttributes); } - function parseJsxOpeningOrSelfClosingElement(inExpressionContext) { + function parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext) { var fullStart = scanner.getStartPos(); parseExpected(27 /* LessThanToken */); + if (token() === 29 /* GreaterThanToken */) { + parseExpected(29 /* GreaterThanToken */); + var node_1 = createNode(254 /* JsxOpeningFragment */, fullStart); + return finishNode(node_1); + } var tagName = parseJsxElementName(); var attributes = parseJsxAttributes(); var node; @@ -16263,7 +16345,7 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(256 /* JsxExpression */); + var node = createNode(259 /* JsxExpression */); parseExpected(17 /* OpenBraceToken */); if (token() !== 18 /* CloseBraceToken */) { node.dotDotDotToken = parseOptionalToken(24 /* DotDotDotToken */); @@ -16283,7 +16365,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(253 /* JsxAttribute */); + var node = createNode(256 /* JsxAttribute */); node.name = parseIdentifierName(); if (token() === 58 /* EqualsToken */) { switch (scanJsxAttributeValue()) { @@ -16298,7 +16380,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(255 /* JsxSpreadAttribute */); + var node = createNode(258 /* JsxSpreadAttribute */); parseExpected(17 /* OpenBraceToken */); parseExpected(24 /* DotDotDotToken */); node.expression = parseExpression(); @@ -16318,6 +16400,22 @@ var ts; } return finishNode(node); } + function parseJsxClosingFragment(inExpressionContext) { + var node = createNode(255 /* JsxClosingFragment */); + parseExpected(28 /* LessThanSlashToken */); + if (ts.tokenIsIdentifierOrKeyword(token())) { + var unexpectedTagName = parseJsxElementName(); + parseErrorAtPosition(unexpectedTagName.pos, unexpectedTagName.end - unexpectedTagName.pos, ts.Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment); + } + if (inExpressionContext) { + parseExpected(29 /* GreaterThanToken */); + } + else { + parseExpected(29 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false); + scanJsxText(); + } + return finishNode(node); + } function parseTypeAssertion() { var node = createNode(184 /* TypeAssertionExpression */); parseExpected(27 /* LessThanToken */); @@ -16545,7 +16643,7 @@ var ts; var fullStart = scanner.getStartPos(); var dotDotDotToken = parseOptionalToken(24 /* DotDotDotToken */); if (dotDotDotToken) { - var spreadElement = createNode(263 /* SpreadAssignment */, fullStart); + var spreadElement = createNode(266 /* SpreadAssignment */, fullStart); spreadElement.expression = parseAssignmentExpressionOrHigher(); return addJSDocComment(finishNode(spreadElement)); } @@ -16570,7 +16668,7 @@ var ts; // this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 26 /* CommaToken */ || token() === 18 /* CloseBraceToken */ || token() === 58 /* EqualsToken */); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(262 /* ShorthandPropertyAssignment */, fullStart); + var shorthandDeclaration = createNode(265 /* ShorthandPropertyAssignment */, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(58 /* EqualsToken */); @@ -16581,7 +16679,7 @@ var ts; return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(261 /* PropertyAssignment */, fullStart); + var propertyAssignment = createNode(264 /* PropertyAssignment */, fullStart); propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; @@ -16635,10 +16733,10 @@ var ts; var fullStart = scanner.getStartPos(); parseExpected(94 /* NewKeyword */); if (parseOptional(23 /* DotToken */)) { - var node_1 = createNode(204 /* MetaProperty */, fullStart); - node_1.keywordToken = 94 /* NewKeyword */; - node_1.name = parseIdentifierName(); - return finishNode(node_1); + var node_2 = createNode(204 /* MetaProperty */, fullStart); + node_2.keywordToken = 94 /* NewKeyword */; + node_2.name = parseIdentifierName(); + return finishNode(node_2); } var node = createNode(182 /* NewExpression */, fullStart); node.expression = parseMemberExpressionOrHigher(); @@ -16796,7 +16894,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(257 /* CaseClause */); + var node = createNode(260 /* CaseClause */); parseExpected(73 /* CaseKeyword */); node.expression = allowInAnd(parseExpression); parseExpected(56 /* ColonToken */); @@ -16804,7 +16902,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(258 /* DefaultClause */); + var node = createNode(261 /* DefaultClause */); parseExpected(79 /* DefaultKeyword */); parseExpected(56 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); @@ -16855,7 +16953,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(260 /* CatchClause */); + var result = createNode(263 /* CatchClause */); parseExpected(74 /* CatchKeyword */); if (parseOptional(19 /* OpenParenToken */)) { result.variableDeclaration = parseVariableDeclaration(); @@ -17580,7 +17678,7 @@ var ts; function parseHeritageClause() { var tok = token(); if (tok === 85 /* ExtendsKeyword */ || tok === 108 /* ImplementsKeyword */) { - var node = createNode(259 /* HeritageClause */); + var node = createNode(262 /* HeritageClause */); node.token = tok; nextToken(); node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments); @@ -17633,7 +17731,7 @@ var ts; // ConstantEnumMemberSection, which starts at the beginning of an enum declaration // or any time an integer literal initializer is encountered. function parseEnumMember() { - var node = createNode(264 /* EnumMember */, scanner.getStartPos()); + var node = createNode(267 /* EnumMember */, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return addJSDocComment(finishNode(node)); @@ -18050,7 +18148,7 @@ var ts; } JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; function parseJSDocTypeExpression(requireBraces) { - var result = createNode(267 /* JSDocTypeExpression */, scanner.getTokenPos()); + var result = createNode(270 /* JSDocTypeExpression */, scanner.getTokenPos()); if (!parseExpected(17 /* OpenBraceToken */) && requireBraces) { return undefined; } @@ -18234,7 +18332,7 @@ var ts; content.charCodeAt(start + 3) !== 42 /* asterisk */; } function createJSDocComment() { - var result = createNode(275 /* JSDocComment */, start); + var result = createNode(278 /* JSDocComment */, start); result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd); result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -18358,7 +18456,7 @@ var ts; return comments; } function parseUnknownTag(atToken, tagName) { - var result = createNode(276 /* JSDocTag */, atToken.pos); + var result = createNode(279 /* JSDocTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -18412,8 +18510,8 @@ var ts; typeExpression = tryParseTypeExpression(); } var result = target === 1 /* Parameter */ ? - createNode(279 /* JSDocParameterTag */, atToken.pos) : - createNode(284 /* JSDocPropertyTag */, atToken.pos); + createNode(282 /* JSDocParameterTag */, atToken.pos) : + createNode(287 /* JSDocPropertyTag */, atToken.pos); var nestedTypeLiteral = parseNestedTypeLiteral(typeExpression, name); if (nestedTypeLiteral) { typeExpression = nestedTypeLiteral; @@ -18429,7 +18527,7 @@ var ts; } function parseNestedTypeLiteral(typeExpression, name) { if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) { - var typeLiteralExpression = createNode(267 /* JSDocTypeExpression */, scanner.getTokenPos()); + var typeLiteralExpression = createNode(270 /* JSDocTypeExpression */, scanner.getTokenPos()); var child = void 0; var jsdocTypeLiteral = void 0; var start_2 = scanner.getStartPos(); @@ -18441,7 +18539,7 @@ var ts; children.push(child); } if (children) { - jsdocTypeLiteral = createNode(285 /* JSDocTypeLiteral */, start_2); + jsdocTypeLiteral = createNode(288 /* JSDocTypeLiteral */, start_2); jsdocTypeLiteral.jsDocPropertyTags = children; if (typeExpression.type.kind === 164 /* ArrayType */) { jsdocTypeLiteral.isArrayType = true; @@ -18452,27 +18550,27 @@ var ts; } } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 280 /* JSDocReturnTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 283 /* JSDocReturnTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } - var result = createNode(280 /* JSDocReturnTag */, atToken.pos); + var result = createNode(283 /* JSDocReturnTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 281 /* JSDocTypeTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 284 /* JSDocTypeTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } - var result = createNode(281 /* JSDocTypeTag */, atToken.pos); + var result = createNode(284 /* JSDocTypeTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = parseJSDocTypeExpression(/*requireBraces*/ true); return finishNode(result); } function parseAugmentsTag(atToken, tagName) { - var result = createNode(277 /* JSDocAugmentsTag */, atToken.pos); + var result = createNode(280 /* JSDocAugmentsTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.class = parseExpressionWithTypeArgumentsForAugments(); @@ -18500,7 +18598,7 @@ var ts; return node; } function parseClassTag(atToken, tagName) { - var tag = createNode(278 /* JSDocClassTag */, atToken.pos); + var tag = createNode(281 /* JSDocClassTag */, atToken.pos); tag.atToken = atToken; tag.tagName = tagName; return finishNode(tag); @@ -18508,7 +18606,7 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(283 /* JSDocTypedefTag */, atToken.pos); + var typedefTag = createNode(286 /* JSDocTypedefTag */, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(/*flags*/ 0); @@ -18533,9 +18631,9 @@ var ts; var start_3 = scanner.getStartPos(); while (child = tryParse(function () { return parseChildParameterOrPropertyTag(0 /* Property */); })) { if (!jsdocTypeLiteral) { - jsdocTypeLiteral = createNode(285 /* JSDocTypeLiteral */, start_3); + jsdocTypeLiteral = createNode(288 /* JSDocTypeLiteral */, start_3); } - if (child.kind === 281 /* JSDocTypeTag */) { + if (child.kind === 284 /* JSDocTypeTag */) { if (childTypeTag) { break; } @@ -18597,7 +18695,7 @@ var ts; case 57 /* AtToken */: if (canParseTag) { var child = tryParseChildTag(target); - if (child && child.kind === 279 /* JSDocParameterTag */ && + if (child && child.kind === 282 /* JSDocParameterTag */ && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; } @@ -18647,7 +18745,7 @@ var ts; return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 282 /* JSDocTemplateTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 285 /* JSDocTemplateTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } // Type parameter list looks like '@template T,U,V' @@ -18672,7 +18770,7 @@ var ts; break; } } - var result = createNode(282 /* JSDocTemplateTag */, atToken.pos); + var result = createNode(285 /* JSDocTemplateTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = createNodeArray(typeParameters, typeParametersPos); @@ -20181,7 +20279,7 @@ var ts; var result = {}; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 261 /* PropertyAssignment */) { + if (element.kind !== 264 /* PropertyAssignment */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); continue; } @@ -22472,16 +22570,16 @@ var ts; case 228 /* FunctionDeclaration */: case 229 /* ClassDeclaration */: return (ts.hasModifier(node, 512 /* Default */) ? "default" /* Default */ : undefined); - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: return (ts.isJSDocConstructSignature(node) ? "__new" /* New */ : "__call" /* Call */); case 146 /* Parameter */: // Parameters with names are handled at the top of this function. Parameters // without names can only come from JSDocFunctionTypes. - ts.Debug.assert(node.parent.kind === 273 /* JSDocFunctionType */); + ts.Debug.assert(node.parent.kind === 276 /* JSDocFunctionType */); var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "arg" + index; - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: var name_2 = ts.getNameOfJSDocTypedef(node); return typeof name_2 !== "undefined" ? name_2.escapedText : undefined; } @@ -22613,9 +22711,9 @@ var ts; // during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation // and this case is specially handled. Module augmentations should only be merged with original module definition // and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed. - if (node.kind === 283 /* JSDocTypedefTag */) + if (node.kind === 286 /* JSDocTypedefTag */) ts.Debug.assert(ts.isInJavaScriptFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file. - var isJSDocTypedefInJSDocNamespace = node.kind === 283 /* JSDocTypedefTag */ && + var isJSDocTypedefInJSDocNamespace = node.kind === 286 /* JSDocTypedefTag */ && node.name && node.name.kind === 71 /* Identifier */ && node.name.isInJSDocNamespace; @@ -22700,7 +22798,7 @@ var ts; if (hasExplicitReturn) node.flags |= 256 /* HasExplicitReturn */; } - if (node.kind === 265 /* SourceFile */) { + if (node.kind === 268 /* SourceFile */) { node.flags |= emitFlags; } if (isIIFE) { @@ -22823,7 +22921,7 @@ var ts; case 235 /* CaseBlock */: bindCaseBlock(node); break; - case 257 /* CaseClause */: + case 260 /* CaseClause */: bindCaseClause(node); break; case 222 /* LabeledStatement */: @@ -22850,10 +22948,10 @@ var ts; case 181 /* CallExpression */: bindCallExpressionFlow(node); break; - case 275 /* JSDocComment */: + case 278 /* JSDocComment */: bindJSDocComment(node); break; - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: bindJSDocTypedefTag(node); break; default: @@ -23247,7 +23345,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 258 /* DefaultClause */; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 261 /* DefaultClause */; }); // We mark a switch statement as possibly exhaustive if it has no default clause and if all // case clauses have unreachable end points (e.g. they all return). node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; @@ -23346,13 +23444,13 @@ var ts; else if (node.kind === 178 /* ObjectLiteralExpression */) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 261 /* PropertyAssignment */) { + if (p.kind === 264 /* PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 262 /* ShorthandPropertyAssignment */) { + else if (p.kind === 265 /* ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 263 /* SpreadAssignment */) { + else if (p.kind === 266 /* SpreadAssignment */) { bindAssignmentTargetFlow(p.expression); } } @@ -23458,7 +23556,7 @@ var ts; } function bindJSDocComment(node) { ts.forEachChild(node, function (n) { - if (n.kind !== 283 /* JSDocTypedefTag */) { + if (n.kind !== 286 /* JSDocTypedefTag */) { bind(n); } }); @@ -23504,8 +23602,8 @@ var ts; case 232 /* EnumDeclaration */: case 178 /* ObjectLiteralExpression */: case 163 /* TypeLiteral */: - case 285 /* JSDocTypeLiteral */: - case 254 /* JsxAttributes */: + case 288 /* JSDocTypeLiteral */: + case 257 /* JsxAttributes */: return 1 /* IsContainer */; case 230 /* InterfaceDeclaration */: return 1 /* IsContainer */ | 64 /* IsInterface */; @@ -23513,7 +23611,7 @@ var ts; case 231 /* TypeAliasDeclaration */: case 172 /* MappedType */: return 1 /* IsContainer */ | 32 /* HasLocals */; - case 265 /* SourceFile */: + case 268 /* SourceFile */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */; case 151 /* MethodDeclaration */: if (ts.isObjectLiteralOrClassExpressionMethod(node)) { @@ -23526,7 +23624,7 @@ var ts; case 153 /* GetAccessor */: case 154 /* SetAccessor */: case 155 /* CallSignature */: - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: case 160 /* FunctionType */: case 156 /* ConstructSignature */: case 157 /* IndexSignature */: @@ -23539,7 +23637,7 @@ var ts; return 4 /* IsControlFlowContainer */; case 149 /* PropertyDeclaration */: return node.initializer ? 4 /* IsControlFlowContainer */ : 0; - case 260 /* CatchClause */: + case 263 /* CatchClause */: case 214 /* ForStatement */: case 215 /* ForInStatement */: case 216 /* ForOfStatement */: @@ -23580,7 +23678,7 @@ var ts; // handlers to take care of declaring these child members. case 233 /* ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 265 /* SourceFile */: + case 268 /* SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); case 199 /* ClassExpression */: case 229 /* ClassDeclaration */: @@ -23588,10 +23686,10 @@ var ts; case 232 /* EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); case 163 /* TypeLiteral */: - case 285 /* JSDocTypeLiteral */: + case 288 /* JSDocTypeLiteral */: case 178 /* ObjectLiteralExpression */: case 230 /* InterfaceDeclaration */: - case 254 /* JsxAttributes */: + case 257 /* JsxAttributes */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the @@ -23611,7 +23709,7 @@ var ts; case 228 /* FunctionDeclaration */: case 186 /* FunctionExpression */: case 187 /* ArrowFunction */: - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: case 231 /* TypeAliasDeclaration */: case 172 /* MappedType */: // All the children of these container types are never visible through another @@ -23634,8 +23732,8 @@ var ts; : declareSymbol(file.locals, /*parent*/ undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 265 /* SourceFile */ ? node : node.body; - if (body && (body.kind === 265 /* SourceFile */ || body.kind === 234 /* ModuleBlock */)) { + var body = node.kind === 268 /* SourceFile */ ? node : node.body; + if (body && (body.kind === 268 /* SourceFile */ || body.kind === 234 /* ModuleBlock */)) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; if (stat.kind === 244 /* ExportDeclaration */ || stat.kind === 243 /* ExportAssignment */) { @@ -23733,7 +23831,7 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 263 /* SpreadAssignment */ || prop.name.kind !== 71 /* Identifier */) { + if (prop.kind === 266 /* SpreadAssignment */ || prop.name.kind !== 71 /* Identifier */) { continue; } var identifier = prop.name; @@ -23745,7 +23843,7 @@ var ts; // c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true. // 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 === 261 /* PropertyAssignment */ || prop.kind === 262 /* ShorthandPropertyAssignment */ || prop.kind === 151 /* MethodDeclaration */ + var currentKind = prop.kind === 264 /* PropertyAssignment */ || prop.kind === 265 /* ShorthandPropertyAssignment */ || prop.kind === 151 /* MethodDeclaration */ ? 1 /* Property */ : 2 /* Accessor */; var existingKind = seen.get(identifier.escapedText); @@ -23779,7 +23877,7 @@ var ts; case 233 /* ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 265 /* SourceFile */: + case 268 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -23889,7 +23987,7 @@ var ts; function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 /* ES2015 */) { // Report error if function is not top level function declaration - if (blockScopeContainer.kind !== 265 /* SourceFile */ && + if (blockScopeContainer.kind !== 268 /* SourceFile */ && blockScopeContainer.kind !== 233 /* ModuleDeclaration */ && !ts.isFunctionLike(blockScopeContainer)) { // We check first if the name is inside class declaration or class expression; if so give explicit message @@ -23992,7 +24090,7 @@ var ts; } for (var _b = 0, _c = jsDoc.tags; _b < _c.length; _b++) { var tag = _c[_b]; - if (tag.kind === 283 /* JSDocTypedefTag */) { + if (tag.kind === 286 /* JSDocTypedefTag */) { var savedParent = parent; parent = jsDoc; bind(tag); @@ -24031,7 +24129,7 @@ var ts; // current "blockScopeContainer" needs to be set to its immediate namespace parent. if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 283 /* JSDocTypedefTag */) { + while (parentNode && parentNode.kind !== 286 /* JSDocTypedefTag */) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); @@ -24039,7 +24137,7 @@ var ts; } // falls through case 99 /* ThisKeyword */: - if (currentFlow && (ts.isExpression(node) || parent.kind === 262 /* ShorthandPropertyAssignment */)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 265 /* ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); @@ -24073,7 +24171,7 @@ var ts; ts.Debug.fail("Unknown special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return checkStrictModeCatchClause(node); case 188 /* DeleteExpression */: return checkStrictModeDeleteExpression(node); @@ -24102,10 +24200,10 @@ var ts; case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: return bindPropertyWorker(node); - case 261 /* PropertyAssignment */: - case 262 /* ShorthandPropertyAssignment */: + case 264 /* PropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */); - case 264 /* EnumMember */: + case 267 /* EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 900095 /* EnumMemberExcludes */); case 155 /* CallSignature */: case 156 /* ConstructSignature */: @@ -24127,11 +24225,11 @@ var ts; case 154 /* SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */); case 160 /* FunctionType */: - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: case 161 /* ConstructorType */: return bindFunctionOrConstructorType(node); case 163 /* TypeLiteral */: - case 285 /* JSDocTypeLiteral */: + case 288 /* JSDocTypeLiteral */: case 172 /* MappedType */: return bindAnonymousTypeWorker(node); case 178 /* ObjectLiteralExpression */: @@ -24159,9 +24257,9 @@ var ts; case 233 /* ModuleDeclaration */: return bindModuleDeclaration(node); // Jsx-attributes - case 254 /* JsxAttributes */: + case 257 /* JsxAttributes */: return bindJsxAttributes(node); - case 253 /* JsxAttribute */: + case 256 /* JsxAttribute */: return bindJsxAttribute(node, 4 /* Property */, 0 /* PropertyExcludes */); // Imports and exports case 237 /* ImportEqualsDeclaration */: @@ -24177,7 +24275,7 @@ var ts; return bindExportDeclaration(node); case 243 /* ExportAssignment */: return bindExportAssignment(node); - case 265 /* SourceFile */: + case 268 /* SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); case 207 /* Block */: @@ -24187,18 +24285,18 @@ var ts; // falls through case 234 /* ModuleBlock */: return updateStrictModeStatementList(node.statements); - case 279 /* JSDocParameterTag */: - if (node.parent.kind !== 285 /* JSDocTypeLiteral */) { + case 282 /* JSDocParameterTag */: + if (node.parent.kind !== 288 /* JSDocTypeLiteral */) { break; } // falls through - case 284 /* JSDocPropertyTag */: + case 287 /* JSDocPropertyTag */: var propTag = node; - var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 272 /* JSDocOptionalType */ ? + var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 275 /* JSDocOptionalType */ ? 4 /* Property */ | 16777216 /* Optional */ : 4 /* Property */; return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* PropertyExcludes */); - case 283 /* JSDocTypedefTag */: { + case 286 /* JSDocTypedefTag */: { var fullName = node.fullName; if (!fullName || fullName.kind === 71 /* Identifier */) { return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); @@ -24253,7 +24351,7 @@ var ts; if (node.modifiers && node.modifiers.length) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); } - if (node.parent.kind !== 265 /* SourceFile */) { + if (node.parent.kind !== 268 /* SourceFile */) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); return; } @@ -24617,9 +24715,9 @@ var ts; return computeClassDeclaration(node, subtreeFlags); case 199 /* ClassExpression */: return computeClassExpression(node, subtreeFlags); - case 259 /* HeritageClause */: + case 262 /* HeritageClause */: return computeHeritageClause(node, subtreeFlags); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return computeCatchClause(node, subtreeFlags); case 201 /* ExpressionWithTypeArguments */: return computeExpressionWithTypeArguments(node, subtreeFlags); @@ -25123,7 +25221,7 @@ var ts; case 124 /* DeclareKeyword */: case 76 /* ConstKeyword */: case 232 /* EnumDeclaration */: - case 264 /* EnumMember */: + case 267 /* EnumMember */: case 184 /* TypeAssertionExpression */: case 202 /* AsExpression */: case 203 /* NonNullExpression */: @@ -25136,10 +25234,13 @@ var ts; case 251 /* JsxOpeningElement */: case 10 /* JsxText */: case 252 /* JsxClosingElement */: - case 253 /* JsxAttribute */: - case 254 /* JsxAttributes */: - case 255 /* JsxSpreadAttribute */: - case 256 /* JsxExpression */: + case 253 /* JsxFragment */: + case 254 /* JsxOpeningFragment */: + case 255 /* JsxClosingFragment */: + case 256 /* JsxAttribute */: + case 257 /* JsxAttributes */: + case 258 /* JsxSpreadAttribute */: + case 259 /* JsxExpression */: // These nodes are Jsx syntax. transformFlags |= 4 /* AssertJsx */; break; @@ -25149,7 +25250,7 @@ var ts; case 16 /* TemplateTail */: case 196 /* TemplateExpression */: case 183 /* TaggedTemplateExpression */: - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: case 115 /* StaticKeyword */: case 204 /* MetaProperty */: // These nodes are ES6 syntax. @@ -25234,7 +25335,7 @@ var ts; case 198 /* SpreadElement */: transformFlags |= 192 /* AssertES2015 */ | 524288 /* ContainsSpread */; break; - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectSpread */; break; case 97 /* SuperKeyword */: @@ -25302,7 +25403,7 @@ var ts; transformFlags |= 192 /* AssertES2015 */; } break; - case 265 /* SourceFile */: + case 268 /* SourceFile */: if (subtreeFlags & 32768 /* ContainsCapturedLexicalThis */) { transformFlags |= 192 /* AssertES2015 */; } @@ -25372,7 +25473,7 @@ var ts; return -3 /* TypeExcludes */; case 178 /* ObjectLiteralExpression */: return 540087617 /* ObjectLiteralExcludes */; - case 260 /* CatchClause */: + case 263 /* CatchClause */: return 537920833 /* CatchClauseExcludes */; case 174 /* ObjectBindingPattern */: case 175 /* ArrayBindingPattern */: @@ -26268,7 +26369,7 @@ var ts; return type.flags & 32768 /* Object */ ? type.objectFlags : 0; } function isGlobalSourceFile(node) { - return node.kind === 265 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 268 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -26434,7 +26535,7 @@ var ts; // - parameters are only in the scope of function body // This restriction does not apply to JSDoc comment types because they are parented // at a higher level than type parameters would normally be - if (meaning & result.flags & 793064 /* Type */ && lastLocation.kind !== 275 /* JSDocComment */) { + if (meaning & result.flags & 793064 /* Type */ && lastLocation.kind !== 278 /* JSDocComment */) { useResult = result.flags & 262144 /* TypeParameter */ // type parameters are visible in parameter list, return type and type parameter list ? lastLocation === location.type || @@ -26463,14 +26564,14 @@ var ts; } } switch (location.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; // falls through case 233 /* ModuleDeclaration */: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 265 /* SourceFile */ || ts.isAmbientModule(location)) { + if (location.kind === 268 /* SourceFile */ || ts.isAmbientModule(location)) { // It's an external module. First see if the module has an export default and if the local // name of that export default matches. if (result = moduleExports.get("default")) { @@ -26643,7 +26744,7 @@ var ts; } if (!result) { if (lastLocation) { - ts.Debug.assert(lastLocation.kind === 265 /* SourceFile */); + ts.Debug.assert(lastLocation.kind === 268 /* SourceFile */); if (lastLocation.commonJsModuleIndicator && name === "exports") { return lastLocation.symbol; } @@ -27468,7 +27569,7 @@ var ts; } } switch (location.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } @@ -27659,7 +27760,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 265 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 268 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -27965,7 +28066,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || // is exported function symbol ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 265 /* SourceFile */ || declaration.parent.kind === 234 /* ModuleBlock */; + return declaration.parent.kind === 268 /* SourceFile */ || declaration.parent.kind === 234 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -28732,7 +28833,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || // is exported function symbol ts.some(symbol.declarations, function (declaration) { - return declaration.parent.kind === 265 /* SourceFile */ || declaration.parent.kind === 234 /* ModuleBlock */; + return declaration.parent.kind === 268 /* SourceFile */ || declaration.parent.kind === 234 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -29142,7 +29243,7 @@ var ts; var parent = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedModifierFlags(node) & 1 /* Export */) && - !(node.kind !== 237 /* ImportEqualsDeclaration */ && parent.kind !== 265 /* SourceFile */ && ts.isInAmbientContext(parent))) { + !(node.kind !== 237 /* ImportEqualsDeclaration */ && parent.kind !== 268 /* SourceFile */ && ts.isInAmbientContext(parent))) { return isGlobalSourceFile(parent); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible @@ -29184,7 +29285,7 @@ var ts; // Type parameters are always visible case 145 /* TypeParameter */: // Source file and namespace export are always visible - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 236 /* NamespaceExportDeclaration */: return true; // Export assignments do not create name bindings outside the module @@ -29537,7 +29638,7 @@ var ts; return trueType; } // If it is a short-hand property assignment, use the type of the identifier - if (declaration.kind === 262 /* ShorthandPropertyAssignment */) { + if (declaration.kind === 265 /* ShorthandPropertyAssignment */) { return checkIdentifier(declaration.name); } // If the declaration specifies a binding pattern, use the type implied by the binding pattern @@ -29681,7 +29782,7 @@ var ts; // During a normal type check we'll never get to here with a property assignment (the check of the containing // object literal uses a different path). We exclude widening only so that language services and type verification // tools see the actual type. - if (declaration.kind === 261 /* PropertyAssignment */) { + if (declaration.kind === 264 /* PropertyAssignment */) { return type; } return getWidenedType(type); @@ -29968,13 +30069,13 @@ var ts; case 150 /* MethodSignature */: case 160 /* FunctionType */: case 161 /* ConstructorType */: - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: case 228 /* FunctionDeclaration */: case 151 /* MethodDeclaration */: case 186 /* FunctionExpression */: case 187 /* ArrowFunction */: case 231 /* TypeAliasDeclaration */: - case 282 /* JSDocTemplateTag */: + case 285 /* JSDocTemplateTag */: case 172 /* MappedType */: var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); if (node.kind === 172 /* MappedType */) { @@ -30270,9 +30371,9 @@ var ts; return unknownType; } var declaration = ts.find(symbol.declarations, function (d) { - return d.kind === 283 /* JSDocTypedefTag */ || d.kind === 231 /* TypeAliasDeclaration */; + return d.kind === 286 /* JSDocTypedefTag */ || d.kind === 231 /* TypeAliasDeclaration */; }); - var typeNode = declaration.kind === 283 /* JSDocTypedefTag */ ? declaration.typeExpression : declaration.type; + var typeNode = declaration.kind === 286 /* JSDocTypedefTag */ ? declaration.typeExpression : declaration.type; // If typeNode is missing, we will error in checkJSDocTypedefTag. var type = typeNode ? getTypeFromTypeNode(typeNode) : unknownType; if (popTypeResolution()) { @@ -31379,7 +31480,7 @@ var ts; } function isJSDocOptionalParameter(node) { if (ts.isInJavaScriptFile(node)) { - if (node.type && node.type.kind === 272 /* JSDocOptionalType */) { + if (node.type && node.type.kind === 275 /* JSDocOptionalType */) { return true; } var paramTags = ts.getJSDocParameterTags(node); @@ -31390,7 +31491,7 @@ var ts; return true; } if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 272 /* JSDocOptionalType */; + return paramTag.typeExpression.type.kind === 275 /* JSDocOptionalType */; } } } @@ -31627,7 +31728,7 @@ var ts; case 154 /* SetAccessor */: case 186 /* FunctionExpression */: case 187 /* ArrowFunction */: - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: // Don't include signature if node is the implementation of an overloaded function. A node is considered // an implementation node if it has a body and the previous node is of the same kind and immediately // precedes the implementation node (i.e. has the same parent and ends where the implementation starts). @@ -32949,8 +33050,8 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 119 /* AnyKeyword */: - case 268 /* JSDocAllType */: - case 269 /* JSDocUnknownType */: + case 271 /* JSDocAllType */: + case 272 /* JSDocUnknownType */: return anyType; case 136 /* StringKeyword */: return stringType; @@ -32991,18 +33092,18 @@ var ts; return getTypeFromUnionTypeNode(node); case 167 /* IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 270 /* JSDocNullableType */: + case 273 /* JSDocNullableType */: return getTypeFromJSDocNullableTypeNode(node); case 168 /* ParenthesizedType */: - case 271 /* JSDocNonNullableType */: - case 272 /* JSDocOptionalType */: - case 267 /* JSDocTypeExpression */: + case 274 /* JSDocNonNullableType */: + case 275 /* JSDocOptionalType */: + case 270 /* JSDocTypeExpression */: return getTypeFromTypeNode(node.type); case 160 /* FunctionType */: case 161 /* ConstructorType */: case 163 /* TypeLiteral */: - case 285 /* JSDocTypeLiteral */: - case 273 /* JSDocFunctionType */: + case 288 /* JSDocTypeLiteral */: + case 276 /* JSDocFunctionType */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 170 /* TypeOperator */: return getTypeFromTypeOperatorNode(node); @@ -33016,7 +33117,7 @@ var ts; case 143 /* QualifiedName */: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); - case 274 /* JSDocVariadicType */: + case 277 /* JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); default: return unknownType; @@ -33310,16 +33411,16 @@ var ts; case 194 /* BinaryExpression */: return node.operatorToken.kind === 54 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: return isContextSensitive(node.initializer); case 185 /* ParenthesizedExpression */: return isContextSensitive(node.expression); - case 254 /* JsxAttributes */: + case 257 /* JsxAttributes */: return ts.forEach(node.properties, isContextSensitive); - case 253 /* JsxAttribute */: + case 256 /* JsxAttribute */: // If there is no initializer, JSX attribute has a boolean value of true which is not context sensitive. return node.initializer && isContextSensitive(node.initializer); - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: // It is possible to that node.expression is undefined (e.g
) return node.expression && isContextSensitive(node.expression); } @@ -36075,7 +36176,7 @@ var ts; } function getAssignedTypeOfBinaryExpression(node) { var isDestructuringDefaultAssignment = node.parent.kind === 177 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || - node.parent.kind === 261 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); + node.parent.kind === 264 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); @@ -36111,9 +36212,9 @@ var ts; return getAssignedTypeOfArrayLiteralElement(parent, node); case 198 /* SpreadElement */: return getAssignedTypeOfSpreadExpression(parent); - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent); - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return unknownType; @@ -36185,7 +36286,7 @@ var ts; getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 257 /* CaseClause */) { + if (clause.kind === 260 /* CaseClause */) { var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } @@ -37018,7 +37119,7 @@ var ts; return ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || node.kind === 234 /* ModuleBlock */ || - node.kind === 265 /* SourceFile */ || + node.kind === 268 /* SourceFile */ || node.kind === 149 /* PropertyDeclaration */; }); } @@ -37230,7 +37331,7 @@ var ts; function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 /* ES2015 */ || (symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 || - symbol.valueDeclaration.parent.kind === 260 /* CatchClause */) { + symbol.valueDeclaration.parent.kind === 263 /* CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -37439,7 +37540,7 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 273 /* JSDocFunctionType */) { + if (jsdocType && jsdocType.kind === 276 /* JSDocFunctionType */) { var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && @@ -37633,7 +37734,7 @@ var ts; return (func.kind === 151 /* MethodDeclaration */ || func.kind === 153 /* GetAccessor */ || func.kind === 154 /* SetAccessor */) && func.parent.kind === 178 /* ObjectLiteralExpression */ ? func.parent : - func.kind === 186 /* FunctionExpression */ && func.parent.kind === 261 /* PropertyAssignment */ ? func.parent.parent : + func.kind === 186 /* FunctionExpression */ && func.parent.kind === 264 /* PropertyAssignment */ ? func.parent.parent : undefined; } function getThisTypeArgument(type) { @@ -37672,7 +37773,7 @@ var ts; if (thisType) { return instantiateType(thisType, getContextualMapper(containingLiteral)); } - if (literal.parent.kind !== 261 /* PropertyAssignment */) { + if (literal.parent.kind !== 264 /* PropertyAssignment */) { break; } literal = literal.parent.parent; @@ -37961,7 +38062,12 @@ var ts; // JSX expression can appear in two position : JSX Element's children or JSX attribute var jsxAttributes = ts.isJsxAttributeLike(node.parent) ? node.parent.parent : - node.parent.openingElement.attributes; // node.parent is JsxElement + ts.isJsxElement(node.parent) ? + node.parent.openingElement.attributes : + undefined; // node.parent is JsxFragment with no attributes + if (!jsxAttributes) { + return undefined; // don't check children of a fragment + } // When we trying to resolve JsxOpeningLikeElement as a stateless function element, we will already give its attributes a contextual type // which is a type of the parameter of the signature we are trying out. // If there is no contextual type (e.g. we are trying to resolve stateful component), get attributes type from resolving element's tagName @@ -38050,10 +38156,10 @@ var ts; return getTypeFromTypeNode(parent.type); case 194 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 261 /* PropertyAssignment */: - case 262 /* ShorthandPropertyAssignment */: + case 264 /* PropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent); - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: return getApparentTypeOfContextualType(parent.parent); case 177 /* ArrayLiteralExpression */: { var arrayLiteral = parent; @@ -38070,10 +38176,10 @@ var ts; var tag = ts.isInJavaScriptFile(parent) ? ts.getJSDocTypeTag(parent) : undefined; return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(parent); } - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: return getContextualTypeForJsxExpression(parent); - case 253 /* JsxAttribute */: - case 255 /* JsxSpreadAttribute */: + case 256 /* JsxAttribute */: + case 258 /* JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent); case 251 /* JsxOpeningElement */: case 250 /* JsxSelfClosingElement */: @@ -38346,15 +38452,15 @@ var ts; var memberDecl = node.properties[i]; var member = memberDecl.symbol; var literalName = void 0; - if (memberDecl.kind === 261 /* PropertyAssignment */ || - memberDecl.kind === 262 /* ShorthandPropertyAssignment */ || + if (memberDecl.kind === 264 /* PropertyAssignment */ || + memberDecl.kind === 265 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { var jsdocType = void 0; if (isInJSFile) { jsdocType = getTypeForDeclarationFromJSDocComment(memberDecl); } var type = void 0; - if (memberDecl.kind === 261 /* PropertyAssignment */) { + if (memberDecl.kind === 264 /* PropertyAssignment */) { if (memberDecl.name.kind === 144 /* ComputedPropertyName */) { var t = checkComputedPropertyName(memberDecl.name); if (t.flags & 224 /* Literal */) { @@ -38367,7 +38473,7 @@ var ts; type = checkObjectLiteralMethod(memberDecl, checkMode); } else { - ts.Debug.assert(memberDecl.kind === 262 /* ShorthandPropertyAssignment */); + ts.Debug.assert(memberDecl.kind === 265 /* ShorthandPropertyAssignment */); type = checkExpressionForMutableLocation(memberDecl.name, checkMode); } if (jsdocType) { @@ -38379,8 +38485,8 @@ var ts; if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. - var isOptional = (memberDecl.kind === 261 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 262 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 264 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 265 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 16777216 /* Optional */; } @@ -38408,7 +38514,7 @@ var ts; prop.target = member; member = prop; } - else if (memberDecl.kind === 263 /* SpreadAssignment */) { + else if (memberDecl.kind === 266 /* SpreadAssignment */) { if (languageVersion < 2 /* ES2015 */) { checkExternalEmitHelpers(memberDecl, 2 /* Assign */); } @@ -38498,12 +38604,12 @@ var ts; type.flags & 196608 /* UnionOrIntersection */ && !ts.forEach(type.types, function (t) { return !isValidSpreadType(t); })); } function checkJsxSelfClosingElement(node) { - checkJsxOpeningLikeElement(node); + checkJsxOpeningLikeElementOrOpeningFragment(node); return getJsxGlobalElementType() || anyType; } function checkJsxElement(node) { // Check attributes - checkJsxOpeningLikeElement(node.openingElement); + checkJsxOpeningLikeElementOrOpeningFragment(node.openingElement); // Perform resolution on the closing tag so that rename/go to definition/etc work if (isJsxIntrinsicIdentifier(node.closingElement.tagName)) { getIntrinsicTagSymbol(node.closingElement); @@ -38513,6 +38619,13 @@ var ts; } return getJsxGlobalElementType() || anyType; } + function checkJsxFragment(node) { + checkJsxOpeningLikeElementOrOpeningFragment(node.openingFragment); + if (compilerOptions.jsx === 2 /* React */ && compilerOptions.jsxFactory) { + error(node, ts.Diagnostics.JSX_fragment_is_not_supported_when_using_jsxFactory); + } + return getJsxGlobalElementType() || anyType; + } /** * Returns true iff the JSX element name would be a valid JS identifier, ignoring restrictions about keywords not being identifiers */ @@ -38575,7 +38688,7 @@ var ts; } } else { - ts.Debug.assert(attributeDecl.kind === 255 /* JsxSpreadAttribute */); + ts.Debug.assert(attributeDecl.kind === 258 /* JsxSpreadAttribute */); if (attributesArray.length > 0) { spread = getSpreadType(spread, createJsxAttributesType(attributes.symbol, attributesTable), openingLikeElement.symbol, /*propagatedFlags*/ 0); attributesArray = []; @@ -38612,20 +38725,7 @@ var ts; var parent = openingLikeElement.parent.kind === 249 /* JsxElement */ ? openingLikeElement.parent : undefined; // We have to check that openingElement of the parent is the one we are visiting as this may not be true for selfClosingElement if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) { - var childrenTypes = []; - for (var _c = 0, _d = parent.children; _c < _d.length; _c++) { - var child = _d[_c]; - // In React, JSX text that contains only whitespaces will be ignored so we don't want to type-check that - // because then type of children property will have constituent of string type. - if (child.kind === 10 /* JsxText */) { - if (!child.containsOnlyWhiteSpaces) { - childrenTypes.push(stringType); - } - } - else { - childrenTypes.push(checkExpression(child, checkMode)); - } - } + var childrenTypes = checkJsxChildren(parent, checkMode); if (!hasSpreadAnyType && jsxChildrenPropertyName && jsxChildrenPropertyName !== "") { // Error if there is a attribute named "children" explicitly specified and children element. // This is because children element will overwrite the value from attributes. @@ -38659,6 +38759,23 @@ var ts; return result; } } + function checkJsxChildren(node, checkMode) { + var childrenTypes = []; + for (var _i = 0, _a = node.children; _i < _a.length; _i++) { + var child = _a[_i]; + // In React, JSX text that contains only whitespaces will be ignored so we don't want to type-check that + // because then type of children property will have constituent of string type. + if (child.kind === 10 /* JsxText */) { + if (!child.containsOnlyWhiteSpaces) { + childrenTypes.push(stringType); + } + } + else { + childrenTypes.push(checkExpression(child, checkMode)); + } + } + return childrenTypes; + } /** * Check attributes property of opening-like element. This function is called during chooseOverload to get call signature of a JSX opening-like element. * (See "checkApplicableSignatureForJsxOpeningLikeElement" for how the function is used) @@ -39126,14 +39243,18 @@ var ts; } } } - function checkJsxOpeningLikeElement(node) { - checkGrammarJsxElement(node); + function checkJsxOpeningLikeElementOrOpeningFragment(node) { + var isNodeOpeningLikeElement = ts.isJsxOpeningLikeElement(node); + if (isNodeOpeningLikeElement) { + checkGrammarJsxElement(node); + } checkJsxPreconditions(node); // The reactNamespace/jsxFactory's root symbol should be marked as 'used' so we don't incorrectly elide its import. // And if there is no reactNamespace/jsxFactory's symbol in scope when targeting React emit, we should issue an error. var reactRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? ts.Diagnostics.Cannot_find_name_0 : undefined; var reactNamespace = getJsxNamespace(); - var reactSym = resolveName(node.tagName, reactNamespace, 107455 /* Value */, reactRefErr, reactNamespace, /*isUse*/ true); + var reactLocation = isNodeOpeningLikeElement ? node.tagName : node; + var reactSym = resolveName(reactLocation, reactNamespace, 107455 /* Value */, reactRefErr, reactNamespace, /*isUse*/ true); if (reactSym) { // Mark local symbol as referenced here because it might not have been marked // if jsx emit was not react as there wont be error being emitted @@ -39143,7 +39264,12 @@ var ts; markAliasSymbolAsReferenced(reactSym); } } - checkJsxAttributesAssignableToTagNameAttributes(node); + if (isNodeOpeningLikeElement) { + checkJsxAttributesAssignableToTagNameAttributes(node); + } + else { + checkJsxChildren(node.parent); + } } /** * Check if a property with the given name is known anywhere in the given type. In an object type, a property @@ -39426,7 +39552,7 @@ var ts; switch (node.kind) { case 149 /* PropertyDeclaration */: return true; - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: // We might be in `a = { b: this.b }`, so keep looking. See `tests/cases/compiler/useBeforeDeclaration_propertyAssignment.ts`. return false; default: @@ -41802,7 +41928,7 @@ var ts; } /** Note: If property cannot be a SpreadAssignment, then allProperties does not need to be provided */ function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { - if (property.kind === 261 /* PropertyAssignment */ || property.kind === 262 /* ShorthandPropertyAssignment */) { + if (property.kind === 264 /* PropertyAssignment */ || property.kind === 265 /* ShorthandPropertyAssignment */) { var name = property.name; if (name.kind === 144 /* ComputedPropertyName */) { checkComputedPropertyName(name); @@ -41817,7 +41943,7 @@ var ts; isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1 /* Number */) || getIndexTypeOfType(objectLiteralType, 0 /* String */); if (type) { - if (property.kind === 262 /* ShorthandPropertyAssignment */) { + if (property.kind === 265 /* ShorthandPropertyAssignment */) { return checkDestructuringAssignment(property, type); } else { @@ -41829,7 +41955,7 @@ var ts; error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name)); } } - else if (property.kind === 263 /* SpreadAssignment */) { + else if (property.kind === 266 /* SpreadAssignment */) { if (languageVersion < 5 /* ESNext */) { checkExternalEmitHelpers(property, 4 /* Rest */); } @@ -41905,7 +42031,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode) { var target; - if (exprOrAssignment.kind === 262 /* ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 265 /* ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { // In strict null checking mode, if a default value of a non-undefined type is specified, remove @@ -41935,7 +42061,7 @@ var ts; } function checkReferenceAssignment(target, sourceType, checkMode) { var targetType = checkExpression(target, checkMode); - var error = target.parent.kind === 263 /* SpreadAssignment */ ? + var error = target.parent.kind === 266 /* SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; if (checkReferenceExpression(target, error)) { @@ -42534,13 +42660,15 @@ var ts; return undefinedWideningType; case 197 /* YieldExpression */: return checkYieldExpression(node); - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: return checkJsxExpression(node, checkMode); case 249 /* JsxElement */: return checkJsxElement(node); case 250 /* JsxSelfClosingElement */: return checkJsxSelfClosingElement(node); - case 254 /* JsxAttributes */: + case 253 /* JsxFragment */: + return checkJsxFragment(node); + case 257 /* JsxAttributes */: return checkJsxAttributes(node, checkMode); case 251 /* JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); @@ -43478,7 +43606,7 @@ var ts; case 230 /* InterfaceDeclaration */: case 231 /* TypeAliasDeclaration */: // A jsdoc typedef is, by definition, a type alias - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return 2 /* ExportType */; case 233 /* ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ @@ -43945,7 +44073,7 @@ var ts; error(classLike, ts.Diagnostics.JSDoc_0_is_not_attached_to_a_class, ts.idText(node.tagName)); return; } - var augmentsTags = ts.getAllJSDocTagsOfKind(classLike, 277 /* JSDocAugmentsTag */); + var augmentsTags = ts.getAllJSDocTagsOfKind(classLike, 280 /* JSDocAugmentsTag */); ts.Debug.assert(augmentsTags.length > 0); if (augmentsTags.length > 1) { error(augmentsTags[1], ts.Diagnostics.Class_declarations_cannot_have_more_than_one_augments_or_extends_tag); @@ -44038,7 +44166,7 @@ var ts; for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) { var node = deferredUnusedIdentifierNodes_1[_i]; switch (node.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 233 /* ModuleDeclaration */: checkUnusedModuleMembers(node); break; @@ -44311,7 +44439,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 265 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 268 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -44326,7 +44454,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 265 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { + if (parent.kind === 268 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -44383,7 +44511,7 @@ var ts; (container.kind === 207 /* Block */ && ts.isFunctionLike(container.parent) || container.kind === 234 /* ModuleBlock */ || container.kind === 233 /* ModuleDeclaration */ || - container.kind === 265 /* SourceFile */); + container.kind === 268 /* SourceFile */); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error // otherwise if variable has an initializer - show error that initialization will fail @@ -45124,7 +45252,7 @@ var ts; var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 258 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 261 /* DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -45136,7 +45264,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 257 /* CaseClause */) { + if (produceDiagnostics && clause.kind === 260 /* CaseClause */) { var caseClause = clause; // TypeScript 1.0 spec (April 2014): 5.9 // In a 'switch' statement, each 'case' expression must be of a type that is comparable @@ -45809,7 +45937,7 @@ var ts; var declaration = memberSymbol.valueDeclaration; if (declaration !== member) { if (isBlockScopedNameDeclaredBeforeUse(declaration, member)) { - return getNodeLinks(declaration).enumMemberValue; + return getEnumMemberValue(declaration); } error(expr, ts.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums); return 0; @@ -46074,7 +46202,7 @@ var ts; return false; } var inAmbientExternalModule = node.parent.kind === 234 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 265 /* SourceFile */ && !inAmbientExternalModule) { + if (node.parent.kind !== 268 /* SourceFile */ && !inAmbientExternalModule) { error(moduleName, node.kind === 244 /* ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); @@ -46203,7 +46331,7 @@ var ts; var inAmbientExternalModule = node.parent.kind === 234 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 234 /* ModuleBlock */ && !node.moduleSpecifier && ts.isInAmbientContext(node); - if (node.parent.kind !== 265 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + if (node.parent.kind !== 268 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -46220,7 +46348,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 265 /* SourceFile */ || node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 233 /* ModuleDeclaration */; + var isInAppropriateContext = node.parent.kind === 268 /* SourceFile */ || node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 233 /* ModuleDeclaration */; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -46246,7 +46374,7 @@ var ts; // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors. return; } - var container = node.parent.kind === 265 /* SourceFile */ ? node.parent : node.parent.parent; + var container = node.parent.kind === 268 /* SourceFile */ ? node.parent : node.parent.parent; if (container.kind === 233 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); @@ -46396,25 +46524,25 @@ var ts; case 168 /* ParenthesizedType */: case 170 /* TypeOperator */: return checkSourceElement(node.type); - case 277 /* JSDocAugmentsTag */: + case 280 /* JSDocAugmentsTag */: return checkJSDocAugmentsTag(node); - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return checkJSDocTypedefTag(node); - case 279 /* JSDocParameterTag */: + case 282 /* JSDocParameterTag */: return checkJSDocParameterTag(node); - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: checkSignatureDeclaration(node); // falls through - case 274 /* JSDocVariadicType */: - case 271 /* JSDocNonNullableType */: - case 270 /* JSDocNullableType */: - case 268 /* JSDocAllType */: - case 269 /* JSDocUnknownType */: + case 277 /* JSDocVariadicType */: + case 274 /* JSDocNonNullableType */: + case 273 /* JSDocNullableType */: + case 271 /* JSDocAllType */: + case 272 /* JSDocUnknownType */: if (!ts.isInJavaScriptFile(node) && !ts.isInJSDoc(node)) { grammarErrorOnNode(node, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); } return; - case 267 /* JSDocTypeExpression */: + case 270 /* JSDocTypeExpression */: return checkSourceElement(node.type); case 171 /* IndexedAccessType */: return checkIndexedAccessType(node); @@ -46827,10 +46955,10 @@ var ts; return entityNameSymbol; } } - if (entityName.parent.kind === 279 /* JSDocParameterTag */) { + if (entityName.parent.kind === 282 /* JSDocParameterTag */) { return ts.getParameterSymbolFromJSDoc(entityName.parent); } - if (entityName.parent.kind === 145 /* TypeParameter */ && entityName.parent.parent.kind === 282 /* JSDocTemplateTag */) { + if (entityName.parent.kind === 145 /* TypeParameter */ && entityName.parent.parent.kind === 285 /* JSDocTemplateTag */) { ts.Debug.assert(!ts.isInJavaScriptFile(entityName)); // Otherwise `isDeclarationName` would have been true. var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent); return typeParameter && typeParameter.symbol; @@ -46864,7 +46992,7 @@ var ts; var meaning = entityName.parent.kind === 159 /* TypeReference */ ? 793064 /* Type */ : 1920 /* Namespace */; return resolveEntityName(entityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); } - else if (entityName.parent.kind === 253 /* JsxAttribute */) { + else if (entityName.parent.kind === 256 /* JsxAttribute */) { return getJsxAttributePropertySymbol(entityName.parent); } if (entityName.parent.kind === 158 /* TypePredicate */) { @@ -46874,7 +47002,7 @@ var ts; return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 265 /* SourceFile */) { + if (node.kind === 268 /* SourceFile */) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } if (isInsideWithStatementBody(node)) { @@ -46958,7 +47086,7 @@ var ts; // The function returns a value symbol of an identifier in the short-hand property assignment. // This is necessary as an identifier in short-hand property assignment can contains two meaning: // property name and property value. - if (location && location.kind === 262 /* ShorthandPropertyAssignment */) { + if (location && location.kind === 265 /* ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 107455 /* Value */ | 2097152 /* Alias */); } return undefined; @@ -47045,7 +47173,7 @@ var ts; } // If this is from nested object binding pattern // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { - if (expr.parent.kind === 261 /* PropertyAssignment */) { + if (expr.parent.kind === 264 /* PropertyAssignment */) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); } @@ -47190,7 +47318,7 @@ var ts; } var parentSymbol_1 = getParentOfSymbol(symbol); if (parentSymbol_1) { - if (parentSymbol_1.flags & 512 /* ValueModule */ && parentSymbol_1.valueDeclaration.kind === 265 /* SourceFile */) { + if (parentSymbol_1.flags & 512 /* ValueModule */ && parentSymbol_1.valueDeclaration.kind === 268 /* SourceFile */) { var symbolFile = parentSymbol_1.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); // If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined. @@ -47305,7 +47433,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(node) { node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 265 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 268 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -47378,7 +47506,7 @@ var ts; } function canHaveConstantValue(node) { switch (node.kind) { - case 264 /* EnumMember */: + case 267 /* EnumMember */: case 179 /* PropertyAccessExpression */: case 180 /* ElementAccessExpression */: return true; @@ -47386,7 +47514,7 @@ var ts; return false; } function getConstantValue(node) { - if (node.kind === 264 /* EnumMember */) { + if (node.kind === 267 /* EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -47648,7 +47776,7 @@ var ts; break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 265 /* SourceFile */ && current.flags & 512 /* ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 268 /* SourceFile */ && current.flags & 512 /* ValueModule */) { return false; } // check that at least one declaration of top level symbol originates from type declaration file @@ -47668,7 +47796,7 @@ var ts; if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 265 /* SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 268 /* SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors @@ -47838,7 +47966,7 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 265 /* SourceFile */) { + else if (node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 268 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128 /* Abstract */) { @@ -47861,7 +47989,7 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 265 /* SourceFile */) { + else if (node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 268 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } else if (node.kind === 146 /* Parameter */) { @@ -47906,7 +48034,7 @@ var ts; flags |= 1 /* Export */; break; case 79 /* DefaultKeyword */: - var container = node.parent.kind === 265 /* SourceFile */ ? node.parent : node.parent.parent; + var container = node.parent.kind === 268 /* SourceFile */ ? node.parent : node.parent.parent; if (container.kind === 233 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } @@ -48028,7 +48156,7 @@ var ts; case 146 /* Parameter */: return false; default: - if (node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 265 /* SourceFile */) { + if (node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 268 /* SourceFile */) { return false; } switch (node.kind) { @@ -48291,7 +48419,7 @@ var ts; var GetOrSetAccessor = GetAccessor | SetAccessor; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 263 /* SpreadAssignment */) { + if (prop.kind === 266 /* SpreadAssignment */) { continue; } var name = prop.name; @@ -48299,7 +48427,7 @@ var ts; // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name); } - if (prop.kind === 262 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 265 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); @@ -48322,7 +48450,7 @@ 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 = void 0; - if (prop.kind === 261 /* PropertyAssignment */ || prop.kind === 262 /* ShorthandPropertyAssignment */) { + if (prop.kind === 264 /* PropertyAssignment */ || prop.kind === 265 /* ShorthandPropertyAssignment */) { // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name.kind === 8 /* NumericLiteral */) { @@ -48372,7 +48500,7 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 255 /* JsxSpreadAttribute */) { + if (attr.kind === 258 /* JsxSpreadAttribute */) { continue; } var jsxAttr = attr; @@ -48384,7 +48512,7 @@ var ts; return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 256 /* JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 259 /* JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -48824,7 +48952,7 @@ var ts; // to prevent noisiness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 207 /* Block */ || node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 265 /* SourceFile */) { + if (node.parent.kind === 207 /* Block */ || node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 268 /* SourceFile */) { var links_1 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_1.hasReportedStatementInAmbientContext) { @@ -48848,7 +48976,7 @@ var ts; else if (ts.isChildOfNodeWithKind(node, 173 /* LiteralType */)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 264 /* EnumMember */)) { + else if (ts.isChildOfNodeWithKind(node, 267 /* EnumMember */)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -50756,8 +50884,24 @@ var ts; : node; } ts.updateJsxClosingElement = updateJsxClosingElement; + function createJsxFragment(openingFragment, children, closingFragment) { + var node = createSynthesizedNode(253 /* JsxFragment */); + node.openingFragment = openingFragment; + node.children = createNodeArray(children); + node.closingFragment = closingFragment; + return node; + } + ts.createJsxFragment = createJsxFragment; + function updateJsxFragment(node, openingFragment, children, closingFragment) { + return node.openingFragment !== openingFragment + || node.children !== children + || node.closingFragment !== closingFragment + ? updateNode(createJsxFragment(openingFragment, children, closingFragment), node) + : node; + } + ts.updateJsxFragment = updateJsxFragment; function createJsxAttribute(name, initializer) { - var node = createSynthesizedNode(253 /* JsxAttribute */); + var node = createSynthesizedNode(256 /* JsxAttribute */); node.name = name; node.initializer = initializer; return node; @@ -50771,7 +50915,7 @@ var ts; } ts.updateJsxAttribute = updateJsxAttribute; function createJsxAttributes(properties) { - var node = createSynthesizedNode(254 /* JsxAttributes */); + var node = createSynthesizedNode(257 /* JsxAttributes */); node.properties = createNodeArray(properties); return node; } @@ -50783,7 +50927,7 @@ var ts; } ts.updateJsxAttributes = updateJsxAttributes; function createJsxSpreadAttribute(expression) { - var node = createSynthesizedNode(255 /* JsxSpreadAttribute */); + var node = createSynthesizedNode(258 /* JsxSpreadAttribute */); node.expression = expression; return node; } @@ -50795,7 +50939,7 @@ var ts; } ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; function createJsxExpression(dotDotDotToken, expression) { - var node = createSynthesizedNode(256 /* JsxExpression */); + var node = createSynthesizedNode(259 /* JsxExpression */); node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; @@ -50809,7 +50953,7 @@ var ts; ts.updateJsxExpression = updateJsxExpression; // Clauses function createCaseClause(expression, statements) { - var node = createSynthesizedNode(257 /* CaseClause */); + var node = createSynthesizedNode(260 /* CaseClause */); node.expression = ts.parenthesizeExpressionForList(expression); node.statements = createNodeArray(statements); return node; @@ -50823,7 +50967,7 @@ var ts; } ts.updateCaseClause = updateCaseClause; function createDefaultClause(statements) { - var node = createSynthesizedNode(258 /* DefaultClause */); + var node = createSynthesizedNode(261 /* DefaultClause */); node.statements = createNodeArray(statements); return node; } @@ -50835,7 +50979,7 @@ var ts; } ts.updateDefaultClause = updateDefaultClause; function createHeritageClause(token, types) { - var node = createSynthesizedNode(259 /* HeritageClause */); + var node = createSynthesizedNode(262 /* HeritageClause */); node.token = token; node.types = createNodeArray(types); return node; @@ -50848,7 +50992,7 @@ var ts; } ts.updateHeritageClause = updateHeritageClause; function createCatchClause(variableDeclaration, block) { - var node = createSynthesizedNode(260 /* CatchClause */); + var node = createSynthesizedNode(263 /* CatchClause */); node.variableDeclaration = ts.isString(variableDeclaration) ? createVariableDeclaration(variableDeclaration) : variableDeclaration; node.block = block; return node; @@ -50863,7 +51007,7 @@ var ts; ts.updateCatchClause = updateCatchClause; // Property assignments function createPropertyAssignment(name, initializer) { - var node = createSynthesizedNode(261 /* PropertyAssignment */); + var node = createSynthesizedNode(264 /* PropertyAssignment */); node.name = asName(name); node.questionToken = undefined; node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined; @@ -50878,7 +51022,7 @@ var ts; } ts.updatePropertyAssignment = updatePropertyAssignment; function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - var node = createSynthesizedNode(262 /* ShorthandPropertyAssignment */); + var node = createSynthesizedNode(265 /* ShorthandPropertyAssignment */); node.name = asName(name); node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? ts.parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; @@ -50892,7 +51036,7 @@ var ts; } ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment; function createSpreadAssignment(expression) { - var node = createSynthesizedNode(263 /* SpreadAssignment */); + var node = createSynthesizedNode(266 /* SpreadAssignment */); node.expression = expression !== undefined ? ts.parenthesizeExpressionForList(expression) : undefined; return node; } @@ -50905,7 +51049,7 @@ var ts; ts.updateSpreadAssignment = updateSpreadAssignment; // Enum function createEnumMember(name, initializer) { - var node = createSynthesizedNode(264 /* EnumMember */); + var node = createSynthesizedNode(267 /* EnumMember */); node.name = asName(name); node.initializer = initializer && ts.parenthesizeExpressionForList(initializer); return node; @@ -50921,7 +51065,7 @@ var ts; // Top-level nodes function updateSourceFileNode(node, statements) { if (node.statements !== statements) { - var updated = createSynthesizedNode(265 /* SourceFile */); + var updated = createSynthesizedNode(268 /* SourceFile */); updated.flags |= node.flags; updated.statements = createNodeArray(statements); updated.endOfFileToken = node.endOfFileToken; @@ -51000,7 +51144,7 @@ var ts; * @param original The original statement. */ function createNotEmittedStatement(original) { - var node = createSynthesizedNode(287 /* NotEmittedStatement */); + var node = createSynthesizedNode(290 /* NotEmittedStatement */); node.original = original; setTextRange(node, original); return node; @@ -51012,7 +51156,7 @@ var ts; */ /* @internal */ function createEndOfDeclarationMarker(original) { - var node = createSynthesizedNode(291 /* EndOfDeclarationMarker */); + var node = createSynthesizedNode(294 /* EndOfDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -51024,7 +51168,7 @@ var ts; */ /* @internal */ function createMergeDeclarationMarker(original) { - var node = createSynthesizedNode(290 /* MergeDeclarationMarker */); + var node = createSynthesizedNode(293 /* MergeDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -51039,7 +51183,7 @@ var ts; * @param location The location for the expression. Defaults to the positions from "original" if provided. */ function createPartiallyEmittedExpression(expression, original) { - var node = createSynthesizedNode(288 /* PartiallyEmittedExpression */); + var node = createSynthesizedNode(291 /* PartiallyEmittedExpression */); node.expression = expression; node.original = original; setTextRange(node, original); @@ -51055,7 +51199,7 @@ var ts; ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; function flattenCommaElements(node) { if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) { - if (node.kind === 289 /* CommaListExpression */) { + if (node.kind === 292 /* CommaListExpression */) { return node.elements; } if (ts.isBinaryExpression(node) && node.operatorToken.kind === 26 /* CommaToken */) { @@ -51065,7 +51209,7 @@ var ts; return node; } function createCommaList(elements) { - var node = createSynthesizedNode(289 /* CommaListExpression */); + var node = createSynthesizedNode(292 /* CommaListExpression */); node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)); return node; } @@ -51077,7 +51221,7 @@ var ts; } ts.updateCommaList = updateCommaList; function createBundle(sourceFiles) { - var node = ts.createNode(266 /* Bundle */); + var node = ts.createNode(269 /* Bundle */); node.sourceFiles = sourceFiles; return node; } @@ -51213,7 +51357,7 @@ var ts; // To avoid holding onto transformation artifacts, we keep track of any // parse tree node we are annotating. This allows us to clean them up after // all transformations have completed. - if (node.kind === 265 /* SourceFile */) { + if (node.kind === 268 /* SourceFile */) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = ts.getSourceFileOfNode(node); @@ -51603,6 +51747,26 @@ var ts; /*typeArguments*/ undefined, argumentsList), location); } ts.createExpressionForJsxElement = createExpressionForJsxElement; + function createExpressionForJsxFragment(jsxFactoryEntity, reactNamespace, children, parentElement, location) { + var tagName = ts.createPropertyAccess(createReactNamespace(reactNamespace, parentElement), "Fragment"); + var argumentsList = [tagName]; + argumentsList.push(ts.createNull()); + if (children && children.length > 0) { + if (children.length > 1) { + for (var _i = 0, children_2 = children; _i < children_2.length; _i++) { + var child = children_2[_i]; + child.startsOnNewLine = true; + argumentsList.push(child); + } + } + else { + argumentsList.push(children[0]); + } + } + return ts.setTextRange(ts.createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement), + /*typeArguments*/ undefined, argumentsList), location); + } + ts.createExpressionForJsxFragment = createExpressionForJsxFragment; // Helpers function getHelperName(name) { return ts.setEmitFlags(ts.createIdentifier(name), 4096 /* HelperName */ | 2 /* AdviseOnEmitNode */); @@ -51796,9 +51960,9 @@ var ts; case 153 /* GetAccessor */: case 154 /* SetAccessor */: return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: return createExpressionForPropertyAssignment(property, receiver); - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: return createExpressionForShorthandPropertyAssignment(property, receiver); case 151 /* MethodDeclaration */: return createExpressionForMethodDeclaration(property, receiver); @@ -52443,7 +52607,7 @@ var ts; case 179 /* PropertyAccessExpression */: node = node.expression; continue; - case 288 /* PartiallyEmittedExpression */: + case 291 /* PartiallyEmittedExpression */: node = node.expression; continue; } @@ -52473,7 +52637,7 @@ var ts; case 202 /* AsExpression */: case 203 /* NonNullExpression */: return (kinds & 2 /* Assertions */) !== 0; - case 288 /* PartiallyEmittedExpression */: + case 291 /* PartiallyEmittedExpression */: return (kinds & 4 /* PartiallyEmittedExpressions */) !== 0; } return false; @@ -52517,7 +52681,7 @@ var ts; case 184 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression); case 202 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type); case 203 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression); - case 288 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression); + case 291 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression); } } /** @@ -52722,7 +52886,7 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: // `b` in `({ a: b } = ...)` // `b` in `({ a: b = 1 } = ...)` // `{b}` in `({ a: {b} } = ...)` @@ -52734,11 +52898,11 @@ var ts; // `b[0]` in `({ a: b[0] } = ...)` // `b[0]` in `({ a: b[0] = 1 } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: // `a` in `({ a } = ...)` // `a` in `({ a = 1 } = ...)` return bindingElement.name; - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: // `a` in `({ ...a } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } @@ -52775,7 +52939,7 @@ var ts; // `...` in `let [...a] = ...` return bindingElement.dotDotDotToken; case 198 /* SpreadElement */: - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: // `...` in `[...a] = ...` return bindingElement; } @@ -52799,7 +52963,7 @@ var ts; : propertyName; } break; - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: // `a` in `({ a: b } = ...)` // `[a]` in `({ [a]: b } = ...)` // `"a"` in `({ "a": b } = ...)` @@ -52811,7 +52975,7 @@ var ts; : propertyName; } break; - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: // `a` in `({ ...a } = ...)` return bindingElement.name; } @@ -53266,40 +53430,42 @@ var ts; return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNode(node.attributes, visitor, ts.isJsxAttributes)); case 252 /* JsxClosingElement */: return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 253 /* JsxAttribute */: + case 253 /* JsxFragment */: + return ts.updateJsxFragment(node, visitNode(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingFragment, visitor, ts.isJsxClosingFragment)); + case 256 /* JsxAttribute */: return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 254 /* JsxAttributes */: + case 257 /* JsxAttributes */: return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); - case 255 /* JsxSpreadAttribute */: + case 258 /* JsxSpreadAttribute */: return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); // Clauses - case 257 /* CaseClause */: + case 260 /* CaseClause */: return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); - case 258 /* DefaultClause */: + case 261 /* DefaultClause */: return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 259 /* HeritageClause */: + case 262 /* HeritageClause */: return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); // Property assignments - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); // Enum - case 264 /* EnumMember */: + case 267 /* EnumMember */: return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); // Top-level nodes - case 265 /* SourceFile */: + case 268 /* SourceFile */: return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); // Transformation nodes - case 288 /* PartiallyEmittedExpression */: + case 291 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); - case 289 /* CommaListExpression */: + case 292 /* CommaListExpression */: return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression)); default: // No need to visit nodes with no children. @@ -53355,7 +53521,7 @@ var ts; case 209 /* EmptyStatement */: case 200 /* OmittedExpression */: case 225 /* DebuggerStatement */: - case 287 /* NotEmittedStatement */: + case 290 /* NotEmittedStatement */: // No need to visit nodes with no children. break; // Names @@ -53672,67 +53838,72 @@ var ts; result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingElement, cbNode, result); break; + case 253 /* JsxFragment */: + result = reduceNode(node.openingFragment, cbNode, result); + result = ts.reduceLeft(node.children, cbNode, result); + result = reduceNode(node.closingFragment, cbNode, result); + break; case 250 /* JsxSelfClosingElement */: case 251 /* JsxOpeningElement */: result = reduceNode(node.tagName, cbNode, result); result = reduceNode(node.attributes, cbNode, result); break; - case 254 /* JsxAttributes */: + case 257 /* JsxAttributes */: result = reduceNodes(node.properties, cbNodes, result); break; case 252 /* JsxClosingElement */: result = reduceNode(node.tagName, cbNode, result); break; - case 253 /* JsxAttribute */: + case 256 /* JsxAttribute */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 255 /* JsxSpreadAttribute */: + case 258 /* JsxSpreadAttribute */: result = reduceNode(node.expression, cbNode, result); break; - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: result = reduceNode(node.expression, cbNode, result); break; // Clauses - case 257 /* CaseClause */: + case 260 /* CaseClause */: result = reduceNode(node.expression, cbNode, result); // falls through - case 258 /* DefaultClause */: + case 261 /* DefaultClause */: result = reduceNodes(node.statements, cbNodes, result); break; - case 259 /* HeritageClause */: + case 262 /* HeritageClause */: result = reduceNodes(node.types, cbNodes, result); break; - case 260 /* CatchClause */: + case 263 /* CatchClause */: result = reduceNode(node.variableDeclaration, cbNode, result); result = reduceNode(node.block, cbNode, result); break; // Property assignments - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: result = reduceNode(node.expression, cbNode, result); break; // Enum - case 264 /* EnumMember */: + case 267 /* EnumMember */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; // Top-level nodes - case 265 /* SourceFile */: + case 268 /* SourceFile */: result = reduceNodes(node.statements, cbNodes, result); break; // Transformation nodes - case 288 /* PartiallyEmittedExpression */: + case 291 /* PartiallyEmittedExpression */: result = reduceNode(node.expression, cbNode, result); break; - case 289 /* CommaListExpression */: + case 292 /* CommaListExpression */: result = reduceNodes(node.elements, cbNodes, result); break; default: @@ -54616,7 +54787,7 @@ var ts; */ function onBeforeVisitNode(node) { switch (node.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 235 /* CaseBlock */: case 234 /* ModuleBlock */: case 207 /* Block */: @@ -54873,7 +55044,7 @@ var ts; // - index signatures // - method overload signatures return visitClassExpression(node); - case 259 /* HeritageClause */: + case 262 /* HeritageClause */: // This is a heritage clause with TypeScript syntax extensions. // // TypeScript heritage clause extensions include: @@ -56713,7 +56884,7 @@ var ts; // enums in any other scope are emitted as a `let` declaration. var statement = ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ ts.createVariableDeclaration(ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)) - ], currentScope.kind === 265 /* SourceFile */ ? 0 /* None */ : 1 /* Let */)); + ], currentScope.kind === 268 /* SourceFile */ ? 0 /* None */ : 1 /* Let */)); ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { @@ -57162,7 +57333,7 @@ var ts; // We need to enable substitutions for identifiers and shorthand property assignments. This allows us to // substitute the names of exported members of a namespace. context.enableSubstitution(71 /* Identifier */); - context.enableSubstitution(262 /* ShorthandPropertyAssignment */); + context.enableSubstitution(265 /* ShorthandPropertyAssignment */); // We need to be notified when entering and exiting namespaces. context.enableEmitNotification(233 /* ModuleDeclaration */); } @@ -57272,7 +57443,7 @@ var ts; // If we are nested within a namespace declaration, we may need to qualifiy // an identifier that is exported from a merged namespace. var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false); - if (container && container.kind !== 265 /* SourceFile */) { + if (container && container.kind !== 268 /* SourceFile */) { var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 233 /* ModuleDeclaration */) || (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 232 /* EnumDeclaration */); if (substitute) { @@ -57794,7 +57965,7 @@ var ts; return visitExpressionStatement(node); case 185 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, noDestructuringValue); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return visitCatchClause(node); default: return ts.visitEachChild(node, visitor, context); @@ -57829,7 +58000,7 @@ var ts; var objects = []; for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { var e = elements_3[_i]; - if (e.kind === 263 /* SpreadAssignment */) { + if (e.kind === 266 /* SpreadAssignment */) { if (chunkObject) { objects.push(ts.createObjectLiteral(chunkObject)); chunkObject = undefined; @@ -57841,7 +58012,7 @@ var ts; if (!chunkObject) { chunkObject = []; } - if (e.kind === 261 /* PropertyAssignment */) { + if (e.kind === 264 /* PropertyAssignment */) { var p = e; chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); } @@ -58373,7 +58544,9 @@ var ts; return visitJsxElement(node, /*isChild*/ false); case 250 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ false); - case 256 /* JsxExpression */: + case 253 /* JsxFragment */: + return visitJsxFragment(node, /*isChild*/ false); + case 259 /* JsxExpression */: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -58383,12 +58556,14 @@ var ts; switch (node.kind) { case 10 /* JsxText */: return visitJsxText(node); - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: return visitJsxExpression(node); case 249 /* JsxElement */: return visitJsxElement(node, /*isChild*/ true); case 250 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ true); + case 253 /* JsxFragment */: + return visitJsxFragment(node, /*isChild*/ true); default: ts.Debug.failBadSyntaxKind(node); return undefined; @@ -58400,6 +58575,9 @@ var ts; function visitJsxSelfClosingElement(node, isChild) { return visitJsxOpeningLikeElement(node, /*children*/ undefined, isChild, /*location*/ node); } + function visitJsxFragment(node, isChild) { + return visitJsxOpeningFragment(node.openingFragment, node.children, isChild, /*location*/ node); + } function visitJsxOpeningLikeElement(node, children, isChild, location) { var tagName = getTagName(node); var objectProperties; @@ -58432,6 +58610,13 @@ var ts; } return element; } + function visitJsxOpeningFragment(node, children, isChild, location) { + var element = ts.createExpressionForJsxFragment(context.getEmitResolver().getJsxFactoryEntity(), compilerOptions.reactNamespace, ts.mapDefined(children, transformJsxChildToExpression), node, location); + if (isChild) { + ts.startOnNewLine(element); + } + return element; + } function transformJsxSpreadAttributeToExpression(node) { return ts.visitNode(node.expression, visitor, ts.isExpression); } @@ -58448,7 +58633,7 @@ var ts; var decoded = tryDecodeEntities(node.text); return decoded ? ts.setTextRange(ts.createLiteral(decoded), node) : node; } - else if (node.kind === 256 /* JsxExpression */) { + else if (node.kind === 259 /* JsxExpression */) { if (node.expression === undefined) { return ts.createTrue(); } @@ -59162,9 +59347,9 @@ var ts; return visitExpressionStatement(node); case 178 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return visitCatchClause(node); - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: return visitShorthandPropertyAssignment(node); case 144 /* ComputedPropertyName */: return visitComputedPropertyName(node); @@ -61063,10 +61248,10 @@ var ts; case 151 /* MethodDeclaration */: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -63324,7 +63509,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 258 /* DefaultClause */ && defaultClauseIndex === -1) { + if (clause.kind === 261 /* DefaultClause */ && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -63337,7 +63522,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 257 /* CaseClause */) { + if (clause.kind === 260 /* CaseClause */) { var caseClause = clause; if (containsYield(caseClause.expression) && pendingClauses.length > 0) { break; @@ -64570,7 +64755,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; context.enableSubstitution(179 /* PropertyAccessExpression */); - context.enableSubstitution(261 /* PropertyAssignment */); + context.enableSubstitution(264 /* PropertyAssignment */); return transformSourceFile; /** * Transforms an ES5 source file to ES3. @@ -64684,8 +64869,8 @@ var ts; context.enableSubstitution(194 /* BinaryExpression */); // Substitutes assignments to exported symbols. context.enableSubstitution(192 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. context.enableSubstitution(193 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(262 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. - context.enableEmitNotification(265 /* SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(265 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. + context.enableEmitNotification(268 /* SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var currentSourceFile; // The current file. @@ -65003,9 +65188,9 @@ var ts; return visitFunctionDeclaration(node); case 229 /* ClassDeclaration */: return visitClassDeclaration(node); - case 290 /* MergeDeclarationMarker */: + case 293 /* MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 291 /* EndOfDeclarationMarker */: + case 294 /* EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return ts.visitEachChild(node, importCallExpressionVisitor, context); @@ -65688,7 +65873,7 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 265 /* SourceFile */) { + if (node.kind === 268 /* SourceFile */) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; noSubstitution = []; @@ -65776,7 +65961,7 @@ var ts; } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 265 /* SourceFile */) { + if (exportContainer && exportContainer.kind === 268 /* SourceFile */) { return ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node)), /*location*/ node); } @@ -65921,7 +66106,7 @@ var ts; context.enableSubstitution(194 /* BinaryExpression */); // Substitutes assignments to exported symbols. context.enableSubstitution(192 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. context.enableSubstitution(193 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableEmitNotification(265 /* SourceFile */); // Restore state when substituting nodes in a file. + context.enableEmitNotification(268 /* SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var exportFunctionsMap = []; // The export function associated with a source file. @@ -66492,7 +66677,7 @@ var ts; function shouldHoistVariableDeclarationList(node) { // hoist only non-block scoped declarations or block scoped declarations parented by source file return (ts.getEmitFlags(node) & 2097152 /* NoHoisting */) === 0 - && (enclosingBlockScopedContainer.kind === 265 /* SourceFile */ + && (enclosingBlockScopedContainer.kind === 268 /* SourceFile */ || (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0); } /** @@ -66819,19 +67004,19 @@ var ts; return visitSwitchStatement(node); case 235 /* CaseBlock */: return visitCaseBlock(node); - case 257 /* CaseClause */: + case 260 /* CaseClause */: return visitCaseClause(node); - case 258 /* DefaultClause */: + case 261 /* DefaultClause */: return visitDefaultClause(node); case 224 /* TryStatement */: return visitTryStatement(node); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return visitCatchClause(node); case 207 /* Block */: return visitBlock(node); - case 290 /* MergeDeclarationMarker */: + case 293 /* MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 291 /* EndOfDeclarationMarker */: + case 294 /* EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return destructuringAndImportCallVisitor(node); @@ -67082,7 +67267,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 265 /* SourceFile */; + return container !== undefined && container.kind === 268 /* SourceFile */; } else { return false; @@ -67115,7 +67300,7 @@ var ts; * @param emitCallback A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 265 /* SourceFile */) { + if (node.kind === 268 /* SourceFile */) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -67287,7 +67472,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); - if (exportContainer && exportContainer.kind === 265 /* SourceFile */) { + if (exportContainer && exportContainer.kind === 268 /* SourceFile */) { exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -67328,7 +67513,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(265 /* SourceFile */); + context.enableEmitNotification(268 /* SourceFile */); context.enableSubstitution(71 /* Identifier */); var currentSourceFile; return transformSourceFile; @@ -67498,7 +67683,7 @@ var ts; * @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files. */ function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) { - var enabledSyntaxKindFeatures = new Array(292 /* Count */); + var enabledSyntaxKindFeatures = new Array(295 /* Count */); var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentVariableDeclarationsStack = []; @@ -67766,8 +67951,8 @@ var ts; } ts.getDeclarationDiagnostics = getDeclarationDiagnostics; function emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFileOrBundle, emitOnlyDtsFiles) { - var sourceFiles = sourceFileOrBundle.kind === 266 /* Bundle */ ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; - var isBundledEmit = sourceFileOrBundle.kind === 266 /* Bundle */; + var sourceFiles = sourceFileOrBundle.kind === 269 /* Bundle */ ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; + var isBundledEmit = sourceFileOrBundle.kind === 269 /* Bundle */; var newLine = host.getNewLine(); var compilerOptions = host.getCompilerOptions(); var write; @@ -68319,9 +68504,9 @@ var ts; writeModuleElement(node); } else if (node.kind === 237 /* ImportEqualsDeclaration */ || - (node.parent.kind === 265 /* SourceFile */ && isCurrentFileExternalModule)) { + (node.parent.kind === 268 /* SourceFile */ && isCurrentFileExternalModule)) { var isVisible = void 0; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 265 /* SourceFile */) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 268 /* SourceFile */) { // Import declaration of another module that is visited async so lets put it in right spot asynchronousSubModuleDeclarationEmitInfo.push({ node: node, @@ -68373,7 +68558,7 @@ var ts; } function emitModuleElementDeclarationFlags(node) { // If the node is parented in the current source file we need to emit export declare or just export - if (node.parent.kind === 265 /* SourceFile */) { + if (node.parent.kind === 268 /* SourceFile */) { var modifiers = ts.getModifierFlags(node); // If the node is exported if (modifiers & 1 /* Export */) { @@ -69395,11 +69580,11 @@ var ts; case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: return emitPropertyDeclaration(node); - case 264 /* EnumMember */: + case 267 /* EnumMember */: return emitEnumMemberDeclaration(node); case 243 /* ExportAssignment */: return emitExportAssignment(node); - case 265 /* SourceFile */: + case 268 /* SourceFile */: return emitSourceFile(node); } } @@ -69427,7 +69612,7 @@ var ts; return addedBundledEmitReference; function getDeclFileName(emitFileNames, sourceFileOrBundle) { // Dont add reference path to this file if it is a bundled emit and caller asked not emit bundled file path - var isBundledEmit = sourceFileOrBundle.kind === 266 /* Bundle */; + var isBundledEmit = sourceFileOrBundle.kind === 269 /* Bundle */; if (isBundledEmit && !addBundledFileReference) { return; } @@ -69442,7 +69627,7 @@ var ts; var emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFileOrBundle, emitOnlyDtsFiles); var emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath) || host.getCompilerOptions().noEmit; if (!emitSkipped) { - var sourceFiles = sourceFileOrBundle.kind === 266 /* Bundle */ ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; + var sourceFiles = sourceFileOrBundle.kind === 269 /* Bundle */ ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; var declarationOutput = emitDeclarationResult.referencesOutput + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo); ts.writeFile(host, emitterDiagnostics, declarationFilePath, declarationOutput, host.getCompilerOptions().emitBOM, sourceFiles); @@ -69552,7 +69737,7 @@ var ts; } if (compilerOptions.mapRoot) { sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); - if (sourceFileOrBundle.kind === 265 /* SourceFile */) { + if (sourceFileOrBundle.kind === 268 /* SourceFile */) { // For modules or multiple emit files the mapRoot will have directory structure like the sources // So if src\a.ts and src\lib\b.ts are compiled together user would be moving the maps into mapRoot\a.js.map and mapRoot\lib\b.js.map sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFileOrBundle, host, sourceMapDir)); @@ -69697,7 +69882,7 @@ var ts; source = undefined; if (source) setSourceFile(source); - if (node.kind !== 287 /* NotEmittedStatement */ + if (node.kind !== 290 /* NotEmittedStatement */ && (emitFlags & 16 /* NoLeadingSourceMap */) === 0 && pos >= 0) { emitPos(skipSourceTrivia(pos)); @@ -69714,7 +69899,7 @@ var ts; } if (source) setSourceFile(source); - if (node.kind !== 287 /* NotEmittedStatement */ + if (node.kind !== 290 /* NotEmittedStatement */ && (emitFlags & 32 /* NoTrailingSourceMap */) === 0 && end >= 0) { emitPos(end); @@ -69891,7 +70076,7 @@ var ts; if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 287 /* NotEmittedStatement */; + var isEmittedNode = node.kind !== 290 /* NotEmittedStatement */; // We have to explicitly check that the node is JsxText because if the compilerOptions.jsx is "preserve" we will not do any transformation. // It is expensive to walk entire tree just to set one kind of node to have no comments. var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0 || node.kind === 10 /* JsxText */; @@ -70263,7 +70448,7 @@ var ts; return ".js" /* Js */; } function getOriginalSourceFileOrBundle(sourceFileOrBundle) { - if (sourceFileOrBundle.kind === 266 /* Bundle */) { + if (sourceFileOrBundle.kind === 269 /* Bundle */) { return ts.updateBundle(sourceFileOrBundle, ts.sameMap(sourceFileOrBundle.sourceFiles, ts.getOriginalSourceFile)); } return ts.getOriginalSourceFile(sourceFileOrBundle); @@ -70340,8 +70525,8 @@ var ts; } } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle) { - var bundle = sourceFileOrBundle.kind === 266 /* Bundle */ ? sourceFileOrBundle : undefined; - var sourceFile = sourceFileOrBundle.kind === 265 /* SourceFile */ ? sourceFileOrBundle : undefined; + var bundle = sourceFileOrBundle.kind === 269 /* Bundle */ ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 268 /* SourceFile */ ? sourceFileOrBundle : undefined; var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFileOrBundle); if (bundle) { @@ -70381,7 +70566,7 @@ var ts; } function emitHelpers(node, writeLines) { var helpersEmitted = false; - var bundle = node.kind === 266 /* Bundle */ ? node : undefined; + var bundle = node.kind === 269 /* Bundle */ ? node : undefined; if (bundle && moduleKind === ts.ModuleKind.None) { return; } @@ -70462,8 +70647,8 @@ var ts; break; } switch (node.kind) { - case 265 /* SourceFile */: return printFile(node); - case 266 /* Bundle */: return printBundle(node); + case 268 /* SourceFile */: return printFile(node); + case 269 /* Bundle */: return printBundle(node); } writeNode(hint, node, sourceFile, beginPrint()); return endPrint(); @@ -70660,7 +70845,7 @@ var ts; return emitTypeReference(node); case 160 /* FunctionType */: return emitFunctionType(node); - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: return emitJSDocFunctionType(node); case 161 /* ConstructorType */: return emitConstructorType(node); @@ -70690,19 +70875,19 @@ var ts; return emitMappedType(node); case 173 /* LiteralType */: return emitLiteralType(node); - case 268 /* JSDocAllType */: + case 271 /* JSDocAllType */: write("*"); return; - case 269 /* JSDocUnknownType */: + case 272 /* JSDocUnknownType */: write("?"); return; - case 270 /* JSDocNullableType */: + case 273 /* JSDocNullableType */: return emitJSDocNullableType(node); - case 271 /* JSDocNonNullableType */: + case 274 /* JSDocNonNullableType */: return emitJSDocNonNullableType(node); - case 272 /* JSDocOptionalType */: + case 275 /* JSDocOptionalType */: return emitJSDocOptionalType(node); - case 274 /* JSDocVariadicType */: + case 277 /* JSDocVariadicType */: return emitJSDocVariadicType(node); // Binding patterns case 174 /* ObjectBindingPattern */: @@ -70807,35 +70992,37 @@ var ts; case 10 /* JsxText */: return emitJsxText(node); case 251 /* JsxOpeningElement */: - return emitJsxOpeningElement(node); + case 254 /* JsxOpeningFragment */: + return emitJsxOpeningElementOrFragment(node); case 252 /* JsxClosingElement */: - return emitJsxClosingElement(node); - case 253 /* JsxAttribute */: + case 255 /* JsxClosingFragment */: + return emitJsxClosingElementOrFragment(node); + case 256 /* JsxAttribute */: return emitJsxAttribute(node); - case 254 /* JsxAttributes */: + case 257 /* JsxAttributes */: return emitJsxAttributes(node); - case 255 /* JsxSpreadAttribute */: + case 258 /* JsxSpreadAttribute */: return emitJsxSpreadAttribute(node); - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: return emitJsxExpression(node); // Clauses - case 257 /* CaseClause */: + case 260 /* CaseClause */: return emitCaseClause(node); - case 258 /* DefaultClause */: + case 261 /* DefaultClause */: return emitDefaultClause(node); - case 259 /* HeritageClause */: + case 262 /* HeritageClause */: return emitHeritageClause(node); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return emitCatchClause(node); // Property assignments - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: return emitSpreadAssignment(node); // Enum - case 264 /* EnumMember */: + case 267 /* EnumMember */: return emitEnumMember(node); } // If the node is an expression, try to emit it as an expression with @@ -70930,10 +71117,12 @@ var ts; return emitJsxElement(node); case 250 /* JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); + case 253 /* JsxFragment */: + return emitJsxFragment(node); // Transformation nodes - case 288 /* PartiallyEmittedExpression */: + case 291 /* PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); - case 289 /* CommaListExpression */: + case 292 /* CommaListExpression */: return emitCommaList(node); } } @@ -71012,7 +71201,7 @@ var ts; emit(node.name); } emitIfPresent(node.questionToken); - if (node.parent && node.parent.kind === 273 /* JSDocFunctionType */ && !node.name) { + if (node.parent && node.parent.kind === 276 /* JSDocFunctionType */ && !node.name) { emit(node.type); } else { @@ -71974,7 +72163,7 @@ var ts; // function emitJsxElement(node) { emit(node.openingElement); - emitList(node, node.children, 131072 /* JsxElementChildren */); + emitList(node, node.children, 131072 /* JsxElementOrFragmentChildren */); emit(node.closingElement); } function emitJsxSelfClosingElement(node) { @@ -71987,22 +72176,31 @@ var ts; } write("/>"); } - function emitJsxOpeningElement(node) { + function emitJsxFragment(node) { + emit(node.openingFragment); + emitList(node, node.children, 131072 /* JsxElementOrFragmentChildren */); + emit(node.closingFragment); + } + function emitJsxOpeningElementOrFragment(node) { write("<"); - emitJsxTagName(node.tagName); - writeIfAny(node.attributes.properties, " "); - // We are checking here so we won't re-enter the emitting pipeline and emit extra sourcemap - if (node.attributes.properties && node.attributes.properties.length > 0) { - emit(node.attributes); + if (ts.isJsxOpeningElement(node)) { + emitJsxTagName(node.tagName); + // We are checking here so we won't re-enter the emitting pipeline and emit extra sourcemap + if (node.attributes.properties && node.attributes.properties.length > 0) { + write(" "); + emit(node.attributes); + } } write(">"); } function emitJsxText(node) { writer.writeLiteral(getTextOfNode(node, /*includeTrivia*/ true)); } - function emitJsxClosingElement(node) { + function emitJsxClosingElementOrFragment(node) { write(""); } function emitJsxAttributes(node) { @@ -72451,11 +72649,6 @@ var ts; function decreaseIndent() { writer.decreaseIndent(); } - function writeIfAny(nodes, text) { - if (ts.some(nodes)) { - write(text); - } - } function writeToken(token, pos, contextNode) { return onEmitSourceMapOfToken ? onEmitSourceMapOfToken(contextNode, token, pos, writeTokenText) @@ -72956,7 +73149,7 @@ var ts; ListFormat[ListFormat["EnumMembers"] = 81] = "EnumMembers"; ListFormat[ListFormat["CaseBlockClauses"] = 65] = "CaseBlockClauses"; ListFormat[ListFormat["NamedImportsOrExportsElements"] = 432] = "NamedImportsOrExportsElements"; - ListFormat[ListFormat["JsxElementChildren"] = 131072] = "JsxElementChildren"; + ListFormat[ListFormat["JsxElementOrFragmentChildren"] = 131072] = "JsxElementOrFragmentChildren"; ListFormat[ListFormat["JsxElementAttributes"] = 131328] = "JsxElementAttributes"; ListFormat[ListFormat["CaseOrDefaultClauseStatements"] = 81985] = "CaseOrDefaultClauseStatements"; ListFormat[ListFormat["HeritageClauseTypes"] = 272] = "HeritageClauseTypes"; @@ -74517,7 +74710,7 @@ var ts; return; } break; - case 259 /* HeritageClause */: + case 262 /* HeritageClause */: var heritageClause = node; if (heritageClause.token === 108 /* ImplementsKeyword */) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); @@ -75668,8 +75861,8 @@ var ts; case 176 /* BindingElement */: case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: - case 261 /* PropertyAssignment */: - case 262 /* ShorthandPropertyAssignment */: + case 264 /* PropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: case 151 /* MethodDeclaration */: case 150 /* MethodSignature */: case 152 /* Constructor */: @@ -75678,18 +75871,18 @@ var ts; case 228 /* FunctionDeclaration */: case 186 /* FunctionExpression */: case 187 /* ArrowFunction */: - case 260 /* CatchClause */: - case 253 /* JsxAttribute */: + case 263 /* CatchClause */: + case 256 /* JsxAttribute */: return 1 /* Value */; case 145 /* TypeParameter */: case 230 /* InterfaceDeclaration */: case 231 /* TypeAliasDeclaration */: case 163 /* TypeLiteral */: return 2 /* Type */; - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: // If it has no name node, it shares the name with the value declaration below it. return node.name === undefined ? 1 /* Value */ | 2 /* Type */ : 2 /* Type */; - case 264 /* EnumMember */: + case 267 /* EnumMember */: case 229 /* ClassDeclaration */: return 1 /* Value */ | 2 /* Type */; case 233 /* ModuleDeclaration */: @@ -75711,14 +75904,14 @@ var ts; case 244 /* ExportDeclaration */: return 7 /* All */; // An external module can be a Value - case 265 /* SourceFile */: + case 268 /* SourceFile */: return 4 /* Namespace */ | 1 /* Value */; } return 7 /* All */; } ts.getMeaningFromDeclaration = getMeaningFromDeclaration; function getMeaningFromLocation(node) { - if (node.kind === 265 /* SourceFile */) { + if (node.kind === 268 /* SourceFile */) { return 1 /* Value */; } else if (node.parent.kind === 243 /* ExportAssignment */) { @@ -75787,7 +75980,7 @@ var ts; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 201 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 259 /* HeritageClause */) { + if (!isLastClause && root.parent.kind === 201 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 262 /* HeritageClause */) { var decl = root.parent.parent.parent; return (decl.kind === 229 /* ClassDeclaration */ && root.parent.parent.token === 108 /* ImplementsKeyword */) || (decl.kind === 230 /* InterfaceDeclaration */ && root.parent.parent.token === 85 /* ExtendsKeyword */); @@ -75874,8 +76067,8 @@ var ts; switch (node.parent.kind) { case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: - case 261 /* PropertyAssignment */: - case 264 /* EnumMember */: + case 264 /* PropertyAssignment */: + case 267 /* EnumMember */: case 151 /* MethodDeclaration */: case 150 /* MethodSignature */: case 153 /* GetAccessor */: @@ -75897,7 +76090,7 @@ var ts; } ts.isExpressionOfExternalModuleImportEqualsDeclaration = isExpressionOfExternalModuleImportEqualsDeclaration; function getContainerNode(node) { - if (node.kind === 283 /* JSDocTypedefTag */) { + if (node.kind === 286 /* JSDocTypedefTag */) { // This doesn't just apply to the node immediately under the comment, but to everything in its parent's scope. // node.parent = the JSDoc comment, node.parent.parent = the node having the comment. // Then we get parent again in the loop. @@ -75909,7 +76102,7 @@ var ts; return undefined; } switch (node.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 151 /* MethodDeclaration */: case 150 /* MethodSignature */: case 228 /* FunctionDeclaration */: @@ -75927,7 +76120,7 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: return ts.isExternalModule(node) ? "module" /* moduleElement */ : "script" /* scriptElement */; case 233 /* ModuleDeclaration */: return "module" /* moduleElement */; @@ -75958,7 +76151,7 @@ var ts; case 155 /* CallSignature */: return "call" /* callSignatureElement */; case 152 /* Constructor */: return "constructor" /* constructorImplementationElement */; case 145 /* TypeParameter */: return "type parameter" /* typeParameterElement */; - case 264 /* EnumMember */: return "enum member" /* enumMemberElement */; + case 267 /* EnumMember */: return "enum member" /* enumMemberElement */; case 146 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? "property" /* memberVariableElement */ : "parameter" /* parameterElement */; case 237 /* ImportEqualsDeclaration */: case 242 /* ImportSpecifier */: @@ -75966,7 +76159,7 @@ var ts; case 246 /* ExportSpecifier */: case 240 /* NamespaceImport */: return "alias" /* alias */; - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return "type" /* typeElement */; case 194 /* BinaryExpression */: var kind = ts.getSpecialPropertyAssignmentKind(node); @@ -76069,7 +76262,7 @@ var ts; case 241 /* NamedImports */: case 245 /* NamedExports */: return nodeEndsWith(n, 18 /* CloseBraceToken */, sourceFile); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return isCompletedNode(n.block, sourceFile); case 182 /* NewExpression */: if (!n.arguments) { @@ -76123,8 +76316,8 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 22 /* CloseBracketToken */, sourceFile); - case 257 /* CaseClause */: - case 258 /* DefaultClause */: + case 260 /* CaseClause */: + case 261 /* DefaultClause */: // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed return false; case 214 /* ForStatement */: @@ -76314,8 +76507,8 @@ var ts; return n; } var children = n.getChildren(); - for (var _i = 0, children_2 = children; _i < children_2.length; _i++) { - var child = children_2[_i]; + for (var _i = 0, children_3 = children; _i < children_3.length; _i++) { + var child = children_3[_i]; var shouldDiveInChildNode = // previous token is enclosed somewhere in the child (child.pos <= previousToken.pos && child.end > previousToken.end) || @@ -76373,7 +76566,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 265 /* SourceFile */ || ts.isJSDocCommentContainingNode(n)); + ts.Debug.assert(startNode !== undefined || n.kind === 268 /* SourceFile */ || ts.isJSDocCommentContainingNode(n)); // Here we know that none of child token nodes embrace the position, // the only known case is when position is at the end of the file. // Try to find the rightmost token in the file without filtering. @@ -76434,13 +76627,13 @@ var ts; return true; } //
{ |
or
- if (token.kind === 27 /* LessThanToken */ && token.parent.kind === 256 /* JsxExpression */) { + if (token.kind === 27 /* LessThanToken */ && token.parent.kind === 259 /* JsxExpression */) { return true; } //
{ // | // } < /div> - if (token && token.kind === 18 /* CloseBraceToken */ && token.parent.kind === 256 /* JsxExpression */) { + if (token && token.kind === 18 /* CloseBraceToken */ && token.parent.kind === 259 /* JsxExpression */) { return true; } //
|
@@ -76580,7 +76773,7 @@ var ts; // [x, [a, b, c] ] = someExpression // or // {x, a: {a, b, c} } = someExpression - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 261 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 264 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { return true; } } @@ -77063,7 +77256,7 @@ var ts; // falls through case 234 /* ModuleBlock */: return spanInBlock(node); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return spanInBlock(node.block); case 210 /* ExpressionStatement */: // span on the expression @@ -77101,8 +77294,8 @@ var ts; case 221 /* SwitchStatement */: // span on switch(...) return textSpanEndingAtNextToken(node, node.expression); - case 257 /* CaseClause */: - case 258 /* DefaultClause */: + case 260 /* CaseClause */: + case 261 /* DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); case 224 /* TryStatement */: @@ -77131,7 +77324,7 @@ var ts; // falls through case 229 /* ClassDeclaration */: case 232 /* EnumDeclaration */: - case 264 /* EnumMember */: + case 267 /* EnumMember */: case 176 /* BindingElement */: // span on complete node return textSpan(node); @@ -77189,8 +77382,8 @@ var ts; // [a, b, ...c] or { a, b } or { d: x } from destructuring pattern if ((node.kind === 71 /* Identifier */ || node.kind === 198 /* SpreadElement */ || - node.kind === 261 /* PropertyAssignment */ || - node.kind === 262 /* ShorthandPropertyAssignment */) && + node.kind === 264 /* PropertyAssignment */ || + node.kind === 265 /* ShorthandPropertyAssignment */) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { return textSpan(node); } @@ -77241,7 +77434,7 @@ var ts; } } // If this is name of property assignment, set breakpoint in the initializer - if (node.parent.kind === 261 /* PropertyAssignment */ && + if (node.parent.kind === 264 /* PropertyAssignment */ && node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); @@ -77467,7 +77660,7 @@ var ts; return textSpan(node); } // falls through - case 260 /* CatchClause */: + case 263 /* CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); case 235 /* CaseBlock */: // breakpoint in last statement of the last clause @@ -77546,7 +77739,7 @@ var ts; function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration if (ts.isFunctionLike(node.parent) || - node.parent.kind === 261 /* PropertyAssignment */ || + node.parent.kind === 264 /* PropertyAssignment */ || node.parent.kind === 146 /* Parameter */) { return spanInPreviousNode(node); } @@ -78236,16 +78429,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); // e.g. "param" pos = tag.tagName.end; switch (tag.kind) { - case 279 /* JSDocParameterTag */: + case 282 /* JSDocParameterTag */: processJSDocParameterTag(tag); break; - case 282 /* JSDocTemplateTag */: + case 285 /* JSDocTemplateTag */: processJSDocTemplateTag(tag); break; - case 281 /* JSDocTypeTag */: + case 284 /* JSDocTypeTag */: processElement(tag.typeExpression); break; - case 280 /* JSDocReturnTag */: + case 283 /* JSDocReturnTag */: processElement(tag.typeExpression); break; } @@ -78347,7 +78540,7 @@ var ts; return 21 /* jsxSelfClosingTagName */; } break; - case 253 /* JsxAttribute */: + case 256 /* JsxAttribute */: if (token.parent.name === token) { return 22 /* jsxAttribute */; } @@ -78378,7 +78571,7 @@ var ts; if (token.parent.kind === 226 /* VariableDeclaration */ || token.parent.kind === 149 /* PropertyDeclaration */ || token.parent.kind === 146 /* Parameter */ || - token.parent.kind === 253 /* JsxAttribute */) { + token.parent.kind === 256 /* JsxAttribute */) { return 5 /* operator */; } } @@ -78395,7 +78588,7 @@ var ts; return 4 /* numericLiteral */; } else if (tokenKind === 9 /* StringLiteral */) { - return token.parent.kind === 253 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; + return token.parent.kind === 256 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; } else if (tokenKind === 12 /* RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. @@ -78953,7 +79146,7 @@ var ts; if (ts.isInString(sourceFile, position)) { return getStringLiteralCompletionEntries(sourceFile, position, typeChecker, compilerOptions, host, log); } - var completionData = getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, options); + var completionData = getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, options, compilerOptions.target); if (!completionData) { return undefined; } @@ -79030,7 +79223,7 @@ var ts; // Try to get a valid display name for this symbol, if we could not find one, then ignore it. // We would like to only show things that can be added after a dot, so for instance numeric properties can // not be accessed with a dot (a.1 <- invalid) - var displayName = getCompletionEntryDisplayNameForSymbol(symbol, target, performCharacterChecks, allowStringLiteral); + var displayName = getCompletionEntryDisplayNameForSymbol(symbol, target, performCharacterChecks, allowStringLiteral, origin); if (!displayName) { return undefined; } @@ -79087,7 +79280,7 @@ var ts; if (!node || node.kind !== 9 /* StringLiteral */) { return undefined; } - if (node.parent.kind === 261 /* PropertyAssignment */ && + if (node.parent.kind === 264 /* PropertyAssignment */ && node.parent.parent.kind === 178 /* ObjectLiteralExpression */ && node.parent.name === node) { // Get quoted name of properties of the object literal expression @@ -79219,7 +79412,7 @@ var ts; } function getSymbolCompletionFromEntryId(typeChecker, log, compilerOptions, sourceFile, position, _a, allSourceFiles) { var name = _a.name, source = _a.source; - var completionData = getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, { includeExternalModuleExports: true }); + var completionData = getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, { includeExternalModuleExports: true }, compilerOptions.target); if (!completionData) { return { type: "none" }; } @@ -79232,13 +79425,17 @@ var ts; // name against 'entryName' (which is known to be good), not building a new // completion entry. var symbol = ts.find(symbols, function (s) { - return getCompletionEntryDisplayNameForSymbol(s, compilerOptions.target, /*performCharacterChecks*/ false, allowStringLiteral) === name - && getSourceFromOrigin(symbolToOriginInfoMap[ts.getSymbolId(s)]) === source; + var origin = symbolToOriginInfoMap[ts.getSymbolId(s)]; + return getCompletionEntryDisplayNameForSymbol(s, compilerOptions.target, /*performCharacterChecks*/ false, allowStringLiteral, origin) === name + && getSourceFromOrigin(origin) === source; }); return symbol ? { type: "symbol", symbol: symbol, location: location, symbolToOriginInfoMap: symbolToOriginInfoMap } : { type: "none" }; } - function getCompletionEntryDetails(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles, host, rulesProvider) { - var name = entryId.name, source = entryId.source; + function getSymbolName(symbol, origin, target) { + return origin && origin.isDefaultExport && symbol.name === "default" ? ts.codefix.moduleSymbolToValidIdentifier(origin.moduleSymbol, target) : symbol.name; + } + function getCompletionEntryDetails(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles, host, rulesProvider, getCanonicalFileName) { + var name = entryId.name; // Compute all the completion symbols again. var symbolCompletion = getSymbolCompletionFromEntryId(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles); switch (symbolCompletion.type) { @@ -79257,10 +79454,10 @@ var ts; } case "symbol": { var symbol = symbolCompletion.symbol, location = symbolCompletion.location, symbolToOriginInfoMap = symbolCompletion.symbolToOriginInfoMap; - var codeActions = getCompletionEntryCodeActions(symbolToOriginInfoMap, symbol, typeChecker, host, compilerOptions, sourceFile, rulesProvider); + var _a = getCompletionEntryCodeActionsAndSourceDisplay(symbolToOriginInfoMap, symbol, typeChecker, host, compilerOptions, sourceFile, rulesProvider, getCanonicalFileName), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; var kindModifiers = ts.SymbolDisplay.getSymbolModifiers(symbol); - var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location, location, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind, tags = _a.tags; - return { name: name, kindModifiers: kindModifiers, kind: symbolKind, displayParts: displayParts, documentation: documentation, tags: tags, codeActions: codeActions, source: source === undefined ? undefined : [ts.textPart(source)] }; + var _b = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location, location, 7 /* All */), displayParts = _b.displayParts, documentation = _b.documentation, symbolKind = _b.symbolKind, tags = _b.tags; + return { name: name, kindModifiers: kindModifiers, kind: symbolKind, displayParts: displayParts, documentation: documentation, tags: tags, codeActions: codeActions, source: sourceDisplay }; } case "none": { // Didn't find a symbol with this name. See if we can find a keyword instead. @@ -79281,31 +79478,33 @@ var ts; } } Completions.getCompletionEntryDetails = getCompletionEntryDetails; - function getCompletionEntryCodeActions(symbolToOriginInfoMap, symbol, checker, host, compilerOptions, sourceFile, rulesProvider) { + function getCompletionEntryCodeActionsAndSourceDisplay(symbolToOriginInfoMap, symbol, checker, host, compilerOptions, sourceFile, rulesProvider, getCanonicalFileName) { var symbolOriginInfo = symbolToOriginInfoMap[ts.getSymbolId(symbol)]; if (!symbolOriginInfo) { - return undefined; + return { codeActions: undefined, sourceDisplay: undefined }; } var moduleSymbol = symbolOriginInfo.moduleSymbol, isDefaultExport = symbolOriginInfo.isDefaultExport; - return ts.codefix.getCodeActionForImport(moduleSymbol, { + var sourceDisplay = [ts.textPart(ts.codefix.getModuleSpecifierForNewImport(sourceFile, moduleSymbol, compilerOptions, getCanonicalFileName, host))]; + var codeActions = ts.codefix.getCodeActionForImport(moduleSymbol, { host: host, checker: checker, newLineCharacter: host.getNewLine(), compilerOptions: compilerOptions, sourceFile: sourceFile, rulesProvider: rulesProvider, - symbolName: symbol.name, - getCanonicalFileName: ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames ? host.useCaseSensitiveFileNames() : false), + symbolName: getSymbolName(symbol, symbolOriginInfo, compilerOptions.target), + getCanonicalFileName: getCanonicalFileName, symbolToken: undefined, kind: isDefaultExport ? 1 /* Default */ : 0 /* Named */, }); + return { sourceDisplay: sourceDisplay, codeActions: codeActions }; } function getCompletionEntrySymbol(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles) { var completion = getSymbolCompletionFromEntryId(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles); return completion.type === "symbol" ? completion.symbol : undefined; } Completions.getCompletionEntrySymbol = getCompletionEntrySymbol; - function getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, options) { + function getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, options, target) { var isJavaScriptFile = ts.isSourceFileJavaScript(sourceFile); var request; var start = ts.timestamp(); @@ -79355,11 +79554,11 @@ var ts; if (tag.tagName.pos <= position && position <= tag.tagName.end) { request = { kind: "JsDocTagName" }; } - if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 267 /* JSDocTypeExpression */) { + if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 270 /* JSDocTypeExpression */) { currentToken = ts.getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ true); if (!currentToken || (!ts.isDeclarationName(currentToken) && - (currentToken.parent.kind !== 284 /* JSDocPropertyTag */ || + (currentToken.parent.kind !== 287 /* JSDocPropertyTag */ || currentToken.parent.name !== currentToken))) { // Use as type location if inside tag's type expression insideJsDocTagTypeExpression = isCurrentlyEditingNode(tag.typeExpression); @@ -79508,11 +79707,11 @@ var ts; return { symbols: symbols, isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, allowStringLiteral: allowStringLiteral, isNewIdentifierLocation: isNewIdentifierLocation, location: location, isRightOfDot: (isRightOfDot || isRightOfOpenTag), request: request, keywordFilters: keywordFilters, symbolToOriginInfoMap: symbolToOriginInfoMap }; function isTagWithTypeExpression(tag) { switch (tag.kind) { - case 279 /* JSDocParameterTag */: - case 284 /* JSDocPropertyTag */: - case 280 /* JSDocReturnTag */: - case 281 /* JSDocTypeTag */: - case 283 /* JSDocTypedefTag */: + case 282 /* JSDocParameterTag */: + case 287 /* JSDocPropertyTag */: + case 283 /* JSDocReturnTag */: + case 284 /* JSDocTypeTag */: + case 286 /* JSDocTypedefTag */: return true; } } @@ -79544,7 +79743,7 @@ var ts; } } // If the module is merged with a value, we must get the type of the class and add its propertes (for inherited static methods). - if (!isTypeLocation && symbol.declarations.some(function (d) { return d.kind !== 265 /* SourceFile */ && d.kind !== 233 /* ModuleDeclaration */ && d.kind !== 232 /* EnumDeclaration */; })) { + if (!isTypeLocation && symbol.declarations.some(function (d) { return d.kind !== 268 /* SourceFile */ && d.kind !== 233 /* ModuleDeclaration */ && d.kind !== 232 /* EnumDeclaration */; })) { addTypeProperties(typeChecker.getTypeOfSymbolAtLocation(symbol, node)); } return; @@ -79653,15 +79852,15 @@ var ts; var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile; if (scopeNode) { isGlobalCompletion = - scopeNode.kind === 265 /* SourceFile */ || + scopeNode.kind === 268 /* SourceFile */ || scopeNode.kind === 196 /* TemplateExpression */ || - scopeNode.kind === 256 /* JsxExpression */ || + scopeNode.kind === 259 /* JsxExpression */ || ts.isStatement(scopeNode); } var symbolMeanings = 793064 /* Type */ | 107455 /* Value */ | 1920 /* Namespace */ | 2097152 /* Alias */; symbols = typeChecker.getSymbolsInScope(scopeNode, symbolMeanings); if (options.includeExternalModuleExports) { - getSymbolsFromOtherSourceFileExports(symbols, previousToken && ts.isIdentifier(previousToken) ? previousToken.text : ""); + getSymbolsFromOtherSourceFileExports(symbols, previousToken && ts.isIdentifier(previousToken) ? previousToken.text : "", target); } filterGlobalCompletion(symbols); return true; @@ -79728,7 +79927,7 @@ var ts; return ts.forEach(exportedSymbols, symbolCanBeReferencedAtTypeLocation); } } - function getSymbolsFromOtherSourceFileExports(symbols, tokenText) { + function getSymbolsFromOtherSourceFileExports(symbols, tokenText, target) { var tokenTextLowerCase = tokenText.toLowerCase(); ts.codefix.forEachExternalModule(typeChecker, allSourceFiles, function (moduleSymbol) { if (moduleSymbol === sourceFile.symbol) { @@ -79744,6 +79943,9 @@ var ts; symbol = localSymbol; name = localSymbol.name; } + else { + name = ts.codefix.moduleSymbolToValidIdentifier(moduleSymbol, target); + } } if (symbol.declarations && symbol.declarations.some(function (d) { return ts.isExportSpecifier(d) && !!d.parent.parent.moduleSpecifier; })) { // Don't add a completion for a re-export, only for the original. @@ -80108,7 +80310,7 @@ var ts; } } // class c { method() { } | method2() { } } - if (location && location.kind === 286 /* SyntaxList */ && ts.isClassLike(location.parent)) { + if (location && location.kind === 289 /* SyntaxList */ && ts.isClassLike(location.parent)) { return location.parent; } return undefined; @@ -80139,13 +80341,13 @@ var ts; case 41 /* SlashToken */: case 71 /* Identifier */: case 179 /* PropertyAccessExpression */: - case 254 /* JsxAttributes */: - case 253 /* JsxAttribute */: - case 255 /* JsxSpreadAttribute */: + case 257 /* JsxAttributes */: + case 256 /* JsxAttribute */: + case 258 /* JsxSpreadAttribute */: if (parent && (parent.kind === 250 /* JsxSelfClosingElement */ || parent.kind === 251 /* JsxOpeningElement */)) { return parent; } - else if (parent.kind === 253 /* JsxAttribute */) { + else if (parent.kind === 256 /* JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -80157,7 +80359,7 @@ var ts; // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 9 /* StringLiteral */: - if (parent && ((parent.kind === 253 /* JsxAttribute */) || (parent.kind === 255 /* JsxSpreadAttribute */))) { + if (parent && ((parent.kind === 256 /* JsxAttribute */) || (parent.kind === 258 /* JsxSpreadAttribute */))) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -80167,8 +80369,8 @@ var ts; break; case 18 /* CloseBraceToken */: if (parent && - parent.kind === 256 /* JsxExpression */ && - parent.parent && parent.parent.kind === 253 /* JsxAttribute */) { + parent.kind === 259 /* JsxExpression */ && + parent.parent && parent.parent.kind === 256 /* JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -80176,7 +80378,7 @@ var ts; // each JsxAttribute can have initializer as JsxExpression return parent.parent.parent.parent; } - if (parent && parent.kind === 255 /* JsxSpreadAttribute */) { + if (parent && parent.kind === 258 /* JsxSpreadAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -80215,7 +80417,7 @@ var ts; case 21 /* OpenBracketToken */: return containingNodeKind === 175 /* ArrayBindingPattern */; // var [x| case 19 /* OpenParenToken */: - return containingNodeKind === 260 /* CatchClause */ || + return containingNodeKind === 263 /* CatchClause */ || isFunctionLikeButNotConstructor(containingNodeKind); case 17 /* OpenBraceToken */: return containingNodeKind === 232 /* EnumDeclaration */ || // enum a { | @@ -80351,8 +80553,8 @@ var ts; for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 261 /* PropertyAssignment */ && - m.kind !== 262 /* ShorthandPropertyAssignment */ && + if (m.kind !== 264 /* PropertyAssignment */ && + m.kind !== 265 /* ShorthandPropertyAssignment */ && m.kind !== 176 /* BindingElement */ && m.kind !== 151 /* MethodDeclaration */ && m.kind !== 153 /* GetAccessor */ && @@ -80449,7 +80651,7 @@ var ts; if (isCurrentlyEditingNode(attr)) { continue; } - if (attr.kind === 253 /* JsxAttribute */) { + if (attr.kind === 256 /* JsxAttribute */) { seenNames.set(attr.name.escapedText, true); } } @@ -80464,8 +80666,8 @@ var ts; * * @return undefined if the name is of external module */ - function getCompletionEntryDisplayNameForSymbol(symbol, target, performCharacterChecks, allowStringLiteral) { - var name = symbol.name; + function getCompletionEntryDisplayNameForSymbol(symbol, target, performCharacterChecks, allowStringLiteral, origin) { + var name = getSymbolName(symbol, origin, target); if (!name) return undefined; // First check of the displayName is not external module; if it is an external module, it is not valid entry @@ -80798,7 +81000,7 @@ var ts; var child = throwStatement; while (child.parent) { var parent_2 = child.parent; - if (ts.isFunctionBlock(parent_2) || parent_2.kind === 265 /* SourceFile */) { + if (ts.isFunctionBlock(parent_2) || parent_2.kind === 268 /* SourceFile */) { return parent_2; } // A throw-statement is only owned by a try-statement if the try-statement has @@ -80875,10 +81077,10 @@ var ts; var container = declaration.parent; switch (container.kind) { case 234 /* ModuleBlock */: - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 207 /* Block */: - case 257 /* CaseClause */: - case 258 /* DefaultClause */: + case 260 /* CaseClause */: + case 261 /* DefaultClause */: // Container is either a class declaration or the declaration is a classDeclaration if (modifierFlag & 128 /* Abstract */) { return declaration.members.concat([declaration]); @@ -80926,7 +81128,7 @@ var ts; return container.kind === 229 /* ClassDeclaration */ || container.kind === 199 /* ClassExpression */; case 84 /* ExportKeyword */: case 124 /* DeclareKeyword */: - return container.kind === 234 /* ModuleBlock */ || container.kind === 265 /* SourceFile */; + return container.kind === 234 /* ModuleBlock */ || container.kind === 268 /* SourceFile */; case 117 /* AbstractKeyword */: return container.kind === 229 /* ClassDeclaration */ || declaration.kind === 229 /* ClassDeclaration */; default: @@ -81349,7 +81551,7 @@ var ts; } else if (!isAvailableThroughGlobal) { var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration); - ts.Debug.assert(sourceFileLike.kind === 265 /* SourceFile */ || sourceFileLike.kind === 233 /* ModuleDeclaration */); + ts.Debug.assert(sourceFileLike.kind === 268 /* SourceFile */ || sourceFileLike.kind === 233 /* ModuleDeclaration */); if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) { addIndirectUsers(sourceFileLike); } @@ -81514,7 +81716,7 @@ var ts; for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) { var referencingFile = sourceFiles_4[_i]; var searchSourceFile = searchModuleSymbol.valueDeclaration; - if (searchSourceFile.kind === 265 /* SourceFile */) { + if (searchSourceFile.kind === 268 /* SourceFile */) { for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) { var ref = _b[_a]; if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) { @@ -81561,7 +81763,7 @@ var ts; } /** Iterates over all statements at the top level or in module declarations. Returns the first truthy result. */ function forEachPossibleImportOrExportStatement(sourceFileLike, action) { - return ts.forEach(sourceFileLike.kind === 265 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { + return ts.forEach(sourceFileLike.kind === 268 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { return action(statement) || (isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action)); }); } @@ -81735,7 +81937,7 @@ var ts; if (parent.kind === 226 /* VariableDeclaration */) { var p = parent; return p.name !== node ? undefined : - p.parent.kind === 260 /* CatchClause */ ? undefined : p.parent.parent.kind === 208 /* VariableStatement */ ? p.parent.parent : undefined; + p.parent.kind === 263 /* CatchClause */ ? undefined : p.parent.parent.kind === 208 /* VariableStatement */ ? p.parent.parent : undefined; } else { return parent; @@ -81795,7 +81997,7 @@ var ts; return node.getSourceFile(); } var parent = node.parent; - if (parent.kind === 265 /* SourceFile */) { + if (parent.kind === 268 /* SourceFile */) { return parent; } ts.Debug.assert(parent.kind === 234 /* ModuleBlock */ && isAmbientModuleDeclaration(parent.parent)); @@ -81846,13 +82048,13 @@ var ts; } FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition; function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node) { - if (node.kind === 265 /* SourceFile */) { + if (node.kind === 268 /* SourceFile */) { return undefined; } var checker = program.getTypeChecker(); // If invoked directly on a shorthand property assignment, then return // the declaration of the symbol being assigned (not the symbol being assigned to). - if (node.parent.kind === 262 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 265 /* ShorthandPropertyAssignment */) { var result_5 = []; FindAllReferences.Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_5.push(nodeEntry(node)); }); return result_5; @@ -81889,29 +82091,29 @@ var ts; var info = (function () { switch (def.type) { case "symbol": { - var symbol = def.symbol, node_2 = def.node; - var _a = getDefinitionKindAndDisplayParts(symbol, node_2, checker), displayParts_1 = _a.displayParts, kind_1 = _a.kind; + var symbol = def.symbol, node_3 = def.node; + var _a = getDefinitionKindAndDisplayParts(symbol, node_3, checker), displayParts_1 = _a.displayParts, kind_1 = _a.kind; var name_4 = displayParts_1.map(function (p) { return p.text; }).join(""); - return { node: node_2, name: name_4, kind: kind_1, displayParts: displayParts_1 }; + return { node: node_3, name: name_4, kind: kind_1, displayParts: displayParts_1 }; } case "label": { - var node_3 = def.node; - return { node: node_3, name: node_3.text, kind: "label" /* label */, displayParts: [ts.displayPart(node_3.text, ts.SymbolDisplayPartKind.text)] }; + var node_4 = def.node; + return { node: node_4, name: node_4.text, kind: "label" /* label */, displayParts: [ts.displayPart(node_4.text, ts.SymbolDisplayPartKind.text)] }; } case "keyword": { - var node_4 = def.node; - var name_5 = ts.tokenToString(node_4.kind); - return { node: node_4, name: name_5, kind: "keyword" /* keyword */, displayParts: [{ text: name_5, kind: "keyword" /* keyword */ }] }; + var node_5 = def.node; + var name_5 = ts.tokenToString(node_5.kind); + return { node: node_5, name: name_5, kind: "keyword" /* keyword */, displayParts: [{ text: name_5, kind: "keyword" /* keyword */ }] }; } case "this": { - var node_5 = def.node; - var symbol = checker.getSymbolAtLocation(node_5); - var displayParts_2 = symbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node_5.getSourceFile(), ts.getContainerNode(node_5), node_5).displayParts; - return { node: node_5, name: "this", kind: "var" /* variableElement */, displayParts: displayParts_2 }; + var node_6 = def.node; + var symbol = checker.getSymbolAtLocation(node_6); + var displayParts_2 = symbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node_6.getSourceFile(), ts.getContainerNode(node_6), node_6).displayParts; + return { node: node_6, name: "this", kind: "var" /* variableElement */, displayParts: displayParts_2 }; } case "string": { - var node_6 = def.node; - return { node: node_6, name: node_6.text, kind: "var" /* variableElement */, displayParts: [ts.displayPart(ts.getTextOfNode(node_6), ts.SymbolDisplayPartKind.stringLiteral)] }; + var node_7 = def.node; + return { node: node_7, name: node_7.text, kind: "var" /* variableElement */, displayParts: [ts.displayPart(ts.getTextOfNode(node_7), ts.SymbolDisplayPartKind.stringLiteral)] }; } } })(); @@ -82021,7 +82223,7 @@ var ts; /** Core find-all-references algorithm. Handles special cases before delegating to `getReferencedSymbolsForSymbol`. */ function getReferencedSymbolsForNode(node, program, sourceFiles, cancellationToken, options) { if (options === void 0) { options = {}; } - if (node.kind === 265 /* SourceFile */) { + if (node.kind === 268 /* SourceFile */) { return undefined; } if (!options.implementations) { @@ -82080,7 +82282,7 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; switch (decl.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: // Don't include the source file itself. (This may not be ideal behavior, but awkward to include an entire file as a reference.) break; case 233 /* ModuleDeclaration */: @@ -82377,7 +82579,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (!container || container.kind === 265 /* SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { + if (!container || container.kind === 268 /* SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { // This is a global variable and not an external module, any declaration defined // within this scope is visible outside the file return undefined; @@ -82704,7 +82906,7 @@ var ts; if (refNode.kind !== 71 /* Identifier */) { return; } - if (refNode.parent.kind === 262 /* ShorthandPropertyAssignment */) { + if (refNode.parent.kind === 265 /* ShorthandPropertyAssignment */) { // Go ahead and dereference the shorthand assignment by going to its definition getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference); } @@ -82765,7 +82967,7 @@ var ts; function getContainingClassIfInHeritageClause(node) { if (node && node.parent) { if (node.kind === 201 /* ExpressionWithTypeArguments */ - && node.parent.kind === 259 /* HeritageClause */ + && node.parent.kind === 262 /* HeritageClause */ && ts.isClassLike(node.parent.parent)) { return node.parent.parent; } @@ -82919,7 +83121,7 @@ var ts; staticFlag &= ts.getModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 265 /* SourceFile */: + case 268 /* SourceFile */: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } @@ -82934,7 +83136,7 @@ var ts; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 265 /* SourceFile */) { + if (searchSpaceNode.kind === 268 /* SourceFile */) { ts.forEach(sourceFiles, function (sourceFile) { cancellationToken.throwIfCancellationRequested(); possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this"); @@ -82978,8 +83180,8 @@ var ts; result.push(FindAllReferences.nodeEntry(node)); } break; - case 265 /* SourceFile */: - if (container.kind === 265 /* SourceFile */ && !ts.isExternalModule(container)) { + case 268 /* SourceFile */: + if (container.kind === 268 /* SourceFile */ && !ts.isExternalModule(container)) { result.push(FindAllReferences.nodeEntry(node)); } break; @@ -83002,9 +83204,9 @@ var ts; function getReferencesForStringLiteralInFile(sourceFile, searchText, possiblePositions, references) { for (var _i = 0, possiblePositions_4 = possiblePositions; _i < possiblePositions_4.length; _i++) { var position = possiblePositions_4[_i]; - var node_7 = ts.getTouchingWord(sourceFile, position, /*includeJsDocComment*/ false); - if (node_7 && node_7.kind === 9 /* StringLiteral */ && node_7.text === searchText) { - references.push(FindAllReferences.nodeEntry(node_7, /*isInString*/ true)); + var node_8 = ts.getTouchingWord(sourceFile, position, /*includeJsDocComment*/ false); + if (node_8 && node_8.kind === 9 /* StringLiteral */ && node_8.text === searchText) { + references.push(FindAllReferences.nodeEntry(node_8, /*isInString*/ true)); } } } @@ -83019,7 +83221,7 @@ var ts; // If the location is name of property symbol from object literal destructuring pattern // Search the property symbol // for ( { property: p2 } of elems) { } - if (containingObjectLiteralElement.kind !== 262 /* ShorthandPropertyAssignment */) { + if (containingObjectLiteralElement.kind !== 265 /* ShorthandPropertyAssignment */) { var propertySymbol = getPropertySymbolOfDestructuringAssignment(location, checker); if (propertySymbol) { result.push(propertySymbol); @@ -83400,7 +83602,7 @@ var ts; // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. - if (node.parent.kind === 262 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 265 /* ShorthandPropertyAssignment */) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -83712,7 +83914,7 @@ var ts; forEachUnique(declarations, function (declaration) { for (var _i = 0, _a = ts.getJSDocTags(declaration); _i < _a.length; _i++) { var tag = _a[_i]; - if (tag.kind === 276 /* JSDocTag */) { + if (tag.kind === 279 /* JSDocTag */) { tags.push({ name: tag.tagName.text, text: tag.comment }); } } @@ -83903,7 +84105,7 @@ var ts; : undefined; return { commentOwner: commentOwner, parameters: parameters_1 }; } - case 265 /* SourceFile */: + case 268 /* SourceFile */: return undefined; case 233 /* ModuleDeclaration */: // If in walking up the tree, we hit a a nested namespace declaration, @@ -84088,7 +84290,7 @@ var ts; if (!ts.hasJavaScriptFileExtension(j)) return undefined; var inferredTypingName = ts.removeFileExtension(ts.getBaseFileName(j.toLowerCase())); - var cleanedTypingName = inferredTypingName.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); + var cleanedTypingName = ts.removeMinAndVersionNumbers(inferredTypingName); return safeList.get(cleanedTypingName); }); if (fromFileNames.length) { @@ -84632,7 +84834,7 @@ var ts; if (ts.hasJSDocNodes(node)) { ts.forEach(node.jsDoc, function (jsDoc) { ts.forEach(jsDoc.tags, function (tag) { - if (tag.kind === 283 /* JSDocTypedefTag */) { + if (tag.kind === 286 /* JSDocTypedefTag */) { addLeafNode(tag); } }); @@ -84744,7 +84946,7 @@ var ts; case 187 /* ArrowFunction */: case 199 /* ClassExpression */: return getFunctionOrClassName(node); - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return undefined; @@ -84762,7 +84964,7 @@ var ts; } } switch (node.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" @@ -84787,7 +84989,7 @@ var ts; return "()"; case 157 /* IndexSignature */: return "[]"; - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return ""; @@ -84833,9 +85035,9 @@ var ts; case 232 /* EnumDeclaration */: case 230 /* InterfaceDeclaration */: case 233 /* ModuleDeclaration */: - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 231 /* TypeAliasDeclaration */: - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return true; case 152 /* Constructor */: case 151 /* MethodDeclaration */: @@ -84856,7 +85058,7 @@ var ts; } switch (navigationBarNodeKind(item.parent)) { case 234 /* ModuleBlock */: - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 151 /* MethodDeclaration */: case 152 /* Constructor */: return true; @@ -84940,7 +85142,7 @@ var ts; return !member.name || member.name.kind === 144 /* ComputedPropertyName */; } function getNodeSpan(node) { - return node.kind === 265 /* SourceFile */ + return node.kind === 268 /* SourceFile */ ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromNode(node, curSourceFile); } @@ -84961,7 +85163,7 @@ var ts; node.parent.operatorToken.kind === 58 /* EqualsToken */) { return nodeText(node.parent.left).replace(whiteSpaceRegex, ""); } - else if (node.parent.kind === 261 /* PropertyAssignment */ && node.parent.name) { + else if (node.parent.kind === 264 /* PropertyAssignment */ && node.parent.name) { return nodeText(node.parent.name); } else if (ts.getModifierFlags(node) & 512 /* Default */) { @@ -85121,7 +85323,7 @@ var ts; parent.kind === 211 /* IfStatement */ || parent.kind === 213 /* WhileStatement */ || parent.kind === 220 /* WithStatement */ || - parent.kind === 260 /* CatchClause */) { + parent.kind === 263 /* CatchClause */) { addOutliningSpan(parent, openBrace_1, closeBrace_1, autoCollapse(n), /*useFullStart*/ true); break; } @@ -86475,7 +86677,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node, position, sourceFile) { - for (var n = node; n.kind !== 265 /* SourceFile */; n = n.parent) { + for (var n = node; n.kind !== 268 /* SourceFile */; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -86904,7 +87106,7 @@ var ts; symbolKind = "enum member" /* enumMemberElement */; addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 264 /* EnumMember */) { + if (declaration.kind === 267 /* EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -87010,7 +87212,7 @@ var ts; // For some special property access expressions like `exports.foo = foo` or `module.exports.foo = foo` // there documentation comments might be attached to the right hand side symbol of their declarations. // The pattern of such special property access is that the parent symbol is the symbol of the file. - if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 265 /* SourceFile */; })) { + if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 268 /* SourceFile */; })) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (!declaration.parent || declaration.parent.kind !== 194 /* BinaryExpression */) { @@ -87105,7 +87307,7 @@ var ts; // If the parent is not sourceFile or module block it is local variable for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { // Reached source file or module block - if (parent.kind === 265 /* SourceFile */ || parent.kind === 234 /* ModuleBlock */) { + if (parent.kind === 268 /* SourceFile */ || parent.kind === 234 /* ModuleBlock */) { return false; } } @@ -87325,7 +87527,7 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 253 /* JsxAttribute */: + case 256 /* JsxAttribute */: case 251 /* JsxOpeningElement */: case 252 /* JsxClosingElement */: case 250 /* JsxSelfClosingElement */: @@ -88038,7 +88240,7 @@ var ts; case 226 /* VariableDeclaration */: // equal in p = 0; case 146 /* Parameter */: - case 264 /* EnumMember */: + case 267 /* EnumMember */: case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: return context.currentTokenSpan.kind === 58 /* EqualsToken */ || context.nextTokenSpan.kind === 58 /* EqualsToken */; @@ -88144,7 +88346,7 @@ var ts; case 229 /* ClassDeclaration */: case 233 /* ModuleDeclaration */: case 232 /* EnumDeclaration */: - case 260 /* CatchClause */: + case 263 /* CatchClause */: case 234 /* ModuleBlock */: case 221 /* SwitchStatement */: return true; @@ -88171,7 +88373,7 @@ var ts; case 220 /* WithStatement */: // TODO // case SyntaxKind.ElseClause: - case 260 /* CatchClause */: + case 263 /* CatchClause */: return true; default: return false; @@ -88205,13 +88407,13 @@ var ts; return context.contextNode.kind !== 249 /* JsxElement */; }; Rules.IsJsxExpressionContext = function (context) { - return context.contextNode.kind === 256 /* JsxExpression */; + return context.contextNode.kind === 259 /* JsxExpression */; }; Rules.IsNextTokenParentJsxAttribute = function (context) { - return context.nextTokenParent.kind === 253 /* JsxAttribute */; + return context.nextTokenParent.kind === 256 /* JsxAttribute */; }; Rules.IsJsxAttributeContext = function (context) { - return context.contextNode.kind === 253 /* JsxAttribute */; + return context.contextNode.kind === 256 /* JsxAttribute */; }; Rules.IsJsxSelfClosingElementContext = function (context) { return context.contextNode.kind === 250 /* JsxSelfClosingElement */; @@ -88740,11 +88942,11 @@ var ts; case 233 /* ModuleDeclaration */: var body = parent.body; return body && body.kind === 234 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node); - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 207 /* Block */: case 234 /* ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -89841,7 +90043,7 @@ var ts; // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually // - parent and child are not on the same line var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && - (parent.kind === 265 /* SourceFile */ || !parentAndChildShareLine); + (parent.kind === 268 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Unknown */; } @@ -90053,8 +90255,8 @@ var ts; case 172 /* MappedType */: case 165 /* TupleType */: case 235 /* CaseBlock */: - case 258 /* DefaultClause */: - case 257 /* CaseClause */: + case 261 /* DefaultClause */: + case 260 /* CaseClause */: case 185 /* ParenthesizedExpression */: case 179 /* PropertyAccessExpression */: case 181 /* CallExpression */: @@ -90068,7 +90270,7 @@ var ts; case 174 /* ObjectBindingPattern */: case 251 /* JsxOpeningElement */: case 250 /* JsxSelfClosingElement */: - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: case 150 /* MethodSignature */: case 155 /* CallSignature */: case 156 /* ConstructSignature */: @@ -90082,7 +90284,7 @@ var ts; case 241 /* NamedImports */: case 246 /* ExportSpecifier */: case 242 /* ImportSpecifier */: - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: case 149 /* PropertyDeclaration */: return true; } @@ -91169,11 +91371,11 @@ var ts; if (!ts.isStringLiteral(token)) { throw ts.Debug.fail(); // These errors should only happen on the module name. } - var action = tryGetCodeActionForInstallPackageTypes(context.host, token.text); + var action = tryGetCodeActionForInstallPackageTypes(context.host, sourceFile.fileName, token.text); return action && [action]; }, }); - function tryGetCodeActionForInstallPackageTypes(host, moduleName) { + function tryGetCodeActionForInstallPackageTypes(host, fileName, moduleName) { var packageName = ts.getPackageName(moduleName).packageName; if (!host.isKnownTypesPackageName(packageName)) { // If !registry, registry not available yet, can't do anything. @@ -91183,7 +91385,7 @@ var ts; return { description: "Install '" + typesPackageName + "'", changes: [], - commands: [{ type: "install package", packageName: typesPackageName }], + commands: [{ type: "install package", file: fileName, packageName: typesPackageName }], }; } codefix.tryGetCodeActionForInstallPackageTypes = tryGetCodeActionForInstallPackageTypes; @@ -91595,7 +91797,7 @@ var ts; var original = ts.getTextOfNode(jsdocType); var type = checker.getTypeFromTypeNode(jsdocType); var actions = [createAction(jsdocType, sourceFile.fileName, original, checker.typeToString(type, /*enclosingDeclaration*/ undefined, 8 /* NoTruncation */))]; - if (jsdocType.kind === 270 /* JSDocNullableType */) { + if (jsdocType.kind === 273 /* JSDocNullableType */) { // for nullable types, suggest the flow-compatible `T | null | undefined` // in addition to the jsdoc/closure-compatible `T | null` var replacementWithUndefined = checker.typeToString(checker.getNullableType(type, 2048 /* Undefined */), /*enclosingDeclaration*/ undefined, 8 /* NoTruncation */); @@ -91814,10 +92016,12 @@ var ts; return parent; case 248 /* ExternalModuleReference */: return parent.parent; - default: - ts.Debug.assert(parent.kind === 244 /* ExportDeclaration */); + case 244 /* ExportDeclaration */: + case 181 /* CallExpression */:// For "require()" calls // Ignore these, can't add imports to them. return undefined; + default: + ts.Debug.fail(); } } function getCodeActionForNewImport(context, moduleSpecifier) { @@ -91869,6 +92073,7 @@ var ts; options.rootDirs && tryGetModuleNameFromRootDirs(options.rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName) || ts.removeFileExtension(getRelativePath(moduleFileName, sourceDirectory, getCanonicalFileName)); } + codefix.getModuleSpecifierForNewImport = getModuleSpecifierForNewImport; function tryGetModuleNameFromAmbientModule(moduleSymbol) { var decl = moduleSymbol.valueDeclaration; if (ts.isModuleDeclaration(decl) && ts.isStringLiteral(decl.name)) { @@ -92161,9 +92366,10 @@ var ts; var defaultExport = checker.tryGetMemberInModuleExports("default", moduleSymbol); if (defaultExport) { var localSymbol = ts.getLocalSymbolForExportDefault(defaultExport); - if (localSymbol && localSymbol.escapedName === symbolName && checkSymbolHasMeaning(localSymbol, currentTokenMeaning)) { + if ((localSymbol && localSymbol.escapedName === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, context.compilerOptions.target) === symbolName) + && checkSymbolHasMeaning(localSymbol || defaultExport, currentTokenMeaning)) { // check if this symbol is already used - var symbolId = ts.getUniqueSymbolId(localSymbol, checker); + var symbolId = ts.getUniqueSymbolId(localSymbol || defaultExport, checker); symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol, __assign({}, context, { kind: 1 /* Default */ }))); } } @@ -92193,6 +92399,36 @@ var ts; } } codefix.forEachExternalModule = forEachExternalModule; + function moduleSymbolToValidIdentifier(moduleSymbol, target) { + return moduleSpecifierToValidIdentifier(ts.removeFileExtension(ts.getBaseFileName(moduleSymbol.name)), target); + } + codefix.moduleSymbolToValidIdentifier = moduleSymbolToValidIdentifier; + function moduleSpecifierToValidIdentifier(moduleSpecifier, target) { + var res = ""; + var lastCharWasValid = true; + var firstCharCode = moduleSpecifier.charCodeAt(0); + if (ts.isIdentifierStart(firstCharCode, target)) { + res += String.fromCharCode(firstCharCode); + } + else { + lastCharWasValid = false; + } + for (var i = 1; i < moduleSpecifier.length; i++) { + var ch = moduleSpecifier.charCodeAt(i); + var isValid = ts.isIdentifierPart(ch, target); + if (isValid) { + var char = String.fromCharCode(ch); + if (!lastCharWasValid) { + char = char.toUpperCase(); + } + res += char; + } + lastCharWasValid = isValid; + } + // Need `|| "_"` to ensure result isn't empty. + var token = ts.stringToToken(res); + return token === undefined || !ts.isNonContextualKeyword(token) ? res || "_" : "_" + res; + } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); /* @internal */ @@ -92774,8 +93010,8 @@ var ts; case 194 /* BinaryExpression */: inferTypeFromBinaryExpressionContext(node, node.parent, checker, usageContext); break; - case 257 /* CaseClause */: - case 258 /* DefaultClause */: + case 260 /* CaseClause */: + case 261 /* DefaultClause */: inferTypeFromSwitchStatementLabelContext(node.parent, checker, usageContext); break; case 181 /* CallExpression */: @@ -93210,18 +93446,18 @@ var ts; return undefined; } switch (node.kind) { - case 268 /* JSDocAllType */: - case 269 /* JSDocUnknownType */: + case 271 /* JSDocAllType */: + case 272 /* JSDocUnknownType */: return ts.createTypeReferenceNode("any", ts.emptyArray); - case 272 /* JSDocOptionalType */: + case 275 /* JSDocOptionalType */: return transformJSDocOptionalType(node); - case 271 /* JSDocNonNullableType */: + case 274 /* JSDocNonNullableType */: return transformJSDocType(node.type); - case 270 /* JSDocNullableType */: + case 273 /* JSDocNullableType */: return transformJSDocNullableType(node); - case 274 /* JSDocVariadicType */: + case 277 /* JSDocVariadicType */: return transformJSDocVariadicType(node); - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: return transformJSDocFunctionType(node); case 146 /* Parameter */: return transformJSDocParameter(node); @@ -93248,7 +93484,7 @@ var ts; } function transformJSDocParameter(node) { var index = node.parent.parameters.indexOf(node); - var isRest = node.type.kind === 274 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; + var isRest = node.type.kind === 277 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; var name = node.name || (isRest ? "rest" : "arg" + index); var dotdotdot = isRest ? ts.createToken(24 /* DotDotDotToken */) : node.dotDotDotToken; return ts.createParameter(node.decorators, node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer); @@ -93839,7 +94075,7 @@ var ts; switch (node.kind) { case 228 /* FunctionDeclaration */: case 229 /* ClassDeclaration */: - if (node.parent.kind === 265 /* SourceFile */ && node.parent.externalModuleIndicator === undefined) { + if (node.parent.kind === 268 /* SourceFile */ && node.parent.externalModuleIndicator === undefined) { // You cannot extract global declarations (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.FunctionWillNotBeVisibleInTheNewScope)); } @@ -93863,7 +94099,7 @@ var ts; permittedJumps = 4 /* Return */; } break; - case 257 /* CaseClause */: + case 260 /* CaseClause */: // allow unlabeled break inside case clauses permittedJumps |= 1 /* Break */; break; @@ -93976,7 +94212,7 @@ var ts; // * Module/namespace or source file if (isScope(current)) { scopes.push(current); - if (current.kind === 265 /* SourceFile */) { + if (current.kind === 268 /* SourceFile */) { return scopes; } } @@ -95052,7 +95288,7 @@ var ts; */ function isExtractableExpression(node) { switch (node.parent.kind) { - case 264 /* EnumMember */: + case 267 /* EnumMember */: return false; } switch (node.kind) { @@ -95073,9 +95309,9 @@ var ts; function isBlockLike(node) { switch (node.kind) { case 207 /* Block */: - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 234 /* ModuleBlock */: - case 257 /* CaseClause */: + case 260 /* CaseClause */: return true; default: return false; @@ -95134,7 +95370,7 @@ var ts; var file = context.file, startPosition = context.startPosition; var node = ts.getTokenAtPosition(file, startPosition, /*includeJsDocComment*/ false); if (ts.isStringLiteral(node) && isModuleIdentifier(node) && ts.getResolvedModule(file, node.text) === undefined) { - return ts.codefix.tryGetCodeActionForInstallPackageTypes(context.host, node.text); + return ts.codefix.tryGetCodeActionForInstallPackageTypes(context.host, file.fileName, node.text); } } function isModuleIdentifier(node) { @@ -95250,7 +95486,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(286 /* SyntaxList */, nodes.pos, nodes.end, this); + var list = createNode(289 /* SyntaxList */, nodes.pos, nodes.end, this); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_9 = nodes; _i < nodes_9.length; _i++) { @@ -95274,9 +95510,9 @@ var ts; } if (ts.isJSDocCommentContainingNode(this)) { /** Don't add trivia for "tokens" since this is in a comment. */ - var children_3 = []; - this.forEachChild(function (child) { children_3.push(child); }); - this._children = children_3; + var children_4 = []; + this.forEachChild(function (child) { children_4.push(child); }); + this._children = children_4; return; } var children = []; @@ -95332,7 +95568,7 @@ var ts; if (!children.length) { return undefined; } - var child = ts.find(children, function (kid) { return kid.kind < 267 /* FirstJSDocNode */ || kid.kind > 285 /* LastJSDocNode */; }); + var child = ts.find(children, function (kid) { return kid.kind < 270 /* FirstJSDocNode */ || kid.kind > 288 /* LastJSDocNode */; }); return child.kind < 143 /* FirstNode */ ? child : child.getFirstToken(sourceFile); @@ -95670,7 +95906,7 @@ var ts; } } // falls through - case 264 /* EnumMember */: + case 267 /* EnumMember */: case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: addDeclaration(node); @@ -96212,7 +96448,7 @@ var ts; function getCompletionEntryDetails(fileName, position, name, formattingOptions, source) { synchronizeHostData(); var ruleProvider = formattingOptions ? getRuleProvider(formattingOptions) : undefined; - return ts.Completions.getCompletionEntryDetails(program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position, { name: name, source: source }, program.getSourceFiles(), host, ruleProvider); + return ts.Completions.getCompletionEntryDetails(program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position, { name: name, source: source }, program.getSourceFiles(), host, ruleProvider, getCanonicalFileName); } function getCompletionEntrySymbol(fileName, position, name, source) { synchronizeHostData(); @@ -96573,12 +96809,15 @@ var ts; return ts.codefix.getFixes({ errorCode: errorCode, sourceFile: sourceFile, span: span, program: program, newLineCharacter: newLineCharacter, host: host, cancellationToken: cancellationToken, rulesProvider: rulesProvider }); }); } - function applyCodeActionCommand(fileName, action) { - fileName = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + function applyCodeActionCommand(fileName, actionOrUndefined) { + var action = typeof fileName === "string" ? actionOrUndefined : fileName; + return ts.isArray(action) ? Promise.all(action.map(applySingleCodeActionCommand)) : applySingleCodeActionCommand(action); + } + function applySingleCodeActionCommand(action) { switch (action.type) { case "install package": return host.installPackage - ? host.installPackage({ fileName: fileName, packageName: action.packageName }) + ? host.installPackage({ fileName: ts.toPath(action.file, currentDirectory, getCanonicalFileName), packageName: action.packageName }) : Promise.reject("Host does not implement `installPackage`"); default: ts.Debug.fail(); @@ -96862,10 +97101,10 @@ var ts; } function isObjectLiteralElement(node) { switch (node.kind) { - case 253 /* JsxAttribute */: - case 255 /* JsxSpreadAttribute */: - case 261 /* PropertyAssignment */: - case 262 /* ShorthandPropertyAssignment */: + case 256 /* JsxAttribute */: + case 258 /* JsxSpreadAttribute */: + case 264 /* PropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: case 151 /* MethodDeclaration */: case 153 /* GetAccessor */: case 154 /* SetAccessor */: @@ -96887,7 +97126,7 @@ var ts; // falls through case 71 /* Identifier */: return isObjectLiteralElement(node.parent) && - (node.parent.parent.kind === 178 /* ObjectLiteralExpression */ || node.parent.parent.kind === 254 /* JsxAttributes */) && + (node.parent.parent.kind === 178 /* ObjectLiteralExpression */ || node.parent.parent.kind === 257 /* JsxAttributes */) && node.parent.name === node ? node.parent : undefined; } return undefined; @@ -97299,7 +97538,7 @@ var ts; CommandTypes["CompletionsFull"] = "completions-full"; CommandTypes["CompletionDetails"] = "completionEntryDetails"; /* @internal */ - CommandTypes["CompletionDetailsFull"] = "completionEntryDetailsFull"; + CommandTypes["CompletionDetailsFull"] = "completionEntryDetails-full"; CommandTypes["CompileOnSaveAffectedFileList"] = "compileOnSaveAffectedFileList"; CommandTypes["CompileOnSaveEmitFile"] = "compileOnSaveEmitFile"; CommandTypes["Configure"] = "configure"; @@ -98991,13 +99230,17 @@ var ts; }; Session.prototype.applyCodeActionCommand = function (commandName, requestSeq, args) { var _this = this; - var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; - var output = function (success, message) { return _this.doOutput({}, commandName, requestSeq, success, message); }; - var command = args.command; // They should be sending back the command we sent them. - project.getLanguageService().applyCodeActionCommand(file, command).then(function (_a) { - var successMessage = _a.successMessage; - output(/*success*/ true, successMessage); - }, function (error) { output(/*success*/ false, error); }); + var commands = args.command; // They should be sending back the command we sent them. + var _loop_9 = function (command) { + var project = this_1.getFileAndProject(command).project; + var output = function (success, message) { return _this.doOutput({}, commandName, requestSeq, success, message); }; + project.getLanguageService().applyCodeActionCommand(command).then(function (result) { output(/*success*/ true, result.successMessage); }, function (error) { output(/*success*/ false, error); }); + }; + var this_1 = this; + for (var _i = 0, _a = ts.toArray(commands); _i < _a.length; _i++) { + var command = _a[_i]; + _loop_9(command); + } }; Session.prototype.getStartAndEndPosition = function (args, scriptInfo) { var startPosition = undefined, endPosition = undefined; @@ -100157,9 +100400,10 @@ var ts; this.markContainingProjectsAsDirty(); } }; - ScriptInfo.prototype.close = function () { + ScriptInfo.prototype.close = function (fileExists) { + if (fileExists === void 0) { fileExists = true; } this.textStorage.isOpen = false; - if (this.isDynamicOrHasMixedContent()) { + if (this.isDynamicOrHasMixedContent() || !fileExists) { if (this.textStorage.reload("")) { this.markContainingProjectsAsDirty(); } @@ -100336,6 +100580,14 @@ var ts; /* @internal */ var ts; (function (ts) { + var ConfigFileProgramReloadLevel; + (function (ConfigFileProgramReloadLevel) { + ConfigFileProgramReloadLevel[ConfigFileProgramReloadLevel["None"] = 0] = "None"; + /** Update the file name list from the disk */ + ConfigFileProgramReloadLevel[ConfigFileProgramReloadLevel["Partial"] = 1] = "Partial"; + /** Reload completely by re-reading contents of config file from disk and updating program */ + ConfigFileProgramReloadLevel[ConfigFileProgramReloadLevel["Full"] = 2] = "Full"; + })(ConfigFileProgramReloadLevel = ts.ConfigFileProgramReloadLevel || (ts.ConfigFileProgramReloadLevel = {})); /** * Updates the existing missing file watches with the new set of missing files after new program is created */ @@ -101134,6 +101386,11 @@ var ts; return counts.ts === 0 && counts.tsx === 0; } server.allFilesAreJsOrDts = allFilesAreJsOrDts; + /* @internal */ + function hasNoTypeScriptSource(fileNames) { + return !fileNames.some(function (fileName) { return (ts.fileExtensionIs(fileName, ".ts" /* Ts */) && !ts.fileExtensionIs(fileName, ".d.ts" /* Dts */)) || ts.fileExtensionIs(fileName, ".tsx" /* Tsx */); }); + } + server.hasNoTypeScriptSource = hasNoTypeScriptSource; var UnresolvedImportsMap = /** @class */ (function () { function UnresolvedImportsMap() { this.perFileMap = ts.createMap(); @@ -101290,7 +101547,7 @@ var ts; return ts.addRange(result, this.typingFiles) || ts.emptyArray; }; Project.prototype.getOrCreateScriptInfoAndAttachToProject = function (fileName) { - var scriptInfo = this.projectService.getOrCreateScriptInfoNotOpenedByClient(fileName, this.directoryStructureHost); + var scriptInfo = this.projectService.getOrCreateScriptInfoNotOpenedByClient(fileName, this.currentDirectory, this.directoryStructureHost); if (scriptInfo) { var existingValue = this.rootFilesMap.get(scriptInfo.path); if (existingValue !== scriptInfo && existingValue !== undefined) { @@ -101355,7 +101612,7 @@ var ts; }; /*@internal*/ Project.prototype.toPath = function (fileName) { - return this.projectService.toPath(fileName); + return ts.toPath(fileName, this.currentDirectory, this.projectService.toCanonicalFileName); }; /*@internal*/ Project.prototype.watchDirectoryOfFailedLookupLocation = function (directory, cb, flags) { @@ -101606,7 +101863,7 @@ var ts; return this.isRoot(info) || (this.program && this.program.getSourceFileByPath(info.path) !== undefined); }; Project.prototype.containsFile = function (filename, requireOpen) { - var info = this.projectService.getScriptInfoForNormalizedPath(filename); + var info = this.projectService.getScriptInfoForPath(this.toPath(filename)); if (info && (info.isScriptOpen() || !requireOpen)) { return this.containsScriptInfo(info); } @@ -101782,7 +102039,7 @@ var ts; // by the LSHost for files in the program when the program is retrieved above but // the program doesn't contain external files so this must be done explicitly. function (inserted) { - var scriptInfo = _this.projectService.getOrCreateScriptInfoNotOpenedByClient(inserted, _this.directoryStructureHost); + var scriptInfo = _this.projectService.getOrCreateScriptInfoNotOpenedByClient(inserted, _this.currentDirectory, _this.directoryStructureHost); scriptInfo.attachToProject(_this); }, function (removed) { return _this.detachScriptInfoFromProject(removed); }); var elapsed = ts.timestamp() - start; @@ -101815,7 +102072,7 @@ var ts; return this.missingFilesMap && this.missingFilesMap.has(path); }; Project.prototype.getScriptInfoForNormalizedPath = function (fileName) { - var scriptInfo = this.projectService.getScriptInfoForNormalizedPath(fileName); + var scriptInfo = this.projectService.getScriptInfoForPath(this.toPath(fileName)); if (scriptInfo && !scriptInfo.isAttached(this)) { return server.Errors.ThrowProjectDoesNotContainDocument(fileName, this); } @@ -102018,12 +102275,17 @@ var ts; * @returns: true if set of files in the project stays the same and false - otherwise. */ ConfiguredProject.prototype.updateGraph = function () { - if (this.pendingReload) { - this.pendingReload = false; - this.projectService.reloadConfiguredProject(this); - return true; + var reloadLevel = this.pendingReload; + this.pendingReload = ts.ConfigFileProgramReloadLevel.None; + switch (reloadLevel) { + case ts.ConfigFileProgramReloadLevel.Partial: + return this.projectService.reloadFileNamesOfConfiguredProject(this); + case ts.ConfigFileProgramReloadLevel.Full: + this.projectService.reloadConfiguredProject(this); + return true; + default: + return _super.prototype.updateGraph.call(this); } - return _super.prototype.updateGraph.call(this); }; /*@internal*/ ConfiguredProject.prototype.getCachedDirectoryStructureHost = function () { @@ -102055,7 +102317,7 @@ var ts; } } if (this.projectService.globalPlugins) { - var _loop_9 = function (globalPluginName) { + var _loop_10 = function (globalPluginName) { // Skip empty names from odd commandline parses if (!globalPluginName) return "continue"; @@ -102063,14 +102325,14 @@ var ts; if (options.plugins && options.plugins.some(function (p) { return p.name === globalPluginName; })) return "continue"; // Provide global: true so plugins can detect why they can't find their config - this_1.projectService.logger.info("Loading global plugin " + globalPluginName); - this_1.enablePlugin({ name: globalPluginName, global: true }, searchPaths); + this_2.projectService.logger.info("Loading global plugin " + globalPluginName); + this_2.enablePlugin({ name: globalPluginName, global: true }, searchPaths); }; - var this_1 = this; + var this_2 = this; // Enable global plugins with synthetic configuration entries for (var _b = 0, _c = this.projectService.globalPlugins; _b < _c.length; _b++) { var globalPluginName = _c[_b]; - _loop_9(globalPluginName); + _loop_10(globalPluginName); } } }; @@ -102249,26 +102511,10 @@ var ts; return this.typeAcquisition; }; ExternalProject.prototype.setTypeAcquisition = function (newTypeAcquisition) { - if (!newTypeAcquisition) { - // set default typings options - newTypeAcquisition = { - enable: allRootFilesAreJsOrDts(this), - include: [], - exclude: [] - }; - } - else { - if (newTypeAcquisition.enable === undefined) { - // if autoDiscovery was not specified by the caller - set it based on the content of the project - newTypeAcquisition.enable = allRootFilesAreJsOrDts(this); - } - if (!newTypeAcquisition.include) { - newTypeAcquisition.include = []; - } - if (!newTypeAcquisition.exclude) { - newTypeAcquisition.exclude = []; - } - } + ts.Debug.assert(!!newTypeAcquisition, "newTypeAcquisition may not be null/undefined"); + ts.Debug.assert(!!newTypeAcquisition.include, "newTypeAcquisition.include may not be null/undefined"); + ts.Debug.assert(!!newTypeAcquisition.exclude, "newTypeAcquisition.exclude may not be null/undefined"); + ts.Debug.assert(typeof newTypeAcquisition.enable === "boolean", "newTypeAcquisition.enable may not be null/undefined"); this.typeAcquisition = newTypeAcquisition; }; return ExternalProject; @@ -102355,9 +102601,8 @@ var ts; "exclude": [["^", 1, "/.*"]], "types": ["office"] // @types package to fetch instead }, - "Minified files": { - // e.g. /whatever/blah.min.js - "match": /^(.+\.min\.js)$/i, + "References": { + "match": /^(.*\/_references\.js)$/i, "exclude": [["^", 1, "$"]] } }; @@ -102487,6 +102732,10 @@ var ts; * list of open files */ this.openFiles = []; + /** + * Map of open files that are opened without complete path but have projectRoot as current directory + */ + this.openFilesWithNonRootedDiskPath = ts.createMap(); this.compilerOptionsForInferredProjectsPerProjectRoot = ts.createMap(); /** * Project size for configured or external projects @@ -102501,6 +102750,7 @@ var ts; */ this.configFileExistenceInfoCache = ts.createMap(); this.safelist = defaultTypeSafeList; + this.legacySafelist = {}; this.pendingProjectUpdates = ts.createMap(); /** Tracks projects that we have already sent telemetry for. */ this.seenProjects = ts.createMap(); @@ -102520,9 +102770,12 @@ var ts; this.currentDirectory = this.host.getCurrentDirectory(); this.toCanonicalFileName = ts.createGetCanonicalFileName(this.host.useCaseSensitiveFileNames); this.throttledOperations = new server.ThrottledOperations(this.host, this.logger); - if (opts.typesMapLocation) { + if (this.typesMapLocation) { this.loadTypesMap(); } + else { + this.logger.info("No types map provided; using the default"); + } this.typingsInstaller.attach(this); this.typingsCache = new server.TypingsCache(this.typingsInstaller); this.hostConfiguration = { @@ -102601,10 +102854,12 @@ var ts; } // raw is now fixed and ready this.safelist = raw.typesMap; + this.legacySafelist = raw.simpleMap; } catch (e) { this.logger.info("Error loading types map: " + e); this.safelist = defaultTypeSafeList; + this.legacySafelist = {}; } }; ProjectService.prototype.updateTypingsForProject = function (response) { @@ -102852,16 +103107,13 @@ var ts; var configFilename = project.getConfigFilePath(); // If the the added or created file or directory is not supported file name, ignore the file // But when watched directory is added/removed, we need to reload the file list - if (fileOrDirectoryPath !== directory && !ts.isSupportedSourceFileName(fileOrDirectory, project.getCompilationSettings(), _this.hostConfiguration.extraFileExtensions)) { + if (fileOrDirectoryPath !== directory && ts.hasExtension(fileOrDirectoryPath) && !ts.isSupportedSourceFileName(fileOrDirectory, project.getCompilationSettings(), _this.hostConfiguration.extraFileExtensions)) { _this.logger.info("Project: " + configFilename + " Detected file add/remove of non supported extension: " + fileOrDirectory); return; } // Reload is pending, do the reload - if (!project.pendingReload) { - var configFileSpecs = project.configFileSpecs; - var result = ts.getFileNamesFromConfigSpecs(configFileSpecs, ts.getDirectoryPath(configFilename), project.getCompilationSettings(), project.getCachedDirectoryStructureHost(), _this.hostConfiguration.extraFileExtensions); - project.updateErrorOnNoInputFiles(result.fileNames.length !== 0); - _this.updateNonInferredProjectFiles(project, result.fileNames, fileNamePropertyReader); + if (project.pendingReload !== ts.ConfigFileProgramReloadLevel.Full) { + project.pendingReload = ts.ConfigFileProgramReloadLevel.Partial; _this.delayUpdateProjectGraphAndInferredProjectsRefresh(project); } }, flags, "Wild card directory" /* WildcardDirectories */, project); @@ -102887,7 +103139,7 @@ var ts; } else { this.logConfigFileWatchUpdate(project.getConfigFilePath(), project.canonicalConfigFilePath, configFileExistenceInfo, "Reloading configured projects for only inferred root files" /* ReloadingInferredRootFiles */); - project.pendingReload = true; + project.pendingReload = ts.ConfigFileProgramReloadLevel.Full; this.delayUpdateProjectGraph(project); // As we scheduled the update on configured project graph, // we would need to schedule the project reload for only the root of inferred projects @@ -102971,10 +103223,14 @@ var ts; // Closing file should trigger re-reading the file content from disk. This is // because the user may chose to discard the buffer content before saving // to the disk, and the server's version of the file can be out of sync. - info.close(); + var fileExists = this.host.fileExists(info.fileName); + info.close(fileExists); this.stopWatchingConfigFilesForClosedScriptInfo(info); ts.unorderedRemoveItem(this.openFiles, info); - var fileExists = this.host.fileExists(info.fileName); + var canonicalFileName = this.toCanonicalFileName(info.fileName); + if (this.openFilesWithNonRootedDiskPath.get(canonicalFileName) === info) { + this.openFilesWithNonRootedDiskPath.delete(canonicalFileName); + } // collect all projects that should be removed var projectsToRemove; for (var _i = 0, _a = info.containingProjects; _i < _a.length; _i++) { @@ -103372,10 +103628,11 @@ var ts; this.projectToSizeMap.set(name, totalNonTsFileSize); return false; }; - ProjectService.prototype.createExternalProject = function (projectFileName, files, options, typeAcquisition) { + ProjectService.prototype.createExternalProject = function (projectFileName, files, options, typeAcquisition, excludedFiles) { var compilerOptions = convertCompilerOptions(options); var project = new server.ExternalProject(projectFileName, this, this.documentRegistry, compilerOptions, /*languageServiceEnabled*/ !this.exceededTotalSizeLimitForNonTsFiles(projectFileName, compilerOptions, files, externalFilePropertyReader), options.compileOnSave === undefined ? true : options.compileOnSave); + project.excludedFiles = excludedFiles; this.addFilesToNonInferredProjectAndUpdateGraph(project, files, externalFilePropertyReader, typeAcquisition); this.externalProjects.push(project); this.sendProjectTelemetry(projectFileName, project); @@ -103470,7 +103727,7 @@ var ts; else { var scriptKind = propertyReader.getScriptKind(f, this.hostConfiguration.extraFileExtensions); var hasMixedContent = propertyReader.hasMixedContent(f, this.hostConfiguration.extraFileExtensions); - scriptInfo = this.getOrCreateScriptInfoNotOpenedByClientForNormalizedPath(normalizedPath, scriptKind, hasMixedContent, project.directoryStructureHost); + scriptInfo = this.getOrCreateScriptInfoNotOpenedByClientForNormalizedPath(normalizedPath, project.currentDirectory, scriptKind, hasMixedContent, project.directoryStructureHost); path = scriptInfo.path; // If this script info is not already a root add it if (!project.isRoot(scriptInfo)) { @@ -103511,6 +103768,18 @@ var ts; } this.addFilesToNonInferredProjectAndUpdateGraph(project, newUncheckedFiles, propertyReader, newTypeAcquisition); }; + /** + * Reload the file names from config file specs and update the project graph + */ + /*@internal*/ + ProjectService.prototype.reloadFileNamesOfConfiguredProject = function (project) { + var configFileSpecs = project.configFileSpecs; + var configFileName = project.getConfigFilePath(); + var fileNamesResult = ts.getFileNamesFromConfigSpecs(configFileSpecs, ts.getDirectoryPath(configFileName), project.getCompilationSettings(), project.getCachedDirectoryStructureHost(), this.hostConfiguration.extraFileExtensions); + project.updateErrorOnNoInputFiles(fileNamesResult.fileNames.length !== 0); + this.updateNonInferredProjectFiles(project, fileNamesResult.fileNames, fileNamePropertyReader); + return project.updateGraph(); + }; /** * Read the config file of the project again and update the project */ @@ -103611,8 +103880,8 @@ var ts; return project; }; /*@internal*/ - ProjectService.prototype.getOrCreateScriptInfoNotOpenedByClient = function (uncheckedFileName, hostToQueryFileExistsOn) { - return this.getOrCreateScriptInfoNotOpenedByClientForNormalizedPath(server.toNormalizedPath(uncheckedFileName), /*scriptKind*/ undefined, + ProjectService.prototype.getOrCreateScriptInfoNotOpenedByClient = function (uncheckedFileName, currentDirectory, hostToQueryFileExistsOn) { + return this.getOrCreateScriptInfoNotOpenedByClientForNormalizedPath(server.toNormalizedPath(uncheckedFileName), currentDirectory, /*scriptKind*/ undefined, /*hasMixedContent*/ undefined, hostToQueryFileExistsOn); }; ProjectService.prototype.getScriptInfo = function (uncheckedFileName) { @@ -103634,18 +103903,23 @@ var ts; } }; /*@internal*/ - ProjectService.prototype.getOrCreateScriptInfoNotOpenedByClientForNormalizedPath = function (fileName, scriptKind, hasMixedContent, hostToQueryFileExistsOn) { - return this.getOrCreateScriptInfoForNormalizedPath(fileName, /*openedByClient*/ false, /*fileContent*/ undefined, scriptKind, hasMixedContent, hostToQueryFileExistsOn); + ProjectService.prototype.getOrCreateScriptInfoNotOpenedByClientForNormalizedPath = function (fileName, currentDirectory, scriptKind, hasMixedContent, hostToQueryFileExistsOn) { + return this.getOrCreateScriptInfoWorker(fileName, currentDirectory, /*openedByClient*/ false, /*fileContent*/ undefined, scriptKind, hasMixedContent, hostToQueryFileExistsOn); }; /*@internal*/ - ProjectService.prototype.getOrCreateScriptInfoOpenedByClientForNormalizedPath = function (fileName, fileContent, scriptKind, hasMixedContent, hostToQueryFileExistsOn) { - return this.getOrCreateScriptInfoForNormalizedPath(fileName, /*openedByClient*/ true, fileContent, scriptKind, hasMixedContent, hostToQueryFileExistsOn); + ProjectService.prototype.getOrCreateScriptInfoOpenedByClientForNormalizedPath = function (fileName, currentDirectory, fileContent, scriptKind, hasMixedContent) { + return this.getOrCreateScriptInfoWorker(fileName, currentDirectory, /*openedByClient*/ true, fileContent, scriptKind, hasMixedContent); }; ProjectService.prototype.getOrCreateScriptInfoForNormalizedPath = function (fileName, openedByClient, fileContent, scriptKind, hasMixedContent, hostToQueryFileExistsOn) { + return this.getOrCreateScriptInfoWorker(fileName, this.currentDirectory, openedByClient, fileContent, scriptKind, hasMixedContent, hostToQueryFileExistsOn); + }; + ProjectService.prototype.getOrCreateScriptInfoWorker = function (fileName, currentDirectory, openedByClient, fileContent, scriptKind, hasMixedContent, hostToQueryFileExistsOn) { ts.Debug.assert(fileContent === undefined || openedByClient, "ScriptInfo needs to be opened by client to be able to set its user defined content"); - var path = server.normalizedPathToPath(fileName, this.currentDirectory, this.toCanonicalFileName); + var path = server.normalizedPathToPath(fileName, currentDirectory, this.toCanonicalFileName); var info = this.getScriptInfoForPath(path); if (!info) { + ts.Debug.assert(ts.isRootedDiskPath(fileName) || openedByClient, "Script info with relative file name can only be open script info"); + ts.Debug.assert(!ts.isRootedDiskPath(fileName) || this.currentDirectory === currentDirectory || !this.openFilesWithNonRootedDiskPath.has(this.toCanonicalFileName(fileName)), "Open script files with non rooted disk path opened with current directory context cannot have same canonical names"); var isDynamic = server.isDynamicFileName(fileName); // If the file is not opened by client and the file doesnot exist on the disk, return if (!openedByClient && !isDynamic && !(hostToQueryFileExistsOn || this.host).fileExists(fileName)) { @@ -103656,6 +103930,10 @@ var ts; if (!openedByClient) { this.watchClosedScriptInfo(info); } + else if (!ts.isRootedDiskPath(fileName) && currentDirectory !== this.currentDirectory) { + // File that is opened by user but isn't rooted disk path + this.openFilesWithNonRootedDiskPath.set(this.toCanonicalFileName(fileName), info); + } } if (openedByClient && !info.isScriptOpen()) { // Opening closed script info @@ -103671,8 +103949,12 @@ var ts; } return info; }; + /** + * This gets the script info for the normalized path. If the path is not rooted disk path then the open script info with project root context is preferred + */ ProjectService.prototype.getScriptInfoForNormalizedPath = function (fileName) { - return this.getScriptInfoForPath(server.normalizedPathToPath(fileName, this.currentDirectory, this.toCanonicalFileName)); + return !ts.isRootedDiskPath(fileName) && this.openFilesWithNonRootedDiskPath.get(this.toCanonicalFileName(fileName)) || + this.getScriptInfoForPath(server.normalizedPathToPath(fileName, this.currentDirectory, this.toCanonicalFileName)); }; ProjectService.prototype.getScriptInfoForPath = function (fileName) { return this.filenameToScriptInfo.get(fileName); @@ -103758,7 +104040,7 @@ var ts; } else if (!updatedProjects.has(configFileName)) { if (delayReload) { - project.pendingReload = true; + project.pendingReload = ts.ConfigFileProgramReloadLevel.Full; this.delayUpdateProjectGraph(project); } else { @@ -103839,7 +104121,7 @@ var ts; var configFileName; var sendConfigFileDiagEvent = false; var configFileErrors; - var info = this.getOrCreateScriptInfoOpenedByClientForNormalizedPath(fileName, fileContent, scriptKind, hasMixedContent); + var info = this.getOrCreateScriptInfoOpenedByClientForNormalizedPath(fileName, projectRootPath ? this.getNormalizedAbsolutePath(projectRootPath) : this.currentDirectory, fileContent, scriptKind, hasMixedContent); var project = this.findContainingExternalProject(fileName); if (!project) { configFileName = this.getConfigFileNameForFile(info, projectRootPath); @@ -103900,13 +104182,13 @@ var ts; this.printProjects(); }; ProjectService.prototype.collectChanges = function (lastKnownProjectVersions, currentProjects, result) { - var _loop_10 = function (proj) { + var _loop_11 = function (proj) { var knownProject = ts.forEach(lastKnownProjectVersions, function (p) { return p.projectName === proj.getProjectName() && p; }); result.push(proj.getChangesSinceVersion(knownProject && knownProject.version)); }; for (var _i = 0, currentProjects_1 = currentProjects; _i < currentProjects_1.length; _i++) { var proj = currentProjects_1[_i]; - _loop_10(proj); + _loop_11(proj); } }; /* @internal */ @@ -104029,27 +104311,34 @@ var ts; ProjectService.prototype.applySafeList = function (proj) { var _this = this; var rootFiles = proj.rootFiles, typeAcquisition = proj.typeAcquisition; - var types = (typeAcquisition && typeAcquisition.include) || []; + ts.Debug.assert(!!typeAcquisition, "proj.typeAcquisition should be set by now"); + // If type acquisition has been explicitly disabled, do not exclude anything from the project + if (typeAcquisition.enable === false) { + return []; + } + var typeAcqInclude = typeAcquisition.include || (typeAcquisition.include = []); var excludeRules = []; var normalizedNames = rootFiles.map(function (f) { return ts.normalizeSlashes(f.fileName); }); var excludedFiles = []; - var _loop_11 = function (name) { - var rule = this_2.safelist[name]; + var _loop_12 = function (name) { + var rule = this_3.safelist[name]; for (var _i = 0, normalizedNames_1 = normalizedNames; _i < normalizedNames_1.length; _i++) { var root = normalizedNames_1[_i]; if (rule.match.test(root)) { - this_2.logger.info("Excluding files based on rule " + name); + this_3.logger.info("Excluding files based on rule " + name + " matching file '" + root + "'"); // If the file matches, collect its types packages and exclude rules if (rule.types) { for (var _a = 0, _b = rule.types; _a < _b.length; _a++) { var type = _b[_a]; - if (types.indexOf(type) < 0) { - types.push(type); + // Best-effort de-duping here - doesn't need to be unduplicated but + // we don't want the list to become a 400-element array of just 'kendo' + if (typeAcqInclude.indexOf(type) < 0) { + typeAcqInclude.push(type); } } } if (rule.exclude) { - var _loop_12 = function (exclude) { + var _loop_13 = function (exclude) { var processedRule = root.replace(rule.match, function () { var groups = []; for (var _i = 0; _i < arguments.length; _i++) { @@ -104076,7 +104365,7 @@ var ts; }; for (var _c = 0, _d = rule.exclude; _c < _d.length; _c++) { var exclude = _d[_c]; - _loop_12(exclude); + _loop_13(exclude); } } else { @@ -104088,29 +104377,53 @@ var ts; } } } - // Copy back this field into the project if needed - if (types.length > 0) { - proj.typeAcquisition = proj.typeAcquisition || {}; - proj.typeAcquisition.include = types; - } }; - var this_2 = this; + var this_3 = this; for (var _i = 0, _a = Object.keys(this.safelist); _i < _a.length; _i++) { var name = _a[_i]; - _loop_11(name); + _loop_12(name); } var excludeRegexes = excludeRules.map(function (e) { return new RegExp(e, "i"); }); var filesToKeep = []; - var _loop_13 = function (i) { + var _loop_14 = function (i) { if (excludeRegexes.some(function (re) { return re.test(normalizedNames[i]); })) { excludedFiles.push(normalizedNames[i]); } else { - filesToKeep.push(proj.rootFiles[i]); + var exclude = false; + if (typeAcquisition.enable || typeAcquisition.enableAutoDiscovery) { + var baseName = ts.getBaseFileName(normalizedNames[i].toLowerCase()); + if (ts.fileExtensionIs(baseName, "js")) { + var inferredTypingName = ts.removeFileExtension(baseName); + var cleanedTypingName = ts.removeMinAndVersionNumbers(inferredTypingName); + if (this_4.legacySafelist[cleanedTypingName]) { + this_4.logger.info("Excluded '" + normalizedNames[i] + "' because it matched " + cleanedTypingName + " from the legacy safelist"); + excludedFiles.push(normalizedNames[i]); + // *exclude* it from the project... + exclude = true; + // ... but *include* it in the list of types to acquire + var typeName = this_4.legacySafelist[cleanedTypingName]; + // Same best-effort dedupe as above + if (typeAcqInclude.indexOf(typeName) < 0) { + typeAcqInclude.push(typeName); + } + } + } + } + if (!exclude) { + // Exclude any minified files that get this far + if (/^.+[\.-]min\.js$/.test(normalizedNames[i])) { + excludedFiles.push(normalizedNames[i]); + } + else { + filesToKeep.push(proj.rootFiles[i]); + } + } } }; + var this_4 = this; for (var i = 0; i < proj.rootFiles.length; i++) { - _loop_13(i); + _loop_14(i); } proj.rootFiles = filesToKeep; return excludedFiles; @@ -104123,6 +104436,12 @@ var ts; var typeAcquisition = ts.convertEnableAutoDiscoveryToEnable(proj.typingOptions); proj.typeAcquisition = typeAcquisition; } + proj.typeAcquisition = proj.typeAcquisition || {}; + proj.typeAcquisition.include = proj.typeAcquisition.include || []; + proj.typeAcquisition.exclude = proj.typeAcquisition.exclude || []; + if (proj.typeAcquisition.enable === undefined) { + proj.typeAcquisition.enable = server.hasNoTypeScriptSource(proj.rootFiles.map(function (f) { return f.fileName; })); + } var excludedFiles = this.applySafeList(proj); var tsConfigFiles; var rootFiles = []; @@ -104215,8 +104534,7 @@ var ts; else { // no config files - remove the item from the collection this.externalProjectToConfiguredProjectMap.delete(proj.projectFileName); - var newProj = this.createExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition); - newProj.excludedFiles = excludedFiles; + this.createExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition, excludedFiles); } if (!suppressRefreshOfInferredProjects) { this.ensureProjectStructuresUptoDate(/*refreshInferredProjects*/ true); diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index cef3b185583..41baa1770e1 100644 --- a/lib/typescript.d.ts +++ b/lib/typescript.d.ts @@ -313,46 +313,49 @@ declare namespace ts { JsxSelfClosingElement = 250, JsxOpeningElement = 251, JsxClosingElement = 252, - JsxAttribute = 253, - JsxAttributes = 254, - JsxSpreadAttribute = 255, - JsxExpression = 256, - CaseClause = 257, - DefaultClause = 258, - HeritageClause = 259, - CatchClause = 260, - PropertyAssignment = 261, - ShorthandPropertyAssignment = 262, - SpreadAssignment = 263, - EnumMember = 264, - SourceFile = 265, - Bundle = 266, - JSDocTypeExpression = 267, - JSDocAllType = 268, - JSDocUnknownType = 269, - JSDocNullableType = 270, - JSDocNonNullableType = 271, - JSDocOptionalType = 272, - JSDocFunctionType = 273, - JSDocVariadicType = 274, - JSDocComment = 275, - JSDocTag = 276, - JSDocAugmentsTag = 277, - JSDocClassTag = 278, - JSDocParameterTag = 279, - JSDocReturnTag = 280, - JSDocTypeTag = 281, - JSDocTemplateTag = 282, - JSDocTypedefTag = 283, - JSDocPropertyTag = 284, - JSDocTypeLiteral = 285, - SyntaxList = 286, - NotEmittedStatement = 287, - PartiallyEmittedExpression = 288, - CommaListExpression = 289, - MergeDeclarationMarker = 290, - EndOfDeclarationMarker = 291, - Count = 292, + JsxFragment = 253, + JsxOpeningFragment = 254, + JsxClosingFragment = 255, + JsxAttribute = 256, + JsxAttributes = 257, + JsxSpreadAttribute = 258, + JsxExpression = 259, + CaseClause = 260, + DefaultClause = 261, + HeritageClause = 262, + CatchClause = 263, + PropertyAssignment = 264, + ShorthandPropertyAssignment = 265, + SpreadAssignment = 266, + EnumMember = 267, + SourceFile = 268, + Bundle = 269, + JSDocTypeExpression = 270, + JSDocAllType = 271, + JSDocUnknownType = 272, + JSDocNullableType = 273, + JSDocNonNullableType = 274, + JSDocOptionalType = 275, + JSDocFunctionType = 276, + JSDocVariadicType = 277, + JSDocComment = 278, + JSDocTag = 279, + JSDocAugmentsTag = 280, + JSDocClassTag = 281, + JSDocParameterTag = 282, + JSDocReturnTag = 283, + JSDocTypeTag = 284, + JSDocTemplateTag = 285, + JSDocTypedefTag = 286, + JSDocPropertyTag = 287, + JSDocTypeLiteral = 288, + SyntaxList = 289, + NotEmittedStatement = 290, + PartiallyEmittedExpression = 291, + CommaListExpression = 292, + MergeDeclarationMarker = 293, + EndOfDeclarationMarker = 294, + Count = 295, FirstAssignment = 58, LastAssignment = 70, FirstCompoundAssignment = 59, @@ -378,10 +381,10 @@ declare namespace ts { FirstBinaryOperator = 27, LastBinaryOperator = 70, FirstNode = 143, - FirstJSDocNode = 267, - LastJSDocNode = 285, - FirstJSDocTagNode = 276, - LastJSDocTagNode = 285, + FirstJSDocNode = 270, + LastJSDocNode = 288, + FirstJSDocTagNode = 279, + LastJSDocTagNode = 288, } enum NodeFlags { None = 0, @@ -1061,6 +1064,20 @@ declare namespace ts { tagName: JsxTagNameExpression; attributes: JsxAttributes; } + interface JsxFragment extends PrimaryExpression { + kind: SyntaxKind.JsxFragment; + openingFragment: JsxOpeningFragment; + children: NodeArray; + closingFragment: JsxClosingFragment; + } + interface JsxOpeningFragment extends Expression { + kind: SyntaxKind.JsxOpeningFragment; + parent?: JsxFragment; + } + interface JsxClosingFragment extends Expression { + kind: SyntaxKind.JsxClosingFragment; + parent?: JsxFragment; + } interface JsxAttribute extends ObjectLiteralElement { kind: SyntaxKind.JsxAttribute; parent?: JsxAttributes; @@ -1088,7 +1105,7 @@ declare namespace ts { containsOnlyWhiteSpaces: boolean; parent?: JsxElement; } - type JsxChild = JsxText | JsxExpression | JsxElement | JsxSelfClosingElement; + type JsxChild = JsxText | JsxExpression | JsxElement | JsxSelfClosingElement | JsxFragment; interface Statement extends Node { _statementBrand: any; } @@ -3056,6 +3073,9 @@ declare namespace ts { function isJsxSelfClosingElement(node: Node): node is JsxSelfClosingElement; function isJsxOpeningElement(node: Node): node is JsxOpeningElement; function isJsxClosingElement(node: Node): node is JsxClosingElement; + function isJsxFragment(node: Node): node is JsxFragment; + function isJsxOpeningFragment(node: Node): node is JsxOpeningFragment; + function isJsxClosingFragment(node: Node): node is JsxClosingFragment; function isJsxAttribute(node: Node): node is JsxAttribute; function isJsxAttributes(node: Node): node is JsxAttributes; function isJsxSpreadAttribute(node: Node): node is JsxSpreadAttribute; @@ -3447,6 +3467,8 @@ declare namespace ts { function updateJsxOpeningElement(node: JsxOpeningElement, tagName: JsxTagNameExpression, attributes: JsxAttributes): JsxOpeningElement; function createJsxClosingElement(tagName: JsxTagNameExpression): JsxClosingElement; function updateJsxClosingElement(node: JsxClosingElement, tagName: JsxTagNameExpression): JsxClosingElement; + function createJsxFragment(openingFragment: JsxOpeningFragment, children: ReadonlyArray, closingFragment: JsxClosingFragment): JsxFragment; + function updateJsxFragment(node: JsxFragment, openingFragment: JsxOpeningFragment, children: ReadonlyArray, closingFragment: JsxClosingFragment): JsxFragment; function createJsxAttribute(name: Identifier, initializer: StringLiteral | JsxExpression): JsxAttribute; function updateJsxAttribute(node: JsxAttribute, name: Identifier, initializer: StringLiteral | JsxExpression): JsxAttribute; function createJsxAttributes(properties: ReadonlyArray): JsxAttributes; @@ -3945,7 +3967,15 @@ declare namespace ts { isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean; getSpanOfEnclosingComment(fileName: string, position: number, onlyMultiLine: boolean): TextSpan; getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[], formatOptions: FormatCodeSettings): CodeAction[]; + applyCodeActionCommand(action: CodeActionCommand): Promise; + applyCodeActionCommand(action: CodeActionCommand[]): Promise; + applyCodeActionCommand(action: CodeActionCommand | CodeActionCommand[]): Promise; + /** @deprecated `fileName` will be ignored */ applyCodeActionCommand(fileName: string, action: CodeActionCommand): Promise; + /** @deprecated `fileName` will be ignored */ + applyCodeActionCommand(fileName: string, action: CodeActionCommand[]): Promise; + /** @deprecated `fileName` will be ignored */ + applyCodeActionCommand(fileName: string, action: CodeActionCommand | CodeActionCommand[]): Promise; getApplicableRefactors(fileName: string, positionOrRaneg: number | TextRange): ApplicableRefactorInfo[]; getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string): RefactorEditInfo | undefined; getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput; diff --git a/lib/typescript.js b/lib/typescript.js index 4d47deeb416..a1d0b8ad25b 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -313,56 +313,59 @@ var ts; SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 250] = "JsxSelfClosingElement"; SyntaxKind[SyntaxKind["JsxOpeningElement"] = 251] = "JsxOpeningElement"; SyntaxKind[SyntaxKind["JsxClosingElement"] = 252] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 253] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxAttributes"] = 254] = "JsxAttributes"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 255] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 256] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxFragment"] = 253] = "JsxFragment"; + SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 254] = "JsxOpeningFragment"; + SyntaxKind[SyntaxKind["JsxClosingFragment"] = 255] = "JsxClosingFragment"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 256] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxAttributes"] = 257] = "JsxAttributes"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 258] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 259] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 257] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 258] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 259] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 260] = "CatchClause"; + SyntaxKind[SyntaxKind["CaseClause"] = 260] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 261] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 262] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 263] = "CatchClause"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 261] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 262] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 263] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 264] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 265] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 266] = "SpreadAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 264] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 267] = "EnumMember"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 265] = "SourceFile"; - SyntaxKind[SyntaxKind["Bundle"] = 266] = "Bundle"; + SyntaxKind[SyntaxKind["SourceFile"] = 268] = "SourceFile"; + SyntaxKind[SyntaxKind["Bundle"] = 269] = "Bundle"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 267] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 270] = "JSDocTypeExpression"; // The * type - SyntaxKind[SyntaxKind["JSDocAllType"] = 268] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 271] = "JSDocAllType"; // The ? type - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 269] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 270] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 271] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 272] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 273] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 274] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocComment"] = 275] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocTag"] = 276] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 277] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocClassTag"] = 278] = "JSDocClassTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 279] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 280] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 281] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 282] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 283] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 284] = "JSDocPropertyTag"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 285] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 272] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 273] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 274] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 275] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 276] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 277] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 278] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTag"] = 279] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 280] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocClassTag"] = 281] = "JSDocClassTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 282] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 283] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 284] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 285] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 286] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 287] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 288] = "JSDocTypeLiteral"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 286] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 289] = "SyntaxList"; // Transformation nodes - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 287] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 288] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["CommaListExpression"] = 289] = "CommaListExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 290] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 291] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 290] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 291] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["CommaListExpression"] = 292] = "CommaListExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 293] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 294] = "EndOfDeclarationMarker"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 292] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 295] = "Count"; // Markers SyntaxKind[SyntaxKind["FirstAssignment"] = 58] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 70] = "LastAssignment"; @@ -389,10 +392,12 @@ var ts; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 27] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 70] = "LastBinaryOperator"; SyntaxKind[SyntaxKind["FirstNode"] = 143] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 267] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 285] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 276] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 285] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 270] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 288] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 279] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 288] = "LastJSDocTagNode"; + /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 117] = "FirstContextualKeyword"; + /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 142] = "LastContextualKeyword"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); var NodeFlags; (function (NodeFlags) { @@ -2513,6 +2518,10 @@ var ts; return Array.isArray ? Array.isArray(value) : value instanceof Array; } ts.isArray = isArray; + function toArray(value) { + return isArray(value) ? value : [value]; + } + ts.toArray = toArray; /** * Tests whether a value is string */ @@ -3555,6 +3564,16 @@ var ts; return (removeFileExtension(path) + newExtension); } ts.changeExtension = changeExtension; + /** + * Takes a string like "jquery-min.4.2.3" and returns "jquery" + */ + function removeMinAndVersionNumbers(fileName) { + // Match a "." or "-" followed by a version number or 'min' at the end of the name + var trailingMinOrVersion = /[.-]((min)|(\d+(\.\d+)*))$/; + // The "min" or version may both be present, in either order, so try applying the above twice. + return fileName.replace(trailingMinOrVersion, "").replace(trailingMinOrVersion, ""); + } + ts.removeMinAndVersionNumbers = removeMinAndVersionNumbers; function Symbol(flags, name) { this.flags = flags; this.escapedName = name; @@ -3964,10 +3983,9 @@ var ts; function addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath) { var existingResult = getCachedFileSystemEntries(fileOrDirectoryPath); if (existingResult) { - // This was a folder already present, remove it if this doesnt exist any more - if (!host.directoryExists(fileOrDirectory)) { - cachedReadDirectoryResult.delete(fileOrDirectoryPath); - } + // Just clear the cache for now + // For now just clear the cache, since this could mean that multiple level entries might need to be re-evaluated + clearCache(); } else { // This was earlier a file (hence not in cached directory contents) @@ -3980,8 +3998,14 @@ var ts; fileExists: host.fileExists(fileOrDirectoryPath), directoryExists: host.directoryExists(fileOrDirectoryPath) }; - updateFilesOfFileSystemEntry(parentResult, baseName, fsQueryResult.fileExists); - updateFileSystemEntry(parentResult.directories, baseName, fsQueryResult.directoryExists); + if (fsQueryResult.directoryExists || hasEntry(parentResult.directories, baseName)) { + // Folder added or removed, clear the cache instead of updating the folder and its structure + clearCache(); + } + else { + // No need to update the directory structure, just files + updateFilesOfFileSystemEntry(parentResult, baseName, fsQueryResult.fileExists); + } return fsQueryResult; } } @@ -5394,6 +5418,9 @@ var ts; super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: diag(17011, ts.DiagnosticCategory.Error, "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", "'super' must be called before accessing a property of 'super' in the constructor of a derived class."), _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2: diag(17012, ts.DiagnosticCategory.Error, "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012", "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'?"), Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: diag(17013, ts.DiagnosticCategory.Error, "Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013", "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor."), + JSX_fragment_has_no_corresponding_closing_tag: diag(17014, ts.DiagnosticCategory.Error, "JSX_fragment_has_no_corresponding_closing_tag_17014", "JSX fragment has no corresponding closing tag."), + Expected_corresponding_closing_tag_for_JSX_fragment: diag(17015, ts.DiagnosticCategory.Error, "Expected_corresponding_closing_tag_for_JSX_fragment_17015", "Expected corresponding closing tag for JSX fragment."), + JSX_fragment_is_not_supported_when_using_jsxFactory: diag(17016, ts.DiagnosticCategory.Error, "JSX_fragment_is_not_supported_when_using_jsxFactory_17016", "JSX fragment is not supported when using --jsxFactory"), Circularity_detected_while_resolving_configuration_Colon_0: diag(18000, ts.DiagnosticCategory.Error, "Circularity_detected_while_resolving_configuration_Colon_0_18000", "Circularity detected while resolving configuration: {0}"), A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: diag(18001, ts.DiagnosticCategory.Error, "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", "A path in an 'extends' option must be relative or rooted, but '{0}' is not."), The_files_list_in_config_file_0_is_empty: diag(18002, ts.DiagnosticCategory.Error, "The_files_list_in_config_file_0_is_empty_18002", "The 'files' list in config file '{0}' is empty."), @@ -5446,6 +5473,11 @@ var ts; return token >= 71 /* Identifier */; } ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; + /* @internal */ + function tokenIsIdentifierOrKeywordOrGreaterThan(token) { + return token === 29 /* GreaterThanToken */ || tokenIsIdentifierOrKeyword(token); + } + ts.tokenIsIdentifierOrKeywordOrGreaterThan = tokenIsIdentifierOrKeywordOrGreaterThan; var textToToken = ts.createMapFromTemplate({ "abstract": 117 /* AbstractKeyword */, "any": 119 /* AnyKeyword */, @@ -7356,7 +7388,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 265 /* SourceFile */) { + while (node && node.kind !== 268 /* SourceFile */) { node = node.parent; } return node; @@ -7477,7 +7509,7 @@ var ts; // the syntax list itself considers them as normal trivia. Therefore if we simply skip // trivia for the list, we may have skipped the JSDocComment as well. So we should process its // first child to determine the actual position of its first token. - if (node.kind === 286 /* SyntaxList */ && node._children.length > 0) { + if (node.kind === 289 /* SyntaxList */ && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); @@ -7594,7 +7626,7 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 226 /* VariableDeclaration */ && node.parent.kind === 260 /* CatchClause */; + return node.kind === 226 /* VariableDeclaration */ && node.parent.kind === 263 /* CatchClause */; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { @@ -7620,7 +7652,7 @@ var ts; return node && node.kind === 233 /* ModuleDeclaration */ && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 265 /* SourceFile */ || + return node.kind === 268 /* SourceFile */ || node.kind === 233 /* ModuleDeclaration */ || ts.isFunctionLike(node); } @@ -7637,7 +7669,7 @@ var ts; return false; } switch (node.parent.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: return ts.isExternalModule(node.parent); case 234 /* ModuleBlock */: return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); @@ -7652,9 +7684,9 @@ var ts; /* @internal */ function isBlockScope(node, parentNode) { switch (node.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 235 /* CaseBlock */: - case 260 /* CatchClause */: + case 263 /* CatchClause */: case 233 /* ModuleDeclaration */: case 214 /* ForStatement */: case 215 /* ForInStatement */: @@ -7683,12 +7715,12 @@ var ts; case 157 /* IndexSignature */: case 160 /* FunctionType */: case 161 /* ConstructorType */: - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: case 229 /* ClassDeclaration */: case 199 /* ClassExpression */: case 230 /* InterfaceDeclaration */: case 231 /* TypeAliasDeclaration */: - case 282 /* JSDocTemplateTag */: + case 285 /* JSDocTemplateTag */: case 228 /* FunctionDeclaration */: case 151 /* MethodDeclaration */: case 152 /* Constructor */: @@ -7809,7 +7841,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file @@ -7825,7 +7857,7 @@ var ts; case 230 /* InterfaceDeclaration */: case 233 /* ModuleDeclaration */: case 232 /* EnumDeclaration */: - case 264 /* EnumMember */: + case 267 /* EnumMember */: case 228 /* FunctionDeclaration */: case 186 /* FunctionExpression */: case 151 /* MethodDeclaration */: @@ -8012,11 +8044,11 @@ var ts; case 216 /* ForOfStatement */: case 220 /* WithStatement */: case 221 /* SwitchStatement */: - case 257 /* CaseClause */: - case 258 /* DefaultClause */: + case 260 /* CaseClause */: + case 261 /* DefaultClause */: case 222 /* LabeledStatement */: case 224 /* TryStatement */: - case 260 /* CatchClause */: + case 263 /* CatchClause */: return ts.forEachChild(node, traverse); } } @@ -8084,12 +8116,12 @@ var ts; if (node) { switch (node.kind) { case 176 /* BindingElement */: - case 264 /* EnumMember */: + case 267 /* EnumMember */: case 146 /* Parameter */: - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: case 226 /* VariableDeclaration */: return true; } @@ -8147,7 +8179,7 @@ var ts; ts.isThisTypePredicate = isThisTypePredicate; function getPropertyAssignment(objectLiteral, key, key2) { return ts.filter(objectLiteral.properties, function (property) { - if (property.kind === 261 /* PropertyAssignment */) { + if (property.kind === 264 /* PropertyAssignment */) { var propName = getTextOfPropertyName(property.name); return key === propName || (key2 && key2 === propName); } @@ -8216,7 +8248,7 @@ var ts; case 156 /* ConstructSignature */: case 157 /* IndexSignature */: case 232 /* EnumDeclaration */: - case 265 /* SourceFile */: + case 268 /* SourceFile */: return node; } } @@ -8422,6 +8454,7 @@ var ts; case 200 /* OmittedExpression */: case 249 /* JsxElement */: case 250 /* JsxSelfClosingElement */: + case 253 /* JsxFragment */: case 197 /* YieldExpression */: case 191 /* AwaitExpression */: case 204 /* MetaProperty */: @@ -8452,8 +8485,8 @@ var ts; case 146 /* Parameter */: case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: - case 264 /* EnumMember */: - case 261 /* PropertyAssignment */: + case 267 /* EnumMember */: + case 264 /* PropertyAssignment */: case 176 /* BindingElement */: return parent.initializer === node; case 210 /* ExpressionStatement */: @@ -8463,7 +8496,7 @@ var ts; case 219 /* ReturnStatement */: case 220 /* WithStatement */: case 221 /* SwitchStatement */: - case 257 /* CaseClause */: + case 260 /* CaseClause */: case 223 /* ThrowStatement */: return parent.expression === node; case 214 /* ForStatement */: @@ -8484,9 +8517,9 @@ var ts; case 144 /* ComputedPropertyName */: return node === parent.expression; case 147 /* Decorator */: - case 256 /* JsxExpression */: - case 255 /* JsxSpreadAttribute */: - case 263 /* SpreadAssignment */: + case 259 /* JsxExpression */: + case 258 /* JsxSpreadAttribute */: + case 266 /* SpreadAssignment */: return true; case 201 /* ExpressionWithTypeArguments */: return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent); @@ -8668,8 +8701,8 @@ var ts; case 146 /* Parameter */: case 151 /* MethodDeclaration */: case 150 /* MethodSignature */: - case 262 /* ShorthandPropertyAssignment */: - case 261 /* PropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: + case 264 /* PropertyAssignment */: case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: return node.questionToken !== undefined; @@ -8679,7 +8712,7 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 273 /* JSDocFunctionType */ && + return node.kind === 276 /* JSDocFunctionType */ && node.parameters.length > 0 && node.parameters[0].name && node.parameters[0].name.escapedText === "new"; @@ -8732,7 +8765,7 @@ var ts; // * @returns {number} // */ // var x = function(name) { return name.length; } - if (parent && (parent.kind === 261 /* PropertyAssignment */ || getNestedModuleDeclaration(parent))) { + if (parent && (parent.kind === 264 /* PropertyAssignment */ || getNestedModuleDeclaration(parent))) { getJSDocCommentsAndTagsWorker(parent); } if (parent && parent.parent && @@ -8777,7 +8810,7 @@ var ts; } ts.getParameterSymbolFromJSDoc = getParameterSymbolFromJSDoc; function getJSDocHost(node) { - ts.Debug.assert(node.parent.kind === 275 /* JSDocComment */); + ts.Debug.assert(node.parent.kind === 278 /* JSDocComment */); return node.parent.parent; } ts.getJSDocHost = getJSDocHost; @@ -8823,13 +8856,13 @@ var ts; case 198 /* SpreadElement */: node = parent; break; - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: if (parent.name !== node) { return 0 /* None */; } node = parent.parent; break; - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: if (parent.name === node) { return 0 /* None */; } @@ -8873,7 +8906,7 @@ var ts; ts.isNodeDescendantOf = isNodeDescendantOf; function isInAmbientContext(node) { while (node) { - if (hasModifier(node, 2 /* Ambient */) || (node.kind === 265 /* SourceFile */ && node.isDeclarationFile)) { + if (hasModifier(node, 2 /* Ambient */) || (node.kind === 268 /* SourceFile */ && node.isDeclarationFile)) { return true; } node = node.parent; @@ -8926,8 +8959,8 @@ var ts; case 150 /* MethodSignature */: case 153 /* GetAccessor */: case 154 /* SetAccessor */: - case 264 /* EnumMember */: - case 261 /* PropertyAssignment */: + case 267 /* EnumMember */: + case 264 /* PropertyAssignment */: case 179 /* PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; @@ -8945,7 +8978,7 @@ var ts; // Property name in binding element or import specifier return parent.propertyName === node; case 246 /* ExportSpecifier */: - case 253 /* JsxAttribute */: + case 256 /* JsxAttribute */: // Any name in an export specifier or JSX Attribute return true; } @@ -9054,6 +9087,14 @@ var ts; return 72 /* FirstKeyword */ <= token && token <= 142 /* LastKeyword */; } ts.isKeyword = isKeyword; + function isContextualKeyword(token) { + return 117 /* FirstContextualKeyword */ <= token && token <= 142 /* LastContextualKeyword */; + } + ts.isContextualKeyword = isContextualKeyword; + function isNonContextualKeyword(token) { + return isKeyword(token) && !isContextualKeyword(token); + } + ts.isNonContextualKeyword = isNonContextualKeyword; function isTrivia(token) { return 2 /* FirstTriviaToken */ <= token && token <= 7 /* LastTriviaToken */; } @@ -9219,7 +9260,7 @@ var ts; || kind === 153 /* GetAccessor */ || kind === 154 /* SetAccessor */ || kind === 233 /* ModuleDeclaration */ - || kind === 265 /* SourceFile */; + || kind === 268 /* SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(range) { @@ -9311,6 +9352,7 @@ var ts; case 199 /* ClassExpression */: case 249 /* JsxElement */: case 250 /* JsxSelfClosingElement */: + case 253 /* JsxFragment */: case 12 /* RegularExpressionLiteral */: case 13 /* NoSubstitutionTemplateLiteral */: case 196 /* TemplateExpression */: @@ -9397,7 +9439,7 @@ var ts; return 2; case 198 /* SpreadElement */: return 1; - case 289 /* CommaListExpression */: + case 292 /* CommaListExpression */: return 0; default: return -1; @@ -11079,8 +11121,8 @@ var ts; return undefined; } switch (declaration.kind) { - case 284 /* JSDocPropertyTag */: - case 279 /* JSDocParameterTag */: { + case 287 /* JSDocPropertyTag */: + case 282 /* JSDocParameterTag */: { var name = declaration.name; if (name.kind === 143 /* QualifiedName */) { return name.right; @@ -11099,7 +11141,7 @@ var ts; return undefined; } } - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return getNameOfJSDocTypedef(declaration); case 243 /* ExportAssignment */: { var expression = declaration.expression; @@ -11138,33 +11180,33 @@ var ts; * for example on a variable declaration whose initializer is a function expression. */ function hasJSDocParameterTags(node) { - return !!getFirstJSDocTag(node, 279 /* JSDocParameterTag */); + return !!getFirstJSDocTag(node, 282 /* JSDocParameterTag */); } ts.hasJSDocParameterTags = hasJSDocParameterTags; /** Gets the JSDoc augments tag for the node if present */ function getJSDocAugmentsTag(node) { - return getFirstJSDocTag(node, 277 /* JSDocAugmentsTag */); + return getFirstJSDocTag(node, 280 /* JSDocAugmentsTag */); } ts.getJSDocAugmentsTag = getJSDocAugmentsTag; /** Gets the JSDoc class tag for the node if present */ function getJSDocClassTag(node) { - return getFirstJSDocTag(node, 278 /* JSDocClassTag */); + return getFirstJSDocTag(node, 281 /* JSDocClassTag */); } ts.getJSDocClassTag = getJSDocClassTag; /** Gets the JSDoc return tag for the node if present */ function getJSDocReturnTag(node) { - return getFirstJSDocTag(node, 280 /* JSDocReturnTag */); + return getFirstJSDocTag(node, 283 /* JSDocReturnTag */); } ts.getJSDocReturnTag = getJSDocReturnTag; /** Gets the JSDoc template tag for the node if present */ function getJSDocTemplateTag(node) { - return getFirstJSDocTag(node, 282 /* JSDocTemplateTag */); + return getFirstJSDocTag(node, 285 /* JSDocTemplateTag */); } ts.getJSDocTemplateTag = getJSDocTemplateTag; /** Gets the JSDoc type tag for the node if present and valid */ function getJSDocTypeTag(node) { // We should have already issued an error if there were multiple type jsdocs, so just use the first one. - var tag = getFirstJSDocTag(node, 281 /* JSDocTypeTag */); + var tag = getFirstJSDocTag(node, 284 /* JSDocTypeTag */); if (tag && tag.typeExpression && tag.typeExpression.type) { return tag; } @@ -11183,7 +11225,7 @@ var ts; * tag directly on the node would be returned. */ function getJSDocType(node) { - var tag = getFirstJSDocTag(node, 281 /* JSDocTypeTag */); + var tag = getFirstJSDocTag(node, 284 /* JSDocTypeTag */); if (!tag && node.kind === 146 /* Parameter */) { var paramTags = getJSDocParameterTags(node); if (paramTags) { @@ -11445,7 +11487,7 @@ var ts; } ts.isParenthesizedExpression = isParenthesizedExpression; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 288 /* PartiallyEmittedExpression */) { + while (node.kind === 291 /* PartiallyEmittedExpression */) { node = node.expression; } return node; @@ -11723,137 +11765,149 @@ var ts; return node.kind === 252 /* JsxClosingElement */; } ts.isJsxClosingElement = isJsxClosingElement; + function isJsxFragment(node) { + return node.kind === 253 /* JsxFragment */; + } + ts.isJsxFragment = isJsxFragment; + function isJsxOpeningFragment(node) { + return node.kind === 254 /* JsxOpeningFragment */; + } + ts.isJsxOpeningFragment = isJsxOpeningFragment; + function isJsxClosingFragment(node) { + return node.kind === 255 /* JsxClosingFragment */; + } + ts.isJsxClosingFragment = isJsxClosingFragment; function isJsxAttribute(node) { - return node.kind === 253 /* JsxAttribute */; + return node.kind === 256 /* JsxAttribute */; } ts.isJsxAttribute = isJsxAttribute; function isJsxAttributes(node) { - return node.kind === 254 /* JsxAttributes */; + return node.kind === 257 /* JsxAttributes */; } ts.isJsxAttributes = isJsxAttributes; function isJsxSpreadAttribute(node) { - return node.kind === 255 /* JsxSpreadAttribute */; + return node.kind === 258 /* JsxSpreadAttribute */; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxExpression(node) { - return node.kind === 256 /* JsxExpression */; + return node.kind === 259 /* JsxExpression */; } ts.isJsxExpression = isJsxExpression; // Clauses function isCaseClause(node) { - return node.kind === 257 /* CaseClause */; + return node.kind === 260 /* CaseClause */; } ts.isCaseClause = isCaseClause; function isDefaultClause(node) { - return node.kind === 258 /* DefaultClause */; + return node.kind === 261 /* DefaultClause */; } ts.isDefaultClause = isDefaultClause; function isHeritageClause(node) { - return node.kind === 259 /* HeritageClause */; + return node.kind === 262 /* HeritageClause */; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 260 /* CatchClause */; + return node.kind === 263 /* CatchClause */; } ts.isCatchClause = isCatchClause; // Property assignments function isPropertyAssignment(node) { - return node.kind === 261 /* PropertyAssignment */; + return node.kind === 264 /* PropertyAssignment */; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 262 /* ShorthandPropertyAssignment */; + return node.kind === 265 /* ShorthandPropertyAssignment */; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isSpreadAssignment(node) { - return node.kind === 263 /* SpreadAssignment */; + return node.kind === 266 /* SpreadAssignment */; } ts.isSpreadAssignment = isSpreadAssignment; // Enum function isEnumMember(node) { - return node.kind === 264 /* EnumMember */; + return node.kind === 267 /* EnumMember */; } ts.isEnumMember = isEnumMember; // Top-level nodes function isSourceFile(node) { - return node.kind === 265 /* SourceFile */; + return node.kind === 268 /* SourceFile */; } ts.isSourceFile = isSourceFile; function isBundle(node) { - return node.kind === 266 /* Bundle */; + return node.kind === 269 /* Bundle */; } ts.isBundle = isBundle; // JSDoc function isJSDocTypeExpression(node) { - return node.kind === 267 /* JSDocTypeExpression */; + return node.kind === 270 /* JSDocTypeExpression */; } ts.isJSDocTypeExpression = isJSDocTypeExpression; function isJSDocAllType(node) { - return node.kind === 268 /* JSDocAllType */; + return node.kind === 271 /* JSDocAllType */; } ts.isJSDocAllType = isJSDocAllType; function isJSDocUnknownType(node) { - return node.kind === 269 /* JSDocUnknownType */; + return node.kind === 272 /* JSDocUnknownType */; } ts.isJSDocUnknownType = isJSDocUnknownType; function isJSDocNullableType(node) { - return node.kind === 270 /* JSDocNullableType */; + return node.kind === 273 /* JSDocNullableType */; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 271 /* JSDocNonNullableType */; + return node.kind === 274 /* JSDocNonNullableType */; } ts.isJSDocNonNullableType = isJSDocNonNullableType; function isJSDocOptionalType(node) { - return node.kind === 272 /* JSDocOptionalType */; + return node.kind === 275 /* JSDocOptionalType */; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 273 /* JSDocFunctionType */; + return node.kind === 276 /* JSDocFunctionType */; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 274 /* JSDocVariadicType */; + return node.kind === 277 /* JSDocVariadicType */; } ts.isJSDocVariadicType = isJSDocVariadicType; function isJSDoc(node) { - return node.kind === 275 /* JSDocComment */; + return node.kind === 278 /* JSDocComment */; } ts.isJSDoc = isJSDoc; function isJSDocAugmentsTag(node) { - return node.kind === 277 /* JSDocAugmentsTag */; + return node.kind === 280 /* JSDocAugmentsTag */; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocParameterTag(node) { - return node.kind === 279 /* JSDocParameterTag */; + return node.kind === 282 /* JSDocParameterTag */; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 280 /* JSDocReturnTag */; + return node.kind === 283 /* JSDocReturnTag */; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocTypeTag(node) { - return node.kind === 281 /* JSDocTypeTag */; + return node.kind === 284 /* JSDocTypeTag */; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 282 /* JSDocTemplateTag */; + return node.kind === 285 /* JSDocTemplateTag */; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 283 /* JSDocTypedefTag */; + return node.kind === 286 /* JSDocTypedefTag */; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocPropertyTag(node) { - return node.kind === 284 /* JSDocPropertyTag */; + return node.kind === 287 /* JSDocPropertyTag */; } ts.isJSDocPropertyTag = isJSDocPropertyTag; function isJSDocPropertyLikeTag(node) { - return node.kind === 284 /* JSDocPropertyTag */ || node.kind === 279 /* JSDocParameterTag */; + return node.kind === 287 /* JSDocPropertyTag */ || node.kind === 282 /* JSDocParameterTag */; } ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; function isJSDocTypeLiteral(node) { - return node.kind === 285 /* JSDocTypeLiteral */; + return node.kind === 288 /* JSDocTypeLiteral */; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; })(ts || (ts = {})); @@ -11864,7 +11918,7 @@ var ts; (function (ts) { /* @internal */ function isSyntaxList(n) { - return n.kind === 286 /* SyntaxList */; + return n.kind === 289 /* SyntaxList */; } ts.isSyntaxList = isSyntaxList; /* @internal */ @@ -12010,7 +12064,7 @@ var ts; case 156 /* ConstructSignature */: case 157 /* IndexSignature */: case 160 /* FunctionType */: - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: case 161 /* ConstructorType */: return true; default: @@ -12057,9 +12111,9 @@ var ts; ts.isTypeElement = isTypeElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 261 /* PropertyAssignment */ - || kind === 262 /* ShorthandPropertyAssignment */ - || kind === 263 /* SpreadAssignment */ + return kind === 264 /* PropertyAssignment */ + || kind === 265 /* ShorthandPropertyAssignment */ + || kind === 266 /* SpreadAssignment */ || kind === 151 /* MethodDeclaration */ || kind === 153 /* GetAccessor */ || kind === 154 /* SetAccessor */ @@ -12081,13 +12135,13 @@ var ts; || kind === 95 /* NullKeyword */ || kind === 130 /* NeverKeyword */ || kind === 201 /* ExpressionWithTypeArguments */ - || kind === 268 /* JSDocAllType */ - || kind === 269 /* JSDocUnknownType */ - || kind === 270 /* JSDocNullableType */ - || kind === 271 /* JSDocNonNullableType */ - || kind === 272 /* JSDocOptionalType */ - || kind === 273 /* JSDocFunctionType */ - || kind === 274 /* JSDocVariadicType */; + || kind === 271 /* JSDocAllType */ + || kind === 272 /* JSDocUnknownType */ + || kind === 273 /* JSDocNullableType */ + || kind === 274 /* JSDocNonNullableType */ + || kind === 275 /* JSDocOptionalType */ + || kind === 276 /* JSDocFunctionType */ + || kind === 277 /* JSDocVariadicType */; } /** * Node test that determines whether a node is a valid type node. @@ -12225,6 +12279,7 @@ var ts; case 181 /* CallExpression */: case 249 /* JsxElement */: case 250 /* JsxSelfClosingElement */: + case 253 /* JsxFragment */: case 183 /* TaggedTemplateExpression */: case 177 /* ArrayLiteralExpression */: case 185 /* ParenthesizedExpression */: @@ -12300,8 +12355,8 @@ var ts; case 198 /* SpreadElement */: case 202 /* AsExpression */: case 200 /* OmittedExpression */: - case 289 /* CommaListExpression */: - case 288 /* PartiallyEmittedExpression */: + case 292 /* CommaListExpression */: + case 291 /* PartiallyEmittedExpression */: return true; default: return isUnaryExpressionKind(kind); @@ -12315,12 +12370,12 @@ var ts; ts.isAssertionExpression = isAssertionExpression; /* @internal */ function isPartiallyEmittedExpression(node) { - return node.kind === 288 /* PartiallyEmittedExpression */; + return node.kind === 291 /* PartiallyEmittedExpression */; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; /* @internal */ function isNotEmittedStatement(node) { - return node.kind === 287 /* NotEmittedStatement */; + return node.kind === 290 /* NotEmittedStatement */; } ts.isNotEmittedStatement = isNotEmittedStatement; /* @internal */ @@ -12408,7 +12463,7 @@ var ts; || kind === 199 /* ClassExpression */ || kind === 152 /* Constructor */ || kind === 232 /* EnumDeclaration */ - || kind === 264 /* EnumMember */ + || kind === 267 /* EnumMember */ || kind === 246 /* ExportSpecifier */ || kind === 228 /* FunctionDeclaration */ || kind === 186 /* FunctionExpression */ @@ -12417,22 +12472,22 @@ var ts; || kind === 237 /* ImportEqualsDeclaration */ || kind === 242 /* ImportSpecifier */ || kind === 230 /* InterfaceDeclaration */ - || kind === 253 /* JsxAttribute */ + || kind === 256 /* JsxAttribute */ || kind === 151 /* MethodDeclaration */ || kind === 150 /* MethodSignature */ || kind === 233 /* ModuleDeclaration */ || kind === 236 /* NamespaceExportDeclaration */ || kind === 240 /* NamespaceImport */ || kind === 146 /* Parameter */ - || kind === 261 /* PropertyAssignment */ + || kind === 264 /* PropertyAssignment */ || kind === 149 /* PropertyDeclaration */ || kind === 148 /* PropertySignature */ || kind === 154 /* SetAccessor */ - || kind === 262 /* ShorthandPropertyAssignment */ + || kind === 265 /* ShorthandPropertyAssignment */ || kind === 231 /* TypeAliasDeclaration */ || kind === 145 /* TypeParameter */ || kind === 226 /* VariableDeclaration */ - || kind === 283 /* JSDocTypedefTag */; + || kind === 286 /* JSDocTypedefTag */; } function isDeclarationStatementKind(kind) { return kind === 228 /* FunctionDeclaration */ @@ -12467,14 +12522,14 @@ var ts; || kind === 208 /* VariableStatement */ || kind === 213 /* WhileStatement */ || kind === 220 /* WithStatement */ - || kind === 287 /* NotEmittedStatement */ - || kind === 291 /* EndOfDeclarationMarker */ - || kind === 290 /* MergeDeclarationMarker */; + || kind === 290 /* NotEmittedStatement */ + || kind === 294 /* EndOfDeclarationMarker */ + || kind === 293 /* MergeDeclarationMarker */; } /* @internal */ function isDeclaration(node) { if (node.kind === 145 /* TypeParameter */) { - return node.parent.kind !== 282 /* JSDocTemplateTag */ || ts.isInJavaScriptFile(node); + return node.parent.kind !== 285 /* JSDocTemplateTag */ || ts.isInJavaScriptFile(node); } return isDeclarationKind(node.kind); } @@ -12504,7 +12559,7 @@ var ts; if (node.kind !== 207 /* Block */) return false; if (node.parent !== undefined) { - if (node.parent.kind === 224 /* TryStatement */ || node.parent.kind === 260 /* CatchClause */) { + if (node.parent.kind === 224 /* TryStatement */ || node.parent.kind === 263 /* CatchClause */) { return false; } } @@ -12532,23 +12587,24 @@ var ts; function isJsxChild(node) { var kind = node.kind; return kind === 249 /* JsxElement */ - || kind === 256 /* JsxExpression */ + || kind === 259 /* JsxExpression */ || kind === 250 /* JsxSelfClosingElement */ - || kind === 10 /* JsxText */; + || kind === 10 /* JsxText */ + || kind === 253 /* JsxFragment */; } ts.isJsxChild = isJsxChild; /* @internal */ function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 253 /* JsxAttribute */ - || kind === 255 /* JsxSpreadAttribute */; + return kind === 256 /* JsxAttribute */ + || kind === 258 /* JsxSpreadAttribute */; } ts.isJsxAttributeLike = isJsxAttributeLike; /* @internal */ function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 9 /* StringLiteral */ - || kind === 256 /* JsxExpression */; + || kind === 259 /* JsxExpression */; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isJsxOpeningLikeElement(node) { @@ -12560,26 +12616,26 @@ var ts; // Clauses function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 257 /* CaseClause */ - || kind === 258 /* DefaultClause */; + return kind === 260 /* CaseClause */ + || kind === 261 /* DefaultClause */; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; // JSDoc /** True if node is of some JSDoc syntax kind. */ /* @internal */ function isJSDocNode(node) { - return node.kind >= 267 /* FirstJSDocNode */ && node.kind <= 285 /* LastJSDocNode */; + return node.kind >= 270 /* FirstJSDocNode */ && node.kind <= 288 /* LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; /** True if node is of a kind that may contain comment text. */ function isJSDocCommentContainingNode(node) { - return node.kind === 275 /* JSDocComment */ || isJSDocTag(node); + return node.kind === 278 /* JSDocComment */ || isJSDocTag(node); } ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode; // TODO: determine what this does before making it public. /* @internal */ function isJSDocTag(node) { - return node.kind >= 276 /* FirstJSDocTagNode */ && node.kind <= 285 /* LastJSDocTagNode */; + return node.kind >= 279 /* FirstJSDocTagNode */ && node.kind <= 288 /* LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function isSetAccessor(node) { @@ -12616,7 +12672,7 @@ var ts; var IdentifierConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 265 /* SourceFile */) { + if (kind === 268 /* SourceFile */) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 71 /* Identifier */) { @@ -12673,19 +12729,19 @@ var ts; visitNode(cbNode, node.constraint) || visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: return visitNode(cbNode, node.expression); case 146 /* Parameter */: case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: case 226 /* VariableDeclaration */: case 176 /* BindingElement */: return visitNodes(cbNode, cbNodes, node.decorators) || @@ -12817,7 +12873,7 @@ var ts; case 207 /* Block */: case 234 /* ModuleBlock */: return visitNodes(cbNode, cbNodes, node.statements); - case 265 /* SourceFile */: + case 268 /* SourceFile */: return visitNodes(cbNode, cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); case 208 /* VariableStatement */: @@ -12865,10 +12921,10 @@ var ts; visitNode(cbNode, node.caseBlock); case 235 /* CaseBlock */: return visitNodes(cbNode, cbNodes, node.clauses); - case 257 /* CaseClause */: + case 260 /* CaseClause */: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.statements); - case 258 /* DefaultClause */: + case 261 /* DefaultClause */: return visitNodes(cbNode, cbNodes, node.statements); case 222 /* LabeledStatement */: return visitNode(cbNode, node.label) || @@ -12879,7 +12935,7 @@ var ts; return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 147 /* Decorator */: @@ -12910,7 +12966,7 @@ var ts; visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.members); - case 264 /* EnumMember */: + case 267 /* EnumMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 233 /* ModuleDeclaration */: @@ -12957,7 +13013,7 @@ var ts; return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 144 /* ComputedPropertyName */: return visitNode(cbNode, node.expression); - case 259 /* HeritageClause */: + case 262 /* HeritageClause */: return visitNodes(cbNode, cbNodes, node.types); case 201 /* ExpressionWithTypeArguments */: return visitNode(cbNode, node.expression) || @@ -12966,45 +13022,49 @@ var ts; return visitNode(cbNode, node.expression); case 247 /* MissingDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators); - case 289 /* CommaListExpression */: + case 292 /* CommaListExpression */: return visitNodes(cbNode, cbNodes, node.elements); case 249 /* JsxElement */: return visitNode(cbNode, node.openingElement) || visitNodes(cbNode, cbNodes, node.children) || visitNode(cbNode, node.closingElement); + case 253 /* JsxFragment */: + return visitNode(cbNode, node.openingFragment) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingFragment); case 250 /* JsxSelfClosingElement */: case 251 /* JsxOpeningElement */: return visitNode(cbNode, node.tagName) || visitNode(cbNode, node.attributes); - case 254 /* JsxAttributes */: + case 257 /* JsxAttributes */: return visitNodes(cbNode, cbNodes, node.properties); - case 253 /* JsxAttribute */: + case 256 /* JsxAttribute */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 255 /* JsxSpreadAttribute */: + case 258 /* JsxSpreadAttribute */: return visitNode(cbNode, node.expression); - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: return visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.expression); case 252 /* JsxClosingElement */: return visitNode(cbNode, node.tagName); - case 267 /* JSDocTypeExpression */: + case 270 /* JSDocTypeExpression */: return visitNode(cbNode, node.type); - case 271 /* JSDocNonNullableType */: + case 274 /* JSDocNonNullableType */: return visitNode(cbNode, node.type); - case 270 /* JSDocNullableType */: + case 273 /* JSDocNullableType */: return visitNode(cbNode, node.type); - case 272 /* JSDocOptionalType */: + case 275 /* JSDocOptionalType */: return visitNode(cbNode, node.type); - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: return visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 274 /* JSDocVariadicType */: + case 277 /* JSDocVariadicType */: return visitNode(cbNode, node.type); - case 275 /* JSDocComment */: + case 278 /* JSDocComment */: return visitNodes(cbNode, cbNodes, node.tags); - case 279 /* JSDocParameterTag */: - case 284 /* JSDocPropertyTag */: + case 282 /* JSDocParameterTag */: + case 287 /* JSDocPropertyTag */: if (node.isNameFirst) { return visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression); @@ -13013,17 +13073,17 @@ var ts; return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); } - case 280 /* JSDocReturnTag */: + case 283 /* JSDocReturnTag */: return visitNode(cbNode, node.typeExpression); - case 281 /* JSDocTypeTag */: + case 284 /* JSDocTypeTag */: return visitNode(cbNode, node.typeExpression); - case 277 /* JSDocAugmentsTag */: + case 280 /* JSDocAugmentsTag */: return visitNode(cbNode, node.class); - case 282 /* JSDocTemplateTag */: + case 285 /* JSDocTemplateTag */: return visitNodes(cbNode, cbNodes, node.typeParameters); - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: if (node.typeExpression && - node.typeExpression.kind === 267 /* JSDocTypeExpression */) { + node.typeExpression.kind === 270 /* JSDocTypeExpression */) { return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName); } @@ -13031,7 +13091,7 @@ var ts; return visitNode(cbNode, node.fullName) || visitNode(cbNode, node.typeExpression); } - case 285 /* JSDocTypeLiteral */: + case 288 /* JSDocTypeLiteral */: if (node.jsDocPropertyTags) { for (var _i = 0, _a = node.jsDocPropertyTags; _i < _a.length; _i++) { var tag = _a[_i]; @@ -13039,7 +13099,7 @@ var ts; } } return; - case 288 /* PartiallyEmittedExpression */: + case 291 /* PartiallyEmittedExpression */: return visitNode(cbNode, node.expression); } } @@ -13348,7 +13408,7 @@ var ts; function createSourceFile(fileName, languageVersion, scriptKind) { // code from createNode is inlined here so createNode won't have to deal with special case of creating source files // this is quite rare comparing to other nodes and createNode should be as fast as possible - var sourceFile = new SourceFileConstructor(265 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); + var sourceFile = new SourceFileConstructor(268 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -13885,6 +13945,10 @@ var ts; nextToken(); return ts.tokenIsIdentifierOrKeyword(token()); } + function nextTokenIsIdentifierOrKeywordOrGreaterThan() { + nextToken(); + return ts.tokenIsIdentifierOrKeywordOrGreaterThan(token()); + } function isHeritageClauseExtendsOrImplementsKeyword() { if (token() === 108 /* ImplementsKeyword */ || token() === 85 /* ExtendsKeyword */) { @@ -14145,8 +14209,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 257 /* CaseClause */: - case 258 /* DefaultClause */: + case 260 /* CaseClause */: + case 261 /* DefaultClause */: return true; } } @@ -14190,7 +14254,7 @@ var ts; return false; } function isReusableEnumMember(node) { - return node.kind === 264 /* EnumMember */; + return node.kind === 267 /* EnumMember */; } function isReusableTypeMember(node) { if (node) { @@ -14476,7 +14540,7 @@ var ts; return finishNode(node); } function parseJSDocAllType() { - var result = createNode(268 /* JSDocAllType */); + var result = createNode(271 /* JSDocAllType */); nextToken(); return finishNode(result); } @@ -14499,18 +14563,18 @@ var ts; token() === 29 /* GreaterThanToken */ || token() === 58 /* EqualsToken */ || token() === 49 /* BarToken */) { - var result = createNode(269 /* JSDocUnknownType */, pos); + var result = createNode(272 /* JSDocUnknownType */, pos); return finishNode(result); } else { - var result = createNode(270 /* JSDocNullableType */, pos); + var result = createNode(273 /* JSDocNullableType */, pos); result.type = parseType(); return finishNode(result); } } function parseJSDocFunctionType() { if (lookAhead(nextTokenIsOpenParen)) { - var result = createNode(273 /* JSDocFunctionType */); + var result = createNode(276 /* JSDocFunctionType */); nextToken(); fillSignature(56 /* ColonToken */, 4 /* Type */ | 32 /* JSDoc */, result); return addJSDocComment(finishNode(result)); @@ -14945,9 +15009,9 @@ var ts; case 89 /* FunctionKeyword */: return parseJSDocFunctionType(); case 24 /* DotDotDotToken */: - return parseJSDocNodeWithType(274 /* JSDocVariadicType */); + return parseJSDocNodeWithType(277 /* JSDocVariadicType */); case 51 /* ExclamationToken */: - return parseJSDocNodeWithType(271 /* JSDocNonNullableType */); + return parseJSDocNodeWithType(274 /* JSDocNonNullableType */); case 13 /* NoSubstitutionTemplateLiteral */: case 9 /* StringLiteral */: case 8 /* NumericLiteral */: @@ -15032,13 +15096,13 @@ var ts; if (!(contextFlags & 1048576 /* JSDoc */)) { return type; } - type = createJSDocPostfixType(272 /* JSDocOptionalType */, type); + type = createJSDocPostfixType(275 /* JSDocOptionalType */, type); break; case 51 /* ExclamationToken */: - type = createJSDocPostfixType(271 /* JSDocNonNullableType */, type); + type = createJSDocPostfixType(274 /* JSDocNonNullableType */, type); break; case 55 /* QuestionToken */: - type = createJSDocPostfixType(270 /* JSDocNullableType */, type); + type = createJSDocPostfixType(273 /* JSDocNullableType */, type); break; case 21 /* OpenBracketToken */: parseExpected(21 /* OpenBracketToken */); @@ -15983,9 +16047,9 @@ var ts; node.operand = parseLeftHandSideExpressionOrHigher(); return finishNode(node); } - else if (sourceFile.languageVariant === 1 /* JSX */ && token() === 27 /* LessThanToken */ && lookAhead(nextTokenIsIdentifierOrKeyword)) { + else if (sourceFile.languageVariant === 1 /* JSX */ && token() === 27 /* LessThanToken */ && lookAhead(nextTokenIsIdentifierOrKeywordOrGreaterThan)) { // JSXElement is part of primaryExpression - return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true); + return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ true); } var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); @@ -16126,19 +16190,26 @@ var ts; return lhs.name.escapedText === rhs.name.escapedText && tagNamesAreEquivalent(lhs.expression, rhs.expression); } - function parseJsxElementOrSelfClosingElement(inExpressionContext) { - var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); + function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext) { + var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); var result; if (opening.kind === 251 /* JsxOpeningElement */) { var node = createNode(249 /* JsxElement */, opening.pos); node.openingElement = opening; - node.children = parseJsxChildren(node.openingElement.tagName); + node.children = parseJsxChildren(node.openingElement); node.closingElement = parseJsxClosingElement(inExpressionContext); if (!tagNamesAreEquivalent(node.openingElement.tagName, node.closingElement.tagName)) { parseErrorAtPosition(node.closingElement.pos, node.closingElement.end - node.closingElement.pos, ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNodeFromSourceText(sourceText, node.openingElement.tagName)); } result = finishNode(node); } + else if (opening.kind === 254 /* JsxOpeningFragment */) { + var node = createNode(253 /* JsxFragment */, opening.pos); + node.openingFragment = opening; + node.children = parseJsxChildren(node.openingFragment); + node.closingFragment = parseJsxClosingFragment(inExpressionContext); + result = finishNode(node); + } else { ts.Debug.assert(opening.kind === 250 /* JsxSelfClosingElement */); // Nothing else to do for self-closing elements @@ -16152,7 +16223,7 @@ var ts; // Since JSX elements are invalid < operands anyway, this lookahead parse will only occur in error scenarios // of one sort or another. if (inExpressionContext && token() === 27 /* LessThanToken */) { - var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true); }); + var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); var badNode = createNode(194 /* BinaryExpression */, result.pos); @@ -16180,11 +16251,11 @@ var ts; case 17 /* OpenBraceToken */: return parseJsxExpression(/*inExpressionContext*/ false); case 27 /* LessThanToken */: - return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ false); + return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ false); } ts.Debug.fail("Unknown JSX child kind " + token()); } - function parseJsxChildren(openingTagName) { + function parseJsxChildren(openingTag) { var list = []; var listPos = getNodePos(); var saveParsingContext = parsingContext; @@ -16198,7 +16269,13 @@ var ts; else if (token() === 1 /* EndOfFileToken */) { // If we hit EOF, issue the error at the tag that lacks the closing element // rather than at the end of the file (which is useless) - parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTagName)); + if (ts.isJsxOpeningFragment(openingTag)) { + parseErrorAtPosition(openingTag.pos, openingTag.end - openingTag.pos, ts.Diagnostics.JSX_fragment_has_no_corresponding_closing_tag); + } + else { + var openingTagName = openingTag.tagName; + parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTagName)); + } break; } else if (token() === 7 /* ConflictMarkerTrivia */) { @@ -16213,13 +16290,18 @@ var ts; return createNodeArray(list, listPos); } function parseJsxAttributes() { - var jsxAttributes = createNode(254 /* JsxAttributes */); + var jsxAttributes = createNode(257 /* JsxAttributes */); jsxAttributes.properties = parseList(13 /* JsxAttributes */, parseJsxAttribute); return finishNode(jsxAttributes); } - function parseJsxOpeningOrSelfClosingElement(inExpressionContext) { + function parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext) { var fullStart = scanner.getStartPos(); parseExpected(27 /* LessThanToken */); + if (token() === 29 /* GreaterThanToken */) { + parseExpected(29 /* GreaterThanToken */); + var node_1 = createNode(254 /* JsxOpeningFragment */, fullStart); + return finishNode(node_1); + } var tagName = parseJsxElementName(); var attributes = parseJsxAttributes(); var node; @@ -16263,7 +16345,7 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(256 /* JsxExpression */); + var node = createNode(259 /* JsxExpression */); parseExpected(17 /* OpenBraceToken */); if (token() !== 18 /* CloseBraceToken */) { node.dotDotDotToken = parseOptionalToken(24 /* DotDotDotToken */); @@ -16283,7 +16365,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(253 /* JsxAttribute */); + var node = createNode(256 /* JsxAttribute */); node.name = parseIdentifierName(); if (token() === 58 /* EqualsToken */) { switch (scanJsxAttributeValue()) { @@ -16298,7 +16380,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(255 /* JsxSpreadAttribute */); + var node = createNode(258 /* JsxSpreadAttribute */); parseExpected(17 /* OpenBraceToken */); parseExpected(24 /* DotDotDotToken */); node.expression = parseExpression(); @@ -16318,6 +16400,22 @@ var ts; } return finishNode(node); } + function parseJsxClosingFragment(inExpressionContext) { + var node = createNode(255 /* JsxClosingFragment */); + parseExpected(28 /* LessThanSlashToken */); + if (ts.tokenIsIdentifierOrKeyword(token())) { + var unexpectedTagName = parseJsxElementName(); + parseErrorAtPosition(unexpectedTagName.pos, unexpectedTagName.end - unexpectedTagName.pos, ts.Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment); + } + if (inExpressionContext) { + parseExpected(29 /* GreaterThanToken */); + } + else { + parseExpected(29 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false); + scanJsxText(); + } + return finishNode(node); + } function parseTypeAssertion() { var node = createNode(184 /* TypeAssertionExpression */); parseExpected(27 /* LessThanToken */); @@ -16545,7 +16643,7 @@ var ts; var fullStart = scanner.getStartPos(); var dotDotDotToken = parseOptionalToken(24 /* DotDotDotToken */); if (dotDotDotToken) { - var spreadElement = createNode(263 /* SpreadAssignment */, fullStart); + var spreadElement = createNode(266 /* SpreadAssignment */, fullStart); spreadElement.expression = parseAssignmentExpressionOrHigher(); return addJSDocComment(finishNode(spreadElement)); } @@ -16570,7 +16668,7 @@ var ts; // this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 26 /* CommaToken */ || token() === 18 /* CloseBraceToken */ || token() === 58 /* EqualsToken */); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(262 /* ShorthandPropertyAssignment */, fullStart); + var shorthandDeclaration = createNode(265 /* ShorthandPropertyAssignment */, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(58 /* EqualsToken */); @@ -16581,7 +16679,7 @@ var ts; return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(261 /* PropertyAssignment */, fullStart); + var propertyAssignment = createNode(264 /* PropertyAssignment */, fullStart); propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; @@ -16635,10 +16733,10 @@ var ts; var fullStart = scanner.getStartPos(); parseExpected(94 /* NewKeyword */); if (parseOptional(23 /* DotToken */)) { - var node_1 = createNode(204 /* MetaProperty */, fullStart); - node_1.keywordToken = 94 /* NewKeyword */; - node_1.name = parseIdentifierName(); - return finishNode(node_1); + var node_2 = createNode(204 /* MetaProperty */, fullStart); + node_2.keywordToken = 94 /* NewKeyword */; + node_2.name = parseIdentifierName(); + return finishNode(node_2); } var node = createNode(182 /* NewExpression */, fullStart); node.expression = parseMemberExpressionOrHigher(); @@ -16796,7 +16894,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(257 /* CaseClause */); + var node = createNode(260 /* CaseClause */); parseExpected(73 /* CaseKeyword */); node.expression = allowInAnd(parseExpression); parseExpected(56 /* ColonToken */); @@ -16804,7 +16902,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(258 /* DefaultClause */); + var node = createNode(261 /* DefaultClause */); parseExpected(79 /* DefaultKeyword */); parseExpected(56 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); @@ -16855,7 +16953,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(260 /* CatchClause */); + var result = createNode(263 /* CatchClause */); parseExpected(74 /* CatchKeyword */); if (parseOptional(19 /* OpenParenToken */)) { result.variableDeclaration = parseVariableDeclaration(); @@ -17580,7 +17678,7 @@ var ts; function parseHeritageClause() { var tok = token(); if (tok === 85 /* ExtendsKeyword */ || tok === 108 /* ImplementsKeyword */) { - var node = createNode(259 /* HeritageClause */); + var node = createNode(262 /* HeritageClause */); node.token = tok; nextToken(); node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments); @@ -17633,7 +17731,7 @@ var ts; // ConstantEnumMemberSection, which starts at the beginning of an enum declaration // or any time an integer literal initializer is encountered. function parseEnumMember() { - var node = createNode(264 /* EnumMember */, scanner.getStartPos()); + var node = createNode(267 /* EnumMember */, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return addJSDocComment(finishNode(node)); @@ -18050,7 +18148,7 @@ var ts; } JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; function parseJSDocTypeExpression(requireBraces) { - var result = createNode(267 /* JSDocTypeExpression */, scanner.getTokenPos()); + var result = createNode(270 /* JSDocTypeExpression */, scanner.getTokenPos()); if (!parseExpected(17 /* OpenBraceToken */) && requireBraces) { return undefined; } @@ -18234,7 +18332,7 @@ var ts; content.charCodeAt(start + 3) !== 42 /* asterisk */; } function createJSDocComment() { - var result = createNode(275 /* JSDocComment */, start); + var result = createNode(278 /* JSDocComment */, start); result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd); result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -18358,7 +18456,7 @@ var ts; return comments; } function parseUnknownTag(atToken, tagName) { - var result = createNode(276 /* JSDocTag */, atToken.pos); + var result = createNode(279 /* JSDocTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -18412,8 +18510,8 @@ var ts; typeExpression = tryParseTypeExpression(); } var result = target === 1 /* Parameter */ ? - createNode(279 /* JSDocParameterTag */, atToken.pos) : - createNode(284 /* JSDocPropertyTag */, atToken.pos); + createNode(282 /* JSDocParameterTag */, atToken.pos) : + createNode(287 /* JSDocPropertyTag */, atToken.pos); var nestedTypeLiteral = parseNestedTypeLiteral(typeExpression, name); if (nestedTypeLiteral) { typeExpression = nestedTypeLiteral; @@ -18429,7 +18527,7 @@ var ts; } function parseNestedTypeLiteral(typeExpression, name) { if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) { - var typeLiteralExpression = createNode(267 /* JSDocTypeExpression */, scanner.getTokenPos()); + var typeLiteralExpression = createNode(270 /* JSDocTypeExpression */, scanner.getTokenPos()); var child = void 0; var jsdocTypeLiteral = void 0; var start_2 = scanner.getStartPos(); @@ -18441,7 +18539,7 @@ var ts; children.push(child); } if (children) { - jsdocTypeLiteral = createNode(285 /* JSDocTypeLiteral */, start_2); + jsdocTypeLiteral = createNode(288 /* JSDocTypeLiteral */, start_2); jsdocTypeLiteral.jsDocPropertyTags = children; if (typeExpression.type.kind === 164 /* ArrayType */) { jsdocTypeLiteral.isArrayType = true; @@ -18452,27 +18550,27 @@ var ts; } } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 280 /* JSDocReturnTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 283 /* JSDocReturnTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } - var result = createNode(280 /* JSDocReturnTag */, atToken.pos); + var result = createNode(283 /* JSDocReturnTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 281 /* JSDocTypeTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 284 /* JSDocTypeTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } - var result = createNode(281 /* JSDocTypeTag */, atToken.pos); + var result = createNode(284 /* JSDocTypeTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = parseJSDocTypeExpression(/*requireBraces*/ true); return finishNode(result); } function parseAugmentsTag(atToken, tagName) { - var result = createNode(277 /* JSDocAugmentsTag */, atToken.pos); + var result = createNode(280 /* JSDocAugmentsTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.class = parseExpressionWithTypeArgumentsForAugments(); @@ -18500,7 +18598,7 @@ var ts; return node; } function parseClassTag(atToken, tagName) { - var tag = createNode(278 /* JSDocClassTag */, atToken.pos); + var tag = createNode(281 /* JSDocClassTag */, atToken.pos); tag.atToken = atToken; tag.tagName = tagName; return finishNode(tag); @@ -18508,7 +18606,7 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(283 /* JSDocTypedefTag */, atToken.pos); + var typedefTag = createNode(286 /* JSDocTypedefTag */, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(/*flags*/ 0); @@ -18533,9 +18631,9 @@ var ts; var start_3 = scanner.getStartPos(); while (child = tryParse(function () { return parseChildParameterOrPropertyTag(0 /* Property */); })) { if (!jsdocTypeLiteral) { - jsdocTypeLiteral = createNode(285 /* JSDocTypeLiteral */, start_3); + jsdocTypeLiteral = createNode(288 /* JSDocTypeLiteral */, start_3); } - if (child.kind === 281 /* JSDocTypeTag */) { + if (child.kind === 284 /* JSDocTypeTag */) { if (childTypeTag) { break; } @@ -18597,7 +18695,7 @@ var ts; case 57 /* AtToken */: if (canParseTag) { var child = tryParseChildTag(target); - if (child && child.kind === 279 /* JSDocParameterTag */ && + if (child && child.kind === 282 /* JSDocParameterTag */ && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; } @@ -18647,7 +18745,7 @@ var ts; return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 282 /* JSDocTemplateTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 285 /* JSDocTemplateTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } // Type parameter list looks like '@template T,U,V' @@ -18672,7 +18770,7 @@ var ts; break; } } - var result = createNode(282 /* JSDocTemplateTag */, atToken.pos); + var result = createNode(285 /* JSDocTemplateTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = createNodeArray(typeParameters, typeParametersPos); @@ -19442,16 +19540,16 @@ var ts; case 228 /* FunctionDeclaration */: case 229 /* ClassDeclaration */: return (ts.hasModifier(node, 512 /* Default */) ? "default" /* Default */ : undefined); - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: return (ts.isJSDocConstructSignature(node) ? "__new" /* New */ : "__call" /* Call */); case 146 /* Parameter */: // Parameters with names are handled at the top of this function. Parameters // without names can only come from JSDocFunctionTypes. - ts.Debug.assert(node.parent.kind === 273 /* JSDocFunctionType */); + ts.Debug.assert(node.parent.kind === 276 /* JSDocFunctionType */); var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "arg" + index; - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: var name_2 = ts.getNameOfJSDocTypedef(node); return typeof name_2 !== "undefined" ? name_2.escapedText : undefined; } @@ -19583,9 +19681,9 @@ var ts; // during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation // and this case is specially handled. Module augmentations should only be merged with original module definition // and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed. - if (node.kind === 283 /* JSDocTypedefTag */) + if (node.kind === 286 /* JSDocTypedefTag */) ts.Debug.assert(ts.isInJavaScriptFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file. - var isJSDocTypedefInJSDocNamespace = node.kind === 283 /* JSDocTypedefTag */ && + var isJSDocTypedefInJSDocNamespace = node.kind === 286 /* JSDocTypedefTag */ && node.name && node.name.kind === 71 /* Identifier */ && node.name.isInJSDocNamespace; @@ -19670,7 +19768,7 @@ var ts; if (hasExplicitReturn) node.flags |= 256 /* HasExplicitReturn */; } - if (node.kind === 265 /* SourceFile */) { + if (node.kind === 268 /* SourceFile */) { node.flags |= emitFlags; } if (isIIFE) { @@ -19793,7 +19891,7 @@ var ts; case 235 /* CaseBlock */: bindCaseBlock(node); break; - case 257 /* CaseClause */: + case 260 /* CaseClause */: bindCaseClause(node); break; case 222 /* LabeledStatement */: @@ -19820,10 +19918,10 @@ var ts; case 181 /* CallExpression */: bindCallExpressionFlow(node); break; - case 275 /* JSDocComment */: + case 278 /* JSDocComment */: bindJSDocComment(node); break; - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: bindJSDocTypedefTag(node); break; default: @@ -20217,7 +20315,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 258 /* DefaultClause */; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 261 /* DefaultClause */; }); // We mark a switch statement as possibly exhaustive if it has no default clause and if all // case clauses have unreachable end points (e.g. they all return). node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; @@ -20316,13 +20414,13 @@ var ts; else if (node.kind === 178 /* ObjectLiteralExpression */) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 261 /* PropertyAssignment */) { + if (p.kind === 264 /* PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 262 /* ShorthandPropertyAssignment */) { + else if (p.kind === 265 /* ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 263 /* SpreadAssignment */) { + else if (p.kind === 266 /* SpreadAssignment */) { bindAssignmentTargetFlow(p.expression); } } @@ -20428,7 +20526,7 @@ var ts; } function bindJSDocComment(node) { ts.forEachChild(node, function (n) { - if (n.kind !== 283 /* JSDocTypedefTag */) { + if (n.kind !== 286 /* JSDocTypedefTag */) { bind(n); } }); @@ -20474,8 +20572,8 @@ var ts; case 232 /* EnumDeclaration */: case 178 /* ObjectLiteralExpression */: case 163 /* TypeLiteral */: - case 285 /* JSDocTypeLiteral */: - case 254 /* JsxAttributes */: + case 288 /* JSDocTypeLiteral */: + case 257 /* JsxAttributes */: return 1 /* IsContainer */; case 230 /* InterfaceDeclaration */: return 1 /* IsContainer */ | 64 /* IsInterface */; @@ -20483,7 +20581,7 @@ var ts; case 231 /* TypeAliasDeclaration */: case 172 /* MappedType */: return 1 /* IsContainer */ | 32 /* HasLocals */; - case 265 /* SourceFile */: + case 268 /* SourceFile */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */; case 151 /* MethodDeclaration */: if (ts.isObjectLiteralOrClassExpressionMethod(node)) { @@ -20496,7 +20594,7 @@ var ts; case 153 /* GetAccessor */: case 154 /* SetAccessor */: case 155 /* CallSignature */: - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: case 160 /* FunctionType */: case 156 /* ConstructSignature */: case 157 /* IndexSignature */: @@ -20509,7 +20607,7 @@ var ts; return 4 /* IsControlFlowContainer */; case 149 /* PropertyDeclaration */: return node.initializer ? 4 /* IsControlFlowContainer */ : 0; - case 260 /* CatchClause */: + case 263 /* CatchClause */: case 214 /* ForStatement */: case 215 /* ForInStatement */: case 216 /* ForOfStatement */: @@ -20550,7 +20648,7 @@ var ts; // handlers to take care of declaring these child members. case 233 /* ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 265 /* SourceFile */: + case 268 /* SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); case 199 /* ClassExpression */: case 229 /* ClassDeclaration */: @@ -20558,10 +20656,10 @@ var ts; case 232 /* EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); case 163 /* TypeLiteral */: - case 285 /* JSDocTypeLiteral */: + case 288 /* JSDocTypeLiteral */: case 178 /* ObjectLiteralExpression */: case 230 /* InterfaceDeclaration */: - case 254 /* JsxAttributes */: + case 257 /* JsxAttributes */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the @@ -20581,7 +20679,7 @@ var ts; case 228 /* FunctionDeclaration */: case 186 /* FunctionExpression */: case 187 /* ArrowFunction */: - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: case 231 /* TypeAliasDeclaration */: case 172 /* MappedType */: // All the children of these container types are never visible through another @@ -20604,8 +20702,8 @@ var ts; : declareSymbol(file.locals, /*parent*/ undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 265 /* SourceFile */ ? node : node.body; - if (body && (body.kind === 265 /* SourceFile */ || body.kind === 234 /* ModuleBlock */)) { + var body = node.kind === 268 /* SourceFile */ ? node : node.body; + if (body && (body.kind === 268 /* SourceFile */ || body.kind === 234 /* ModuleBlock */)) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; if (stat.kind === 244 /* ExportDeclaration */ || stat.kind === 243 /* ExportAssignment */) { @@ -20703,7 +20801,7 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 263 /* SpreadAssignment */ || prop.name.kind !== 71 /* Identifier */) { + if (prop.kind === 266 /* SpreadAssignment */ || prop.name.kind !== 71 /* Identifier */) { continue; } var identifier = prop.name; @@ -20715,7 +20813,7 @@ var ts; // c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true. // 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 === 261 /* PropertyAssignment */ || prop.kind === 262 /* ShorthandPropertyAssignment */ || prop.kind === 151 /* MethodDeclaration */ + var currentKind = prop.kind === 264 /* PropertyAssignment */ || prop.kind === 265 /* ShorthandPropertyAssignment */ || prop.kind === 151 /* MethodDeclaration */ ? 1 /* Property */ : 2 /* Accessor */; var existingKind = seen.get(identifier.escapedText); @@ -20749,7 +20847,7 @@ var ts; case 233 /* ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 265 /* SourceFile */: + case 268 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -20859,7 +20957,7 @@ var ts; function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 /* ES2015 */) { // Report error if function is not top level function declaration - if (blockScopeContainer.kind !== 265 /* SourceFile */ && + if (blockScopeContainer.kind !== 268 /* SourceFile */ && blockScopeContainer.kind !== 233 /* ModuleDeclaration */ && !ts.isFunctionLike(blockScopeContainer)) { // We check first if the name is inside class declaration or class expression; if so give explicit message @@ -20962,7 +21060,7 @@ var ts; } for (var _b = 0, _c = jsDoc.tags; _b < _c.length; _b++) { var tag = _c[_b]; - if (tag.kind === 283 /* JSDocTypedefTag */) { + if (tag.kind === 286 /* JSDocTypedefTag */) { var savedParent = parent; parent = jsDoc; bind(tag); @@ -21001,7 +21099,7 @@ var ts; // current "blockScopeContainer" needs to be set to its immediate namespace parent. if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 283 /* JSDocTypedefTag */) { + while (parentNode && parentNode.kind !== 286 /* JSDocTypedefTag */) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); @@ -21009,7 +21107,7 @@ var ts; } // falls through case 99 /* ThisKeyword */: - if (currentFlow && (ts.isExpression(node) || parent.kind === 262 /* ShorthandPropertyAssignment */)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 265 /* ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); @@ -21043,7 +21141,7 @@ var ts; ts.Debug.fail("Unknown special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return checkStrictModeCatchClause(node); case 188 /* DeleteExpression */: return checkStrictModeDeleteExpression(node); @@ -21072,10 +21170,10 @@ var ts; case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: return bindPropertyWorker(node); - case 261 /* PropertyAssignment */: - case 262 /* ShorthandPropertyAssignment */: + case 264 /* PropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */); - case 264 /* EnumMember */: + case 267 /* EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 900095 /* EnumMemberExcludes */); case 155 /* CallSignature */: case 156 /* ConstructSignature */: @@ -21097,11 +21195,11 @@ var ts; case 154 /* SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */); case 160 /* FunctionType */: - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: case 161 /* ConstructorType */: return bindFunctionOrConstructorType(node); case 163 /* TypeLiteral */: - case 285 /* JSDocTypeLiteral */: + case 288 /* JSDocTypeLiteral */: case 172 /* MappedType */: return bindAnonymousTypeWorker(node); case 178 /* ObjectLiteralExpression */: @@ -21129,9 +21227,9 @@ var ts; case 233 /* ModuleDeclaration */: return bindModuleDeclaration(node); // Jsx-attributes - case 254 /* JsxAttributes */: + case 257 /* JsxAttributes */: return bindJsxAttributes(node); - case 253 /* JsxAttribute */: + case 256 /* JsxAttribute */: return bindJsxAttribute(node, 4 /* Property */, 0 /* PropertyExcludes */); // Imports and exports case 237 /* ImportEqualsDeclaration */: @@ -21147,7 +21245,7 @@ var ts; return bindExportDeclaration(node); case 243 /* ExportAssignment */: return bindExportAssignment(node); - case 265 /* SourceFile */: + case 268 /* SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); case 207 /* Block */: @@ -21157,18 +21255,18 @@ var ts; // falls through case 234 /* ModuleBlock */: return updateStrictModeStatementList(node.statements); - case 279 /* JSDocParameterTag */: - if (node.parent.kind !== 285 /* JSDocTypeLiteral */) { + case 282 /* JSDocParameterTag */: + if (node.parent.kind !== 288 /* JSDocTypeLiteral */) { break; } // falls through - case 284 /* JSDocPropertyTag */: + case 287 /* JSDocPropertyTag */: var propTag = node; - var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 272 /* JSDocOptionalType */ ? + var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 275 /* JSDocOptionalType */ ? 4 /* Property */ | 16777216 /* Optional */ : 4 /* Property */; return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* PropertyExcludes */); - case 283 /* JSDocTypedefTag */: { + case 286 /* JSDocTypedefTag */: { var fullName = node.fullName; if (!fullName || fullName.kind === 71 /* Identifier */) { return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); @@ -21223,7 +21321,7 @@ var ts; if (node.modifiers && node.modifiers.length) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); } - if (node.parent.kind !== 265 /* SourceFile */) { + if (node.parent.kind !== 268 /* SourceFile */) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); return; } @@ -21587,9 +21685,9 @@ var ts; return computeClassDeclaration(node, subtreeFlags); case 199 /* ClassExpression */: return computeClassExpression(node, subtreeFlags); - case 259 /* HeritageClause */: + case 262 /* HeritageClause */: return computeHeritageClause(node, subtreeFlags); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return computeCatchClause(node, subtreeFlags); case 201 /* ExpressionWithTypeArguments */: return computeExpressionWithTypeArguments(node, subtreeFlags); @@ -22093,7 +22191,7 @@ var ts; case 124 /* DeclareKeyword */: case 76 /* ConstKeyword */: case 232 /* EnumDeclaration */: - case 264 /* EnumMember */: + case 267 /* EnumMember */: case 184 /* TypeAssertionExpression */: case 202 /* AsExpression */: case 203 /* NonNullExpression */: @@ -22106,10 +22204,13 @@ var ts; case 251 /* JsxOpeningElement */: case 10 /* JsxText */: case 252 /* JsxClosingElement */: - case 253 /* JsxAttribute */: - case 254 /* JsxAttributes */: - case 255 /* JsxSpreadAttribute */: - case 256 /* JsxExpression */: + case 253 /* JsxFragment */: + case 254 /* JsxOpeningFragment */: + case 255 /* JsxClosingFragment */: + case 256 /* JsxAttribute */: + case 257 /* JsxAttributes */: + case 258 /* JsxSpreadAttribute */: + case 259 /* JsxExpression */: // These nodes are Jsx syntax. transformFlags |= 4 /* AssertJsx */; break; @@ -22119,7 +22220,7 @@ var ts; case 16 /* TemplateTail */: case 196 /* TemplateExpression */: case 183 /* TaggedTemplateExpression */: - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: case 115 /* StaticKeyword */: case 204 /* MetaProperty */: // These nodes are ES6 syntax. @@ -22204,7 +22305,7 @@ var ts; case 198 /* SpreadElement */: transformFlags |= 192 /* AssertES2015 */ | 524288 /* ContainsSpread */; break; - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectSpread */; break; case 97 /* SuperKeyword */: @@ -22272,7 +22373,7 @@ var ts; transformFlags |= 192 /* AssertES2015 */; } break; - case 265 /* SourceFile */: + case 268 /* SourceFile */: if (subtreeFlags & 32768 /* ContainsCapturedLexicalThis */) { transformFlags |= 192 /* AssertES2015 */; } @@ -22342,7 +22443,7 @@ var ts; return -3 /* TypeExcludes */; case 178 /* ObjectLiteralExpression */: return 540087617 /* ObjectLiteralExcludes */; - case 260 /* CatchClause */: + case 263 /* CatchClause */: return 537920833 /* CatchClauseExcludes */; case 174 /* ObjectBindingPattern */: case 175 /* ArrayBindingPattern */: @@ -24235,7 +24336,7 @@ var ts; return type.flags & 32768 /* Object */ ? type.objectFlags : 0; } function isGlobalSourceFile(node) { - return node.kind === 265 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 268 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -24401,7 +24502,7 @@ var ts; // - parameters are only in the scope of function body // This restriction does not apply to JSDoc comment types because they are parented // at a higher level than type parameters would normally be - if (meaning & result.flags & 793064 /* Type */ && lastLocation.kind !== 275 /* JSDocComment */) { + if (meaning & result.flags & 793064 /* Type */ && lastLocation.kind !== 278 /* JSDocComment */) { useResult = result.flags & 262144 /* TypeParameter */ // type parameters are visible in parameter list, return type and type parameter list ? lastLocation === location.type || @@ -24430,14 +24531,14 @@ var ts; } } switch (location.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; // falls through case 233 /* ModuleDeclaration */: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 265 /* SourceFile */ || ts.isAmbientModule(location)) { + if (location.kind === 268 /* SourceFile */ || ts.isAmbientModule(location)) { // It's an external module. First see if the module has an export default and if the local // name of that export default matches. if (result = moduleExports.get("default")) { @@ -24610,7 +24711,7 @@ var ts; } if (!result) { if (lastLocation) { - ts.Debug.assert(lastLocation.kind === 265 /* SourceFile */); + ts.Debug.assert(lastLocation.kind === 268 /* SourceFile */); if (lastLocation.commonJsModuleIndicator && name === "exports") { return lastLocation.symbol; } @@ -25435,7 +25536,7 @@ var ts; } } switch (location.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } @@ -25626,7 +25727,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 265 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 268 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -25932,7 +26033,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || // is exported function symbol ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 265 /* SourceFile */ || declaration.parent.kind === 234 /* ModuleBlock */; + return declaration.parent.kind === 268 /* SourceFile */ || declaration.parent.kind === 234 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -26699,7 +26800,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || // is exported function symbol ts.some(symbol.declarations, function (declaration) { - return declaration.parent.kind === 265 /* SourceFile */ || declaration.parent.kind === 234 /* ModuleBlock */; + return declaration.parent.kind === 268 /* SourceFile */ || declaration.parent.kind === 234 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -27109,7 +27210,7 @@ var ts; var parent = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedModifierFlags(node) & 1 /* Export */) && - !(node.kind !== 237 /* ImportEqualsDeclaration */ && parent.kind !== 265 /* SourceFile */ && ts.isInAmbientContext(parent))) { + !(node.kind !== 237 /* ImportEqualsDeclaration */ && parent.kind !== 268 /* SourceFile */ && ts.isInAmbientContext(parent))) { return isGlobalSourceFile(parent); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible @@ -27151,7 +27252,7 @@ var ts; // Type parameters are always visible case 145 /* TypeParameter */: // Source file and namespace export are always visible - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 236 /* NamespaceExportDeclaration */: return true; // Export assignments do not create name bindings outside the module @@ -27504,7 +27605,7 @@ var ts; return trueType; } // If it is a short-hand property assignment, use the type of the identifier - if (declaration.kind === 262 /* ShorthandPropertyAssignment */) { + if (declaration.kind === 265 /* ShorthandPropertyAssignment */) { return checkIdentifier(declaration.name); } // If the declaration specifies a binding pattern, use the type implied by the binding pattern @@ -27648,7 +27749,7 @@ var ts; // During a normal type check we'll never get to here with a property assignment (the check of the containing // object literal uses a different path). We exclude widening only so that language services and type verification // tools see the actual type. - if (declaration.kind === 261 /* PropertyAssignment */) { + if (declaration.kind === 264 /* PropertyAssignment */) { return type; } return getWidenedType(type); @@ -27935,13 +28036,13 @@ var ts; case 150 /* MethodSignature */: case 160 /* FunctionType */: case 161 /* ConstructorType */: - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: case 228 /* FunctionDeclaration */: case 151 /* MethodDeclaration */: case 186 /* FunctionExpression */: case 187 /* ArrowFunction */: case 231 /* TypeAliasDeclaration */: - case 282 /* JSDocTemplateTag */: + case 285 /* JSDocTemplateTag */: case 172 /* MappedType */: var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); if (node.kind === 172 /* MappedType */) { @@ -28237,9 +28338,9 @@ var ts; return unknownType; } var declaration = ts.find(symbol.declarations, function (d) { - return d.kind === 283 /* JSDocTypedefTag */ || d.kind === 231 /* TypeAliasDeclaration */; + return d.kind === 286 /* JSDocTypedefTag */ || d.kind === 231 /* TypeAliasDeclaration */; }); - var typeNode = declaration.kind === 283 /* JSDocTypedefTag */ ? declaration.typeExpression : declaration.type; + var typeNode = declaration.kind === 286 /* JSDocTypedefTag */ ? declaration.typeExpression : declaration.type; // If typeNode is missing, we will error in checkJSDocTypedefTag. var type = typeNode ? getTypeFromTypeNode(typeNode) : unknownType; if (popTypeResolution()) { @@ -29346,7 +29447,7 @@ var ts; } function isJSDocOptionalParameter(node) { if (ts.isInJavaScriptFile(node)) { - if (node.type && node.type.kind === 272 /* JSDocOptionalType */) { + if (node.type && node.type.kind === 275 /* JSDocOptionalType */) { return true; } var paramTags = ts.getJSDocParameterTags(node); @@ -29357,7 +29458,7 @@ var ts; return true; } if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 272 /* JSDocOptionalType */; + return paramTag.typeExpression.type.kind === 275 /* JSDocOptionalType */; } } } @@ -29594,7 +29695,7 @@ var ts; case 154 /* SetAccessor */: case 186 /* FunctionExpression */: case 187 /* ArrowFunction */: - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: // Don't include signature if node is the implementation of an overloaded function. A node is considered // an implementation node if it has a body and the previous node is of the same kind and immediately // precedes the implementation node (i.e. has the same parent and ends where the implementation starts). @@ -30916,8 +31017,8 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 119 /* AnyKeyword */: - case 268 /* JSDocAllType */: - case 269 /* JSDocUnknownType */: + case 271 /* JSDocAllType */: + case 272 /* JSDocUnknownType */: return anyType; case 136 /* StringKeyword */: return stringType; @@ -30958,18 +31059,18 @@ var ts; return getTypeFromUnionTypeNode(node); case 167 /* IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 270 /* JSDocNullableType */: + case 273 /* JSDocNullableType */: return getTypeFromJSDocNullableTypeNode(node); case 168 /* ParenthesizedType */: - case 271 /* JSDocNonNullableType */: - case 272 /* JSDocOptionalType */: - case 267 /* JSDocTypeExpression */: + case 274 /* JSDocNonNullableType */: + case 275 /* JSDocOptionalType */: + case 270 /* JSDocTypeExpression */: return getTypeFromTypeNode(node.type); case 160 /* FunctionType */: case 161 /* ConstructorType */: case 163 /* TypeLiteral */: - case 285 /* JSDocTypeLiteral */: - case 273 /* JSDocFunctionType */: + case 288 /* JSDocTypeLiteral */: + case 276 /* JSDocFunctionType */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 170 /* TypeOperator */: return getTypeFromTypeOperatorNode(node); @@ -30983,7 +31084,7 @@ var ts; case 143 /* QualifiedName */: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); - case 274 /* JSDocVariadicType */: + case 277 /* JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); default: return unknownType; @@ -31277,16 +31378,16 @@ var ts; case 194 /* BinaryExpression */: return node.operatorToken.kind === 54 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: return isContextSensitive(node.initializer); case 185 /* ParenthesizedExpression */: return isContextSensitive(node.expression); - case 254 /* JsxAttributes */: + case 257 /* JsxAttributes */: return ts.forEach(node.properties, isContextSensitive); - case 253 /* JsxAttribute */: + case 256 /* JsxAttribute */: // If there is no initializer, JSX attribute has a boolean value of true which is not context sensitive. return node.initializer && isContextSensitive(node.initializer); - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: // It is possible to that node.expression is undefined (e.g
) return node.expression && isContextSensitive(node.expression); } @@ -34042,7 +34143,7 @@ var ts; } function getAssignedTypeOfBinaryExpression(node) { var isDestructuringDefaultAssignment = node.parent.kind === 177 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || - node.parent.kind === 261 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); + node.parent.kind === 264 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); @@ -34078,9 +34179,9 @@ var ts; return getAssignedTypeOfArrayLiteralElement(parent, node); case 198 /* SpreadElement */: return getAssignedTypeOfSpreadExpression(parent); - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent); - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return unknownType; @@ -34152,7 +34253,7 @@ var ts; getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 257 /* CaseClause */) { + if (clause.kind === 260 /* CaseClause */) { var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } @@ -34985,7 +35086,7 @@ var ts; return ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || node.kind === 234 /* ModuleBlock */ || - node.kind === 265 /* SourceFile */ || + node.kind === 268 /* SourceFile */ || node.kind === 149 /* PropertyDeclaration */; }); } @@ -35197,7 +35298,7 @@ var ts; function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 /* ES2015 */ || (symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 || - symbol.valueDeclaration.parent.kind === 260 /* CatchClause */) { + symbol.valueDeclaration.parent.kind === 263 /* CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -35406,7 +35507,7 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 273 /* JSDocFunctionType */) { + if (jsdocType && jsdocType.kind === 276 /* JSDocFunctionType */) { var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && @@ -35600,7 +35701,7 @@ var ts; return (func.kind === 151 /* MethodDeclaration */ || func.kind === 153 /* GetAccessor */ || func.kind === 154 /* SetAccessor */) && func.parent.kind === 178 /* ObjectLiteralExpression */ ? func.parent : - func.kind === 186 /* FunctionExpression */ && func.parent.kind === 261 /* PropertyAssignment */ ? func.parent.parent : + func.kind === 186 /* FunctionExpression */ && func.parent.kind === 264 /* PropertyAssignment */ ? func.parent.parent : undefined; } function getThisTypeArgument(type) { @@ -35639,7 +35740,7 @@ var ts; if (thisType) { return instantiateType(thisType, getContextualMapper(containingLiteral)); } - if (literal.parent.kind !== 261 /* PropertyAssignment */) { + if (literal.parent.kind !== 264 /* PropertyAssignment */) { break; } literal = literal.parent.parent; @@ -35928,7 +36029,12 @@ var ts; // JSX expression can appear in two position : JSX Element's children or JSX attribute var jsxAttributes = ts.isJsxAttributeLike(node.parent) ? node.parent.parent : - node.parent.openingElement.attributes; // node.parent is JsxElement + ts.isJsxElement(node.parent) ? + node.parent.openingElement.attributes : + undefined; // node.parent is JsxFragment with no attributes + if (!jsxAttributes) { + return undefined; // don't check children of a fragment + } // When we trying to resolve JsxOpeningLikeElement as a stateless function element, we will already give its attributes a contextual type // which is a type of the parameter of the signature we are trying out. // If there is no contextual type (e.g. we are trying to resolve stateful component), get attributes type from resolving element's tagName @@ -36017,10 +36123,10 @@ var ts; return getTypeFromTypeNode(parent.type); case 194 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 261 /* PropertyAssignment */: - case 262 /* ShorthandPropertyAssignment */: + case 264 /* PropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent); - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: return getApparentTypeOfContextualType(parent.parent); case 177 /* ArrayLiteralExpression */: { var arrayLiteral = parent; @@ -36037,10 +36143,10 @@ var ts; var tag = ts.isInJavaScriptFile(parent) ? ts.getJSDocTypeTag(parent) : undefined; return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(parent); } - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: return getContextualTypeForJsxExpression(parent); - case 253 /* JsxAttribute */: - case 255 /* JsxSpreadAttribute */: + case 256 /* JsxAttribute */: + case 258 /* JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent); case 251 /* JsxOpeningElement */: case 250 /* JsxSelfClosingElement */: @@ -36313,15 +36419,15 @@ var ts; var memberDecl = node.properties[i]; var member = memberDecl.symbol; var literalName = void 0; - if (memberDecl.kind === 261 /* PropertyAssignment */ || - memberDecl.kind === 262 /* ShorthandPropertyAssignment */ || + if (memberDecl.kind === 264 /* PropertyAssignment */ || + memberDecl.kind === 265 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { var jsdocType = void 0; if (isInJSFile) { jsdocType = getTypeForDeclarationFromJSDocComment(memberDecl); } var type = void 0; - if (memberDecl.kind === 261 /* PropertyAssignment */) { + if (memberDecl.kind === 264 /* PropertyAssignment */) { if (memberDecl.name.kind === 144 /* ComputedPropertyName */) { var t = checkComputedPropertyName(memberDecl.name); if (t.flags & 224 /* Literal */) { @@ -36334,7 +36440,7 @@ var ts; type = checkObjectLiteralMethod(memberDecl, checkMode); } else { - ts.Debug.assert(memberDecl.kind === 262 /* ShorthandPropertyAssignment */); + ts.Debug.assert(memberDecl.kind === 265 /* ShorthandPropertyAssignment */); type = checkExpressionForMutableLocation(memberDecl.name, checkMode); } if (jsdocType) { @@ -36346,8 +36452,8 @@ var ts; if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. - var isOptional = (memberDecl.kind === 261 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 262 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 264 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 265 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 16777216 /* Optional */; } @@ -36375,7 +36481,7 @@ var ts; prop.target = member; member = prop; } - else if (memberDecl.kind === 263 /* SpreadAssignment */) { + else if (memberDecl.kind === 266 /* SpreadAssignment */) { if (languageVersion < 2 /* ES2015 */) { checkExternalEmitHelpers(memberDecl, 2 /* Assign */); } @@ -36465,12 +36571,12 @@ var ts; type.flags & 196608 /* UnionOrIntersection */ && !ts.forEach(type.types, function (t) { return !isValidSpreadType(t); })); } function checkJsxSelfClosingElement(node) { - checkJsxOpeningLikeElement(node); + checkJsxOpeningLikeElementOrOpeningFragment(node); return getJsxGlobalElementType() || anyType; } function checkJsxElement(node) { // Check attributes - checkJsxOpeningLikeElement(node.openingElement); + checkJsxOpeningLikeElementOrOpeningFragment(node.openingElement); // Perform resolution on the closing tag so that rename/go to definition/etc work if (isJsxIntrinsicIdentifier(node.closingElement.tagName)) { getIntrinsicTagSymbol(node.closingElement); @@ -36480,6 +36586,13 @@ var ts; } return getJsxGlobalElementType() || anyType; } + function checkJsxFragment(node) { + checkJsxOpeningLikeElementOrOpeningFragment(node.openingFragment); + if (compilerOptions.jsx === 2 /* React */ && compilerOptions.jsxFactory) { + error(node, ts.Diagnostics.JSX_fragment_is_not_supported_when_using_jsxFactory); + } + return getJsxGlobalElementType() || anyType; + } /** * Returns true iff the JSX element name would be a valid JS identifier, ignoring restrictions about keywords not being identifiers */ @@ -36542,7 +36655,7 @@ var ts; } } else { - ts.Debug.assert(attributeDecl.kind === 255 /* JsxSpreadAttribute */); + ts.Debug.assert(attributeDecl.kind === 258 /* JsxSpreadAttribute */); if (attributesArray.length > 0) { spread = getSpreadType(spread, createJsxAttributesType(attributes.symbol, attributesTable), openingLikeElement.symbol, /*propagatedFlags*/ 0); attributesArray = []; @@ -36579,20 +36692,7 @@ var ts; var parent = openingLikeElement.parent.kind === 249 /* JsxElement */ ? openingLikeElement.parent : undefined; // We have to check that openingElement of the parent is the one we are visiting as this may not be true for selfClosingElement if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) { - var childrenTypes = []; - for (var _c = 0, _d = parent.children; _c < _d.length; _c++) { - var child = _d[_c]; - // In React, JSX text that contains only whitespaces will be ignored so we don't want to type-check that - // because then type of children property will have constituent of string type. - if (child.kind === 10 /* JsxText */) { - if (!child.containsOnlyWhiteSpaces) { - childrenTypes.push(stringType); - } - } - else { - childrenTypes.push(checkExpression(child, checkMode)); - } - } + var childrenTypes = checkJsxChildren(parent, checkMode); if (!hasSpreadAnyType && jsxChildrenPropertyName && jsxChildrenPropertyName !== "") { // Error if there is a attribute named "children" explicitly specified and children element. // This is because children element will overwrite the value from attributes. @@ -36626,6 +36726,23 @@ var ts; return result; } } + function checkJsxChildren(node, checkMode) { + var childrenTypes = []; + for (var _i = 0, _a = node.children; _i < _a.length; _i++) { + var child = _a[_i]; + // In React, JSX text that contains only whitespaces will be ignored so we don't want to type-check that + // because then type of children property will have constituent of string type. + if (child.kind === 10 /* JsxText */) { + if (!child.containsOnlyWhiteSpaces) { + childrenTypes.push(stringType); + } + } + else { + childrenTypes.push(checkExpression(child, checkMode)); + } + } + return childrenTypes; + } /** * Check attributes property of opening-like element. This function is called during chooseOverload to get call signature of a JSX opening-like element. * (See "checkApplicableSignatureForJsxOpeningLikeElement" for how the function is used) @@ -37093,14 +37210,18 @@ var ts; } } } - function checkJsxOpeningLikeElement(node) { - checkGrammarJsxElement(node); + function checkJsxOpeningLikeElementOrOpeningFragment(node) { + var isNodeOpeningLikeElement = ts.isJsxOpeningLikeElement(node); + if (isNodeOpeningLikeElement) { + checkGrammarJsxElement(node); + } checkJsxPreconditions(node); // The reactNamespace/jsxFactory's root symbol should be marked as 'used' so we don't incorrectly elide its import. // And if there is no reactNamespace/jsxFactory's symbol in scope when targeting React emit, we should issue an error. var reactRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? ts.Diagnostics.Cannot_find_name_0 : undefined; var reactNamespace = getJsxNamespace(); - var reactSym = resolveName(node.tagName, reactNamespace, 107455 /* Value */, reactRefErr, reactNamespace, /*isUse*/ true); + var reactLocation = isNodeOpeningLikeElement ? node.tagName : node; + var reactSym = resolveName(reactLocation, reactNamespace, 107455 /* Value */, reactRefErr, reactNamespace, /*isUse*/ true); if (reactSym) { // Mark local symbol as referenced here because it might not have been marked // if jsx emit was not react as there wont be error being emitted @@ -37110,7 +37231,12 @@ var ts; markAliasSymbolAsReferenced(reactSym); } } - checkJsxAttributesAssignableToTagNameAttributes(node); + if (isNodeOpeningLikeElement) { + checkJsxAttributesAssignableToTagNameAttributes(node); + } + else { + checkJsxChildren(node.parent); + } } /** * Check if a property with the given name is known anywhere in the given type. In an object type, a property @@ -37393,7 +37519,7 @@ var ts; switch (node.kind) { case 149 /* PropertyDeclaration */: return true; - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: // We might be in `a = { b: this.b }`, so keep looking. See `tests/cases/compiler/useBeforeDeclaration_propertyAssignment.ts`. return false; default: @@ -39769,7 +39895,7 @@ var ts; } /** Note: If property cannot be a SpreadAssignment, then allProperties does not need to be provided */ function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { - if (property.kind === 261 /* PropertyAssignment */ || property.kind === 262 /* ShorthandPropertyAssignment */) { + if (property.kind === 264 /* PropertyAssignment */ || property.kind === 265 /* ShorthandPropertyAssignment */) { var name = property.name; if (name.kind === 144 /* ComputedPropertyName */) { checkComputedPropertyName(name); @@ -39784,7 +39910,7 @@ var ts; isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1 /* Number */) || getIndexTypeOfType(objectLiteralType, 0 /* String */); if (type) { - if (property.kind === 262 /* ShorthandPropertyAssignment */) { + if (property.kind === 265 /* ShorthandPropertyAssignment */) { return checkDestructuringAssignment(property, type); } else { @@ -39796,7 +39922,7 @@ var ts; error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name)); } } - else if (property.kind === 263 /* SpreadAssignment */) { + else if (property.kind === 266 /* SpreadAssignment */) { if (languageVersion < 5 /* ESNext */) { checkExternalEmitHelpers(property, 4 /* Rest */); } @@ -39872,7 +39998,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode) { var target; - if (exprOrAssignment.kind === 262 /* ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 265 /* ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { // In strict null checking mode, if a default value of a non-undefined type is specified, remove @@ -39902,7 +40028,7 @@ var ts; } function checkReferenceAssignment(target, sourceType, checkMode) { var targetType = checkExpression(target, checkMode); - var error = target.parent.kind === 263 /* SpreadAssignment */ ? + var error = target.parent.kind === 266 /* SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; if (checkReferenceExpression(target, error)) { @@ -40501,13 +40627,15 @@ var ts; return undefinedWideningType; case 197 /* YieldExpression */: return checkYieldExpression(node); - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: return checkJsxExpression(node, checkMode); case 249 /* JsxElement */: return checkJsxElement(node); case 250 /* JsxSelfClosingElement */: return checkJsxSelfClosingElement(node); - case 254 /* JsxAttributes */: + case 253 /* JsxFragment */: + return checkJsxFragment(node); + case 257 /* JsxAttributes */: return checkJsxAttributes(node, checkMode); case 251 /* JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); @@ -41445,7 +41573,7 @@ var ts; case 230 /* InterfaceDeclaration */: case 231 /* TypeAliasDeclaration */: // A jsdoc typedef is, by definition, a type alias - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return 2 /* ExportType */; case 233 /* ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ @@ -41912,7 +42040,7 @@ var ts; error(classLike, ts.Diagnostics.JSDoc_0_is_not_attached_to_a_class, ts.idText(node.tagName)); return; } - var augmentsTags = ts.getAllJSDocTagsOfKind(classLike, 277 /* JSDocAugmentsTag */); + var augmentsTags = ts.getAllJSDocTagsOfKind(classLike, 280 /* JSDocAugmentsTag */); ts.Debug.assert(augmentsTags.length > 0); if (augmentsTags.length > 1) { error(augmentsTags[1], ts.Diagnostics.Class_declarations_cannot_have_more_than_one_augments_or_extends_tag); @@ -42005,7 +42133,7 @@ var ts; for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) { var node = deferredUnusedIdentifierNodes_1[_i]; switch (node.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 233 /* ModuleDeclaration */: checkUnusedModuleMembers(node); break; @@ -42278,7 +42406,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 265 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 268 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -42293,7 +42421,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 265 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { + if (parent.kind === 268 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -42350,7 +42478,7 @@ var ts; (container.kind === 207 /* Block */ && ts.isFunctionLike(container.parent) || container.kind === 234 /* ModuleBlock */ || container.kind === 233 /* ModuleDeclaration */ || - container.kind === 265 /* SourceFile */); + container.kind === 268 /* SourceFile */); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error // otherwise if variable has an initializer - show error that initialization will fail @@ -43091,7 +43219,7 @@ var ts; var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 258 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 261 /* DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -43103,7 +43231,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 257 /* CaseClause */) { + if (produceDiagnostics && clause.kind === 260 /* CaseClause */) { var caseClause = clause; // TypeScript 1.0 spec (April 2014): 5.9 // In a 'switch' statement, each 'case' expression must be of a type that is comparable @@ -43776,7 +43904,7 @@ var ts; var declaration = memberSymbol.valueDeclaration; if (declaration !== member) { if (isBlockScopedNameDeclaredBeforeUse(declaration, member)) { - return getNodeLinks(declaration).enumMemberValue; + return getEnumMemberValue(declaration); } error(expr, ts.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums); return 0; @@ -44041,7 +44169,7 @@ var ts; return false; } var inAmbientExternalModule = node.parent.kind === 234 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 265 /* SourceFile */ && !inAmbientExternalModule) { + if (node.parent.kind !== 268 /* SourceFile */ && !inAmbientExternalModule) { error(moduleName, node.kind === 244 /* ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); @@ -44170,7 +44298,7 @@ var ts; var inAmbientExternalModule = node.parent.kind === 234 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 234 /* ModuleBlock */ && !node.moduleSpecifier && ts.isInAmbientContext(node); - if (node.parent.kind !== 265 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + if (node.parent.kind !== 268 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -44187,7 +44315,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 265 /* SourceFile */ || node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 233 /* ModuleDeclaration */; + var isInAppropriateContext = node.parent.kind === 268 /* SourceFile */ || node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 233 /* ModuleDeclaration */; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -44213,7 +44341,7 @@ var ts; // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors. return; } - var container = node.parent.kind === 265 /* SourceFile */ ? node.parent : node.parent.parent; + var container = node.parent.kind === 268 /* SourceFile */ ? node.parent : node.parent.parent; if (container.kind === 233 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); @@ -44363,25 +44491,25 @@ var ts; case 168 /* ParenthesizedType */: case 170 /* TypeOperator */: return checkSourceElement(node.type); - case 277 /* JSDocAugmentsTag */: + case 280 /* JSDocAugmentsTag */: return checkJSDocAugmentsTag(node); - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return checkJSDocTypedefTag(node); - case 279 /* JSDocParameterTag */: + case 282 /* JSDocParameterTag */: return checkJSDocParameterTag(node); - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: checkSignatureDeclaration(node); // falls through - case 274 /* JSDocVariadicType */: - case 271 /* JSDocNonNullableType */: - case 270 /* JSDocNullableType */: - case 268 /* JSDocAllType */: - case 269 /* JSDocUnknownType */: + case 277 /* JSDocVariadicType */: + case 274 /* JSDocNonNullableType */: + case 273 /* JSDocNullableType */: + case 271 /* JSDocAllType */: + case 272 /* JSDocUnknownType */: if (!ts.isInJavaScriptFile(node) && !ts.isInJSDoc(node)) { grammarErrorOnNode(node, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); } return; - case 267 /* JSDocTypeExpression */: + case 270 /* JSDocTypeExpression */: return checkSourceElement(node.type); case 171 /* IndexedAccessType */: return checkIndexedAccessType(node); @@ -44794,10 +44922,10 @@ var ts; return entityNameSymbol; } } - if (entityName.parent.kind === 279 /* JSDocParameterTag */) { + if (entityName.parent.kind === 282 /* JSDocParameterTag */) { return ts.getParameterSymbolFromJSDoc(entityName.parent); } - if (entityName.parent.kind === 145 /* TypeParameter */ && entityName.parent.parent.kind === 282 /* JSDocTemplateTag */) { + if (entityName.parent.kind === 145 /* TypeParameter */ && entityName.parent.parent.kind === 285 /* JSDocTemplateTag */) { ts.Debug.assert(!ts.isInJavaScriptFile(entityName)); // Otherwise `isDeclarationName` would have been true. var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent); return typeParameter && typeParameter.symbol; @@ -44831,7 +44959,7 @@ var ts; var meaning = entityName.parent.kind === 159 /* TypeReference */ ? 793064 /* Type */ : 1920 /* Namespace */; return resolveEntityName(entityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); } - else if (entityName.parent.kind === 253 /* JsxAttribute */) { + else if (entityName.parent.kind === 256 /* JsxAttribute */) { return getJsxAttributePropertySymbol(entityName.parent); } if (entityName.parent.kind === 158 /* TypePredicate */) { @@ -44841,7 +44969,7 @@ var ts; return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 265 /* SourceFile */) { + if (node.kind === 268 /* SourceFile */) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } if (isInsideWithStatementBody(node)) { @@ -44925,7 +45053,7 @@ var ts; // The function returns a value symbol of an identifier in the short-hand property assignment. // This is necessary as an identifier in short-hand property assignment can contains two meaning: // property name and property value. - if (location && location.kind === 262 /* ShorthandPropertyAssignment */) { + if (location && location.kind === 265 /* ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 107455 /* Value */ | 2097152 /* Alias */); } return undefined; @@ -45012,7 +45140,7 @@ var ts; } // If this is from nested object binding pattern // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { - if (expr.parent.kind === 261 /* PropertyAssignment */) { + if (expr.parent.kind === 264 /* PropertyAssignment */) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); } @@ -45157,7 +45285,7 @@ var ts; } var parentSymbol_1 = getParentOfSymbol(symbol); if (parentSymbol_1) { - if (parentSymbol_1.flags & 512 /* ValueModule */ && parentSymbol_1.valueDeclaration.kind === 265 /* SourceFile */) { + if (parentSymbol_1.flags & 512 /* ValueModule */ && parentSymbol_1.valueDeclaration.kind === 268 /* SourceFile */) { var symbolFile = parentSymbol_1.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); // If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined. @@ -45272,7 +45400,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(node) { node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 265 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 268 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -45345,7 +45473,7 @@ var ts; } function canHaveConstantValue(node) { switch (node.kind) { - case 264 /* EnumMember */: + case 267 /* EnumMember */: case 179 /* PropertyAccessExpression */: case 180 /* ElementAccessExpression */: return true; @@ -45353,7 +45481,7 @@ var ts; return false; } function getConstantValue(node) { - if (node.kind === 264 /* EnumMember */) { + if (node.kind === 267 /* EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -45615,7 +45743,7 @@ var ts; break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 265 /* SourceFile */ && current.flags & 512 /* ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 268 /* SourceFile */ && current.flags & 512 /* ValueModule */) { return false; } // check that at least one declaration of top level symbol originates from type declaration file @@ -45635,7 +45763,7 @@ var ts; if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 265 /* SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 268 /* SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors @@ -45805,7 +45933,7 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 265 /* SourceFile */) { + else if (node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 268 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128 /* Abstract */) { @@ -45828,7 +45956,7 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 265 /* SourceFile */) { + else if (node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 268 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } else if (node.kind === 146 /* Parameter */) { @@ -45873,7 +46001,7 @@ var ts; flags |= 1 /* Export */; break; case 79 /* DefaultKeyword */: - var container = node.parent.kind === 265 /* SourceFile */ ? node.parent : node.parent.parent; + var container = node.parent.kind === 268 /* SourceFile */ ? node.parent : node.parent.parent; if (container.kind === 233 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } @@ -45995,7 +46123,7 @@ var ts; case 146 /* Parameter */: return false; default: - if (node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 265 /* SourceFile */) { + if (node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 268 /* SourceFile */) { return false; } switch (node.kind) { @@ -46258,7 +46386,7 @@ var ts; var GetOrSetAccessor = GetAccessor | SetAccessor; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 263 /* SpreadAssignment */) { + if (prop.kind === 266 /* SpreadAssignment */) { continue; } var name = prop.name; @@ -46266,7 +46394,7 @@ var ts; // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name); } - if (prop.kind === 262 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 265 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); @@ -46289,7 +46417,7 @@ 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 = void 0; - if (prop.kind === 261 /* PropertyAssignment */ || prop.kind === 262 /* ShorthandPropertyAssignment */) { + if (prop.kind === 264 /* PropertyAssignment */ || prop.kind === 265 /* ShorthandPropertyAssignment */) { // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name.kind === 8 /* NumericLiteral */) { @@ -46339,7 +46467,7 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 255 /* JsxSpreadAttribute */) { + if (attr.kind === 258 /* JsxSpreadAttribute */) { continue; } var jsxAttr = attr; @@ -46351,7 +46479,7 @@ var ts; return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 256 /* JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 259 /* JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -46791,7 +46919,7 @@ var ts; // to prevent noisiness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 207 /* Block */ || node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 265 /* SourceFile */) { + if (node.parent.kind === 207 /* Block */ || node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 268 /* SourceFile */) { var links_1 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_1.hasReportedStatementInAmbientContext) { @@ -46815,7 +46943,7 @@ var ts; else if (ts.isChildOfNodeWithKind(node, 173 /* LiteralType */)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 264 /* EnumMember */)) { + else if (ts.isChildOfNodeWithKind(node, 267 /* EnumMember */)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -48723,8 +48851,24 @@ var ts; : node; } ts.updateJsxClosingElement = updateJsxClosingElement; + function createJsxFragment(openingFragment, children, closingFragment) { + var node = createSynthesizedNode(253 /* JsxFragment */); + node.openingFragment = openingFragment; + node.children = createNodeArray(children); + node.closingFragment = closingFragment; + return node; + } + ts.createJsxFragment = createJsxFragment; + function updateJsxFragment(node, openingFragment, children, closingFragment) { + return node.openingFragment !== openingFragment + || node.children !== children + || node.closingFragment !== closingFragment + ? updateNode(createJsxFragment(openingFragment, children, closingFragment), node) + : node; + } + ts.updateJsxFragment = updateJsxFragment; function createJsxAttribute(name, initializer) { - var node = createSynthesizedNode(253 /* JsxAttribute */); + var node = createSynthesizedNode(256 /* JsxAttribute */); node.name = name; node.initializer = initializer; return node; @@ -48738,7 +48882,7 @@ var ts; } ts.updateJsxAttribute = updateJsxAttribute; function createJsxAttributes(properties) { - var node = createSynthesizedNode(254 /* JsxAttributes */); + var node = createSynthesizedNode(257 /* JsxAttributes */); node.properties = createNodeArray(properties); return node; } @@ -48750,7 +48894,7 @@ var ts; } ts.updateJsxAttributes = updateJsxAttributes; function createJsxSpreadAttribute(expression) { - var node = createSynthesizedNode(255 /* JsxSpreadAttribute */); + var node = createSynthesizedNode(258 /* JsxSpreadAttribute */); node.expression = expression; return node; } @@ -48762,7 +48906,7 @@ var ts; } ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; function createJsxExpression(dotDotDotToken, expression) { - var node = createSynthesizedNode(256 /* JsxExpression */); + var node = createSynthesizedNode(259 /* JsxExpression */); node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; @@ -48776,7 +48920,7 @@ var ts; ts.updateJsxExpression = updateJsxExpression; // Clauses function createCaseClause(expression, statements) { - var node = createSynthesizedNode(257 /* CaseClause */); + var node = createSynthesizedNode(260 /* CaseClause */); node.expression = ts.parenthesizeExpressionForList(expression); node.statements = createNodeArray(statements); return node; @@ -48790,7 +48934,7 @@ var ts; } ts.updateCaseClause = updateCaseClause; function createDefaultClause(statements) { - var node = createSynthesizedNode(258 /* DefaultClause */); + var node = createSynthesizedNode(261 /* DefaultClause */); node.statements = createNodeArray(statements); return node; } @@ -48802,7 +48946,7 @@ var ts; } ts.updateDefaultClause = updateDefaultClause; function createHeritageClause(token, types) { - var node = createSynthesizedNode(259 /* HeritageClause */); + var node = createSynthesizedNode(262 /* HeritageClause */); node.token = token; node.types = createNodeArray(types); return node; @@ -48815,7 +48959,7 @@ var ts; } ts.updateHeritageClause = updateHeritageClause; function createCatchClause(variableDeclaration, block) { - var node = createSynthesizedNode(260 /* CatchClause */); + var node = createSynthesizedNode(263 /* CatchClause */); node.variableDeclaration = ts.isString(variableDeclaration) ? createVariableDeclaration(variableDeclaration) : variableDeclaration; node.block = block; return node; @@ -48830,7 +48974,7 @@ var ts; ts.updateCatchClause = updateCatchClause; // Property assignments function createPropertyAssignment(name, initializer) { - var node = createSynthesizedNode(261 /* PropertyAssignment */); + var node = createSynthesizedNode(264 /* PropertyAssignment */); node.name = asName(name); node.questionToken = undefined; node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined; @@ -48845,7 +48989,7 @@ var ts; } ts.updatePropertyAssignment = updatePropertyAssignment; function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - var node = createSynthesizedNode(262 /* ShorthandPropertyAssignment */); + var node = createSynthesizedNode(265 /* ShorthandPropertyAssignment */); node.name = asName(name); node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? ts.parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; @@ -48859,7 +49003,7 @@ var ts; } ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment; function createSpreadAssignment(expression) { - var node = createSynthesizedNode(263 /* SpreadAssignment */); + var node = createSynthesizedNode(266 /* SpreadAssignment */); node.expression = expression !== undefined ? ts.parenthesizeExpressionForList(expression) : undefined; return node; } @@ -48872,7 +49016,7 @@ var ts; ts.updateSpreadAssignment = updateSpreadAssignment; // Enum function createEnumMember(name, initializer) { - var node = createSynthesizedNode(264 /* EnumMember */); + var node = createSynthesizedNode(267 /* EnumMember */); node.name = asName(name); node.initializer = initializer && ts.parenthesizeExpressionForList(initializer); return node; @@ -48888,7 +49032,7 @@ var ts; // Top-level nodes function updateSourceFileNode(node, statements) { if (node.statements !== statements) { - var updated = createSynthesizedNode(265 /* SourceFile */); + var updated = createSynthesizedNode(268 /* SourceFile */); updated.flags |= node.flags; updated.statements = createNodeArray(statements); updated.endOfFileToken = node.endOfFileToken; @@ -48967,7 +49111,7 @@ var ts; * @param original The original statement. */ function createNotEmittedStatement(original) { - var node = createSynthesizedNode(287 /* NotEmittedStatement */); + var node = createSynthesizedNode(290 /* NotEmittedStatement */); node.original = original; setTextRange(node, original); return node; @@ -48979,7 +49123,7 @@ var ts; */ /* @internal */ function createEndOfDeclarationMarker(original) { - var node = createSynthesizedNode(291 /* EndOfDeclarationMarker */); + var node = createSynthesizedNode(294 /* EndOfDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -48991,7 +49135,7 @@ var ts; */ /* @internal */ function createMergeDeclarationMarker(original) { - var node = createSynthesizedNode(290 /* MergeDeclarationMarker */); + var node = createSynthesizedNode(293 /* MergeDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -49006,7 +49150,7 @@ var ts; * @param location The location for the expression. Defaults to the positions from "original" if provided. */ function createPartiallyEmittedExpression(expression, original) { - var node = createSynthesizedNode(288 /* PartiallyEmittedExpression */); + var node = createSynthesizedNode(291 /* PartiallyEmittedExpression */); node.expression = expression; node.original = original; setTextRange(node, original); @@ -49022,7 +49166,7 @@ var ts; ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; function flattenCommaElements(node) { if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) { - if (node.kind === 289 /* CommaListExpression */) { + if (node.kind === 292 /* CommaListExpression */) { return node.elements; } if (ts.isBinaryExpression(node) && node.operatorToken.kind === 26 /* CommaToken */) { @@ -49032,7 +49176,7 @@ var ts; return node; } function createCommaList(elements) { - var node = createSynthesizedNode(289 /* CommaListExpression */); + var node = createSynthesizedNode(292 /* CommaListExpression */); node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)); return node; } @@ -49044,7 +49188,7 @@ var ts; } ts.updateCommaList = updateCommaList; function createBundle(sourceFiles) { - var node = ts.createNode(266 /* Bundle */); + var node = ts.createNode(269 /* Bundle */); node.sourceFiles = sourceFiles; return node; } @@ -49180,7 +49324,7 @@ var ts; // To avoid holding onto transformation artifacts, we keep track of any // parse tree node we are annotating. This allows us to clean them up after // all transformations have completed. - if (node.kind === 265 /* SourceFile */) { + if (node.kind === 268 /* SourceFile */) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = ts.getSourceFileOfNode(node); @@ -49570,6 +49714,26 @@ var ts; /*typeArguments*/ undefined, argumentsList), location); } ts.createExpressionForJsxElement = createExpressionForJsxElement; + function createExpressionForJsxFragment(jsxFactoryEntity, reactNamespace, children, parentElement, location) { + var tagName = ts.createPropertyAccess(createReactNamespace(reactNamespace, parentElement), "Fragment"); + var argumentsList = [tagName]; + argumentsList.push(ts.createNull()); + if (children && children.length > 0) { + if (children.length > 1) { + for (var _i = 0, children_2 = children; _i < children_2.length; _i++) { + var child = children_2[_i]; + child.startsOnNewLine = true; + argumentsList.push(child); + } + } + else { + argumentsList.push(children[0]); + } + } + return ts.setTextRange(ts.createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement), + /*typeArguments*/ undefined, argumentsList), location); + } + ts.createExpressionForJsxFragment = createExpressionForJsxFragment; // Helpers function getHelperName(name) { return ts.setEmitFlags(ts.createIdentifier(name), 4096 /* HelperName */ | 2 /* AdviseOnEmitNode */); @@ -49763,9 +49927,9 @@ var ts; case 153 /* GetAccessor */: case 154 /* SetAccessor */: return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: return createExpressionForPropertyAssignment(property, receiver); - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: return createExpressionForShorthandPropertyAssignment(property, receiver); case 151 /* MethodDeclaration */: return createExpressionForMethodDeclaration(property, receiver); @@ -50410,7 +50574,7 @@ var ts; case 179 /* PropertyAccessExpression */: node = node.expression; continue; - case 288 /* PartiallyEmittedExpression */: + case 291 /* PartiallyEmittedExpression */: node = node.expression; continue; } @@ -50440,7 +50604,7 @@ var ts; case 202 /* AsExpression */: case 203 /* NonNullExpression */: return (kinds & 2 /* Assertions */) !== 0; - case 288 /* PartiallyEmittedExpression */: + case 291 /* PartiallyEmittedExpression */: return (kinds & 4 /* PartiallyEmittedExpressions */) !== 0; } return false; @@ -50484,7 +50648,7 @@ var ts; case 184 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression); case 202 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type); case 203 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression); - case 288 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression); + case 291 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression); } } /** @@ -50689,7 +50853,7 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: // `b` in `({ a: b } = ...)` // `b` in `({ a: b = 1 } = ...)` // `{b}` in `({ a: {b} } = ...)` @@ -50701,11 +50865,11 @@ var ts; // `b[0]` in `({ a: b[0] } = ...)` // `b[0]` in `({ a: b[0] = 1 } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: // `a` in `({ a } = ...)` // `a` in `({ a = 1 } = ...)` return bindingElement.name; - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: // `a` in `({ ...a } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } @@ -50742,7 +50906,7 @@ var ts; // `...` in `let [...a] = ...` return bindingElement.dotDotDotToken; case 198 /* SpreadElement */: - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: // `...` in `[...a] = ...` return bindingElement; } @@ -50766,7 +50930,7 @@ var ts; : propertyName; } break; - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: // `a` in `({ a: b } = ...)` // `[a]` in `({ [a]: b } = ...)` // `"a"` in `({ "a": b } = ...)` @@ -50778,7 +50942,7 @@ var ts; : propertyName; } break; - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: // `a` in `({ ...a } = ...)` return bindingElement.name; } @@ -51233,40 +51397,42 @@ var ts; return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNode(node.attributes, visitor, ts.isJsxAttributes)); case 252 /* JsxClosingElement */: return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 253 /* JsxAttribute */: + case 253 /* JsxFragment */: + return ts.updateJsxFragment(node, visitNode(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingFragment, visitor, ts.isJsxClosingFragment)); + case 256 /* JsxAttribute */: return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 254 /* JsxAttributes */: + case 257 /* JsxAttributes */: return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); - case 255 /* JsxSpreadAttribute */: + case 258 /* JsxSpreadAttribute */: return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); // Clauses - case 257 /* CaseClause */: + case 260 /* CaseClause */: return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); - case 258 /* DefaultClause */: + case 261 /* DefaultClause */: return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 259 /* HeritageClause */: + case 262 /* HeritageClause */: return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); // Property assignments - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); // Enum - case 264 /* EnumMember */: + case 267 /* EnumMember */: return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); // Top-level nodes - case 265 /* SourceFile */: + case 268 /* SourceFile */: return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); // Transformation nodes - case 288 /* PartiallyEmittedExpression */: + case 291 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); - case 289 /* CommaListExpression */: + case 292 /* CommaListExpression */: return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression)); default: // No need to visit nodes with no children. @@ -51322,7 +51488,7 @@ var ts; case 209 /* EmptyStatement */: case 200 /* OmittedExpression */: case 225 /* DebuggerStatement */: - case 287 /* NotEmittedStatement */: + case 290 /* NotEmittedStatement */: // No need to visit nodes with no children. break; // Names @@ -51639,67 +51805,72 @@ var ts; result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingElement, cbNode, result); break; + case 253 /* JsxFragment */: + result = reduceNode(node.openingFragment, cbNode, result); + result = ts.reduceLeft(node.children, cbNode, result); + result = reduceNode(node.closingFragment, cbNode, result); + break; case 250 /* JsxSelfClosingElement */: case 251 /* JsxOpeningElement */: result = reduceNode(node.tagName, cbNode, result); result = reduceNode(node.attributes, cbNode, result); break; - case 254 /* JsxAttributes */: + case 257 /* JsxAttributes */: result = reduceNodes(node.properties, cbNodes, result); break; case 252 /* JsxClosingElement */: result = reduceNode(node.tagName, cbNode, result); break; - case 253 /* JsxAttribute */: + case 256 /* JsxAttribute */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 255 /* JsxSpreadAttribute */: + case 258 /* JsxSpreadAttribute */: result = reduceNode(node.expression, cbNode, result); break; - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: result = reduceNode(node.expression, cbNode, result); break; // Clauses - case 257 /* CaseClause */: + case 260 /* CaseClause */: result = reduceNode(node.expression, cbNode, result); // falls through - case 258 /* DefaultClause */: + case 261 /* DefaultClause */: result = reduceNodes(node.statements, cbNodes, result); break; - case 259 /* HeritageClause */: + case 262 /* HeritageClause */: result = reduceNodes(node.types, cbNodes, result); break; - case 260 /* CatchClause */: + case 263 /* CatchClause */: result = reduceNode(node.variableDeclaration, cbNode, result); result = reduceNode(node.block, cbNode, result); break; // Property assignments - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: result = reduceNode(node.expression, cbNode, result); break; // Enum - case 264 /* EnumMember */: + case 267 /* EnumMember */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; // Top-level nodes - case 265 /* SourceFile */: + case 268 /* SourceFile */: result = reduceNodes(node.statements, cbNodes, result); break; // Transformation nodes - case 288 /* PartiallyEmittedExpression */: + case 291 /* PartiallyEmittedExpression */: result = reduceNode(node.expression, cbNode, result); break; - case 289 /* CommaListExpression */: + case 292 /* CommaListExpression */: result = reduceNodes(node.elements, cbNodes, result); break; default: @@ -52583,7 +52754,7 @@ var ts; */ function onBeforeVisitNode(node) { switch (node.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 235 /* CaseBlock */: case 234 /* ModuleBlock */: case 207 /* Block */: @@ -52840,7 +53011,7 @@ var ts; // - index signatures // - method overload signatures return visitClassExpression(node); - case 259 /* HeritageClause */: + case 262 /* HeritageClause */: // This is a heritage clause with TypeScript syntax extensions. // // TypeScript heritage clause extensions include: @@ -54680,7 +54851,7 @@ var ts; // enums in any other scope are emitted as a `let` declaration. var statement = ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ ts.createVariableDeclaration(ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)) - ], currentScope.kind === 265 /* SourceFile */ ? 0 /* None */ : 1 /* Let */)); + ], currentScope.kind === 268 /* SourceFile */ ? 0 /* None */ : 1 /* Let */)); ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { @@ -55129,7 +55300,7 @@ var ts; // We need to enable substitutions for identifiers and shorthand property assignments. This allows us to // substitute the names of exported members of a namespace. context.enableSubstitution(71 /* Identifier */); - context.enableSubstitution(262 /* ShorthandPropertyAssignment */); + context.enableSubstitution(265 /* ShorthandPropertyAssignment */); // We need to be notified when entering and exiting namespaces. context.enableEmitNotification(233 /* ModuleDeclaration */); } @@ -55239,7 +55410,7 @@ var ts; // If we are nested within a namespace declaration, we may need to qualifiy // an identifier that is exported from a merged namespace. var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false); - if (container && container.kind !== 265 /* SourceFile */) { + if (container && container.kind !== 268 /* SourceFile */) { var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 233 /* ModuleDeclaration */) || (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 232 /* EnumDeclaration */); if (substitute) { @@ -55761,7 +55932,7 @@ var ts; return visitExpressionStatement(node); case 185 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, noDestructuringValue); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return visitCatchClause(node); default: return ts.visitEachChild(node, visitor, context); @@ -55796,7 +55967,7 @@ var ts; var objects = []; for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { var e = elements_3[_i]; - if (e.kind === 263 /* SpreadAssignment */) { + if (e.kind === 266 /* SpreadAssignment */) { if (chunkObject) { objects.push(ts.createObjectLiteral(chunkObject)); chunkObject = undefined; @@ -55808,7 +55979,7 @@ var ts; if (!chunkObject) { chunkObject = []; } - if (e.kind === 261 /* PropertyAssignment */) { + if (e.kind === 264 /* PropertyAssignment */) { var p = e; chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); } @@ -56340,7 +56511,9 @@ var ts; return visitJsxElement(node, /*isChild*/ false); case 250 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ false); - case 256 /* JsxExpression */: + case 253 /* JsxFragment */: + return visitJsxFragment(node, /*isChild*/ false); + case 259 /* JsxExpression */: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -56350,12 +56523,14 @@ var ts; switch (node.kind) { case 10 /* JsxText */: return visitJsxText(node); - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: return visitJsxExpression(node); case 249 /* JsxElement */: return visitJsxElement(node, /*isChild*/ true); case 250 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ true); + case 253 /* JsxFragment */: + return visitJsxFragment(node, /*isChild*/ true); default: ts.Debug.failBadSyntaxKind(node); return undefined; @@ -56367,6 +56542,9 @@ var ts; function visitJsxSelfClosingElement(node, isChild) { return visitJsxOpeningLikeElement(node, /*children*/ undefined, isChild, /*location*/ node); } + function visitJsxFragment(node, isChild) { + return visitJsxOpeningFragment(node.openingFragment, node.children, isChild, /*location*/ node); + } function visitJsxOpeningLikeElement(node, children, isChild, location) { var tagName = getTagName(node); var objectProperties; @@ -56399,6 +56577,13 @@ var ts; } return element; } + function visitJsxOpeningFragment(node, children, isChild, location) { + var element = ts.createExpressionForJsxFragment(context.getEmitResolver().getJsxFactoryEntity(), compilerOptions.reactNamespace, ts.mapDefined(children, transformJsxChildToExpression), node, location); + if (isChild) { + ts.startOnNewLine(element); + } + return element; + } function transformJsxSpreadAttributeToExpression(node) { return ts.visitNode(node.expression, visitor, ts.isExpression); } @@ -56415,7 +56600,7 @@ var ts; var decoded = tryDecodeEntities(node.text); return decoded ? ts.setTextRange(ts.createLiteral(decoded), node) : node; } - else if (node.kind === 256 /* JsxExpression */) { + else if (node.kind === 259 /* JsxExpression */) { if (node.expression === undefined) { return ts.createTrue(); } @@ -57129,9 +57314,9 @@ var ts; return visitExpressionStatement(node); case 178 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return visitCatchClause(node); - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: return visitShorthandPropertyAssignment(node); case 144 /* ComputedPropertyName */: return visitComputedPropertyName(node); @@ -59030,10 +59215,10 @@ var ts; case 151 /* MethodDeclaration */: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -59889,7 +60074,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; context.enableSubstitution(179 /* PropertyAccessExpression */); - context.enableSubstitution(261 /* PropertyAssignment */); + context.enableSubstitution(264 /* PropertyAssignment */); return transformSourceFile; /** * Transforms an ES5 source file to ES3. @@ -61403,7 +61588,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 258 /* DefaultClause */ && defaultClauseIndex === -1) { + if (clause.kind === 261 /* DefaultClause */ && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -61416,7 +61601,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 257 /* CaseClause */) { + if (clause.kind === 260 /* CaseClause */) { var caseClause = clause; if (containsYield(caseClause.expression) && pendingClauses.length > 0) { break; @@ -62651,8 +62836,8 @@ var ts; context.enableSubstitution(194 /* BinaryExpression */); // Substitutes assignments to exported symbols. context.enableSubstitution(192 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. context.enableSubstitution(193 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(262 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. - context.enableEmitNotification(265 /* SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(265 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. + context.enableEmitNotification(268 /* SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var currentSourceFile; // The current file. @@ -62970,9 +63155,9 @@ var ts; return visitFunctionDeclaration(node); case 229 /* ClassDeclaration */: return visitClassDeclaration(node); - case 290 /* MergeDeclarationMarker */: + case 293 /* MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 291 /* EndOfDeclarationMarker */: + case 294 /* EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return ts.visitEachChild(node, importCallExpressionVisitor, context); @@ -63655,7 +63840,7 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 265 /* SourceFile */) { + if (node.kind === 268 /* SourceFile */) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; noSubstitution = []; @@ -63743,7 +63928,7 @@ var ts; } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 265 /* SourceFile */) { + if (exportContainer && exportContainer.kind === 268 /* SourceFile */) { return ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node)), /*location*/ node); } @@ -63888,7 +64073,7 @@ var ts; context.enableSubstitution(194 /* BinaryExpression */); // Substitutes assignments to exported symbols. context.enableSubstitution(192 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. context.enableSubstitution(193 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableEmitNotification(265 /* SourceFile */); // Restore state when substituting nodes in a file. + context.enableEmitNotification(268 /* SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var exportFunctionsMap = []; // The export function associated with a source file. @@ -64459,7 +64644,7 @@ var ts; function shouldHoistVariableDeclarationList(node) { // hoist only non-block scoped declarations or block scoped declarations parented by source file return (ts.getEmitFlags(node) & 2097152 /* NoHoisting */) === 0 - && (enclosingBlockScopedContainer.kind === 265 /* SourceFile */ + && (enclosingBlockScopedContainer.kind === 268 /* SourceFile */ || (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0); } /** @@ -64786,19 +64971,19 @@ var ts; return visitSwitchStatement(node); case 235 /* CaseBlock */: return visitCaseBlock(node); - case 257 /* CaseClause */: + case 260 /* CaseClause */: return visitCaseClause(node); - case 258 /* DefaultClause */: + case 261 /* DefaultClause */: return visitDefaultClause(node); case 224 /* TryStatement */: return visitTryStatement(node); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return visitCatchClause(node); case 207 /* Block */: return visitBlock(node); - case 290 /* MergeDeclarationMarker */: + case 293 /* MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 291 /* EndOfDeclarationMarker */: + case 294 /* EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return destructuringAndImportCallVisitor(node); @@ -65049,7 +65234,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 265 /* SourceFile */; + return container !== undefined && container.kind === 268 /* SourceFile */; } else { return false; @@ -65082,7 +65267,7 @@ var ts; * @param emitCallback A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 265 /* SourceFile */) { + if (node.kind === 268 /* SourceFile */) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -65254,7 +65439,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); - if (exportContainer && exportContainer.kind === 265 /* SourceFile */) { + if (exportContainer && exportContainer.kind === 268 /* SourceFile */) { exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -65295,7 +65480,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(265 /* SourceFile */); + context.enableEmitNotification(268 /* SourceFile */); context.enableSubstitution(71 /* Identifier */); var currentSourceFile; return transformSourceFile; @@ -65465,7 +65650,7 @@ var ts; * @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files. */ function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) { - var enabledSyntaxKindFeatures = new Array(292 /* Count */); + var enabledSyntaxKindFeatures = new Array(295 /* Count */); var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentVariableDeclarationsStack = []; @@ -65805,7 +65990,7 @@ var ts; } if (compilerOptions.mapRoot) { sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); - if (sourceFileOrBundle.kind === 265 /* SourceFile */) { + if (sourceFileOrBundle.kind === 268 /* SourceFile */) { // For modules or multiple emit files the mapRoot will have directory structure like the sources // So if src\a.ts and src\lib\b.ts are compiled together user would be moving the maps into mapRoot\a.js.map and mapRoot\lib\b.js.map sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFileOrBundle, host, sourceMapDir)); @@ -65950,7 +66135,7 @@ var ts; source = undefined; if (source) setSourceFile(source); - if (node.kind !== 287 /* NotEmittedStatement */ + if (node.kind !== 290 /* NotEmittedStatement */ && (emitFlags & 16 /* NoLeadingSourceMap */) === 0 && pos >= 0) { emitPos(skipSourceTrivia(pos)); @@ -65967,7 +66152,7 @@ var ts; } if (source) setSourceFile(source); - if (node.kind !== 287 /* NotEmittedStatement */ + if (node.kind !== 290 /* NotEmittedStatement */ && (emitFlags & 32 /* NoTrailingSourceMap */) === 0 && end >= 0) { emitPos(end); @@ -66144,7 +66329,7 @@ var ts; if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 287 /* NotEmittedStatement */; + var isEmittedNode = node.kind !== 290 /* NotEmittedStatement */; // We have to explicitly check that the node is JsxText because if the compilerOptions.jsx is "preserve" we will not do any transformation. // It is expensive to walk entire tree just to set one kind of node to have no comments. var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0 || node.kind === 10 /* JsxText */; @@ -66469,8 +66654,8 @@ var ts; } ts.getDeclarationDiagnostics = getDeclarationDiagnostics; function emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFileOrBundle, emitOnlyDtsFiles) { - var sourceFiles = sourceFileOrBundle.kind === 266 /* Bundle */ ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; - var isBundledEmit = sourceFileOrBundle.kind === 266 /* Bundle */; + var sourceFiles = sourceFileOrBundle.kind === 269 /* Bundle */ ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; + var isBundledEmit = sourceFileOrBundle.kind === 269 /* Bundle */; var newLine = host.getNewLine(); var compilerOptions = host.getCompilerOptions(); var write; @@ -67022,9 +67207,9 @@ var ts; writeModuleElement(node); } else if (node.kind === 237 /* ImportEqualsDeclaration */ || - (node.parent.kind === 265 /* SourceFile */ && isCurrentFileExternalModule)) { + (node.parent.kind === 268 /* SourceFile */ && isCurrentFileExternalModule)) { var isVisible = void 0; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 265 /* SourceFile */) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 268 /* SourceFile */) { // Import declaration of another module that is visited async so lets put it in right spot asynchronousSubModuleDeclarationEmitInfo.push({ node: node, @@ -67076,7 +67261,7 @@ var ts; } function emitModuleElementDeclarationFlags(node) { // If the node is parented in the current source file we need to emit export declare or just export - if (node.parent.kind === 265 /* SourceFile */) { + if (node.parent.kind === 268 /* SourceFile */) { var modifiers = ts.getModifierFlags(node); // If the node is exported if (modifiers & 1 /* Export */) { @@ -68098,11 +68283,11 @@ var ts; case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: return emitPropertyDeclaration(node); - case 264 /* EnumMember */: + case 267 /* EnumMember */: return emitEnumMemberDeclaration(node); case 243 /* ExportAssignment */: return emitExportAssignment(node); - case 265 /* SourceFile */: + case 268 /* SourceFile */: return emitSourceFile(node); } } @@ -68130,7 +68315,7 @@ var ts; return addedBundledEmitReference; function getDeclFileName(emitFileNames, sourceFileOrBundle) { // Dont add reference path to this file if it is a bundled emit and caller asked not emit bundled file path - var isBundledEmit = sourceFileOrBundle.kind === 266 /* Bundle */; + var isBundledEmit = sourceFileOrBundle.kind === 269 /* Bundle */; if (isBundledEmit && !addBundledFileReference) { return; } @@ -68145,7 +68330,7 @@ var ts; var emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFileOrBundle, emitOnlyDtsFiles); var emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath) || host.getCompilerOptions().noEmit; if (!emitSkipped) { - var sourceFiles = sourceFileOrBundle.kind === 266 /* Bundle */ ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; + var sourceFiles = sourceFileOrBundle.kind === 269 /* Bundle */ ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; var declarationOutput = emitDeclarationResult.referencesOutput + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo); ts.writeFile(host, emitterDiagnostics, declarationFilePath, declarationOutput, host.getCompilerOptions().emitBOM, sourceFiles); @@ -68230,7 +68415,7 @@ var ts; return ".js" /* Js */; } function getOriginalSourceFileOrBundle(sourceFileOrBundle) { - if (sourceFileOrBundle.kind === 266 /* Bundle */) { + if (sourceFileOrBundle.kind === 269 /* Bundle */) { return ts.updateBundle(sourceFileOrBundle, ts.sameMap(sourceFileOrBundle.sourceFiles, ts.getOriginalSourceFile)); } return ts.getOriginalSourceFile(sourceFileOrBundle); @@ -68307,8 +68492,8 @@ var ts; } } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle) { - var bundle = sourceFileOrBundle.kind === 266 /* Bundle */ ? sourceFileOrBundle : undefined; - var sourceFile = sourceFileOrBundle.kind === 265 /* SourceFile */ ? sourceFileOrBundle : undefined; + var bundle = sourceFileOrBundle.kind === 269 /* Bundle */ ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 268 /* SourceFile */ ? sourceFileOrBundle : undefined; var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFileOrBundle); if (bundle) { @@ -68348,7 +68533,7 @@ var ts; } function emitHelpers(node, writeLines) { var helpersEmitted = false; - var bundle = node.kind === 266 /* Bundle */ ? node : undefined; + var bundle = node.kind === 269 /* Bundle */ ? node : undefined; if (bundle && moduleKind === ts.ModuleKind.None) { return; } @@ -68429,8 +68614,8 @@ var ts; break; } switch (node.kind) { - case 265 /* SourceFile */: return printFile(node); - case 266 /* Bundle */: return printBundle(node); + case 268 /* SourceFile */: return printFile(node); + case 269 /* Bundle */: return printBundle(node); } writeNode(hint, node, sourceFile, beginPrint()); return endPrint(); @@ -68627,7 +68812,7 @@ var ts; return emitTypeReference(node); case 160 /* FunctionType */: return emitFunctionType(node); - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: return emitJSDocFunctionType(node); case 161 /* ConstructorType */: return emitConstructorType(node); @@ -68657,19 +68842,19 @@ var ts; return emitMappedType(node); case 173 /* LiteralType */: return emitLiteralType(node); - case 268 /* JSDocAllType */: + case 271 /* JSDocAllType */: write("*"); return; - case 269 /* JSDocUnknownType */: + case 272 /* JSDocUnknownType */: write("?"); return; - case 270 /* JSDocNullableType */: + case 273 /* JSDocNullableType */: return emitJSDocNullableType(node); - case 271 /* JSDocNonNullableType */: + case 274 /* JSDocNonNullableType */: return emitJSDocNonNullableType(node); - case 272 /* JSDocOptionalType */: + case 275 /* JSDocOptionalType */: return emitJSDocOptionalType(node); - case 274 /* JSDocVariadicType */: + case 277 /* JSDocVariadicType */: return emitJSDocVariadicType(node); // Binding patterns case 174 /* ObjectBindingPattern */: @@ -68774,35 +68959,37 @@ var ts; case 10 /* JsxText */: return emitJsxText(node); case 251 /* JsxOpeningElement */: - return emitJsxOpeningElement(node); + case 254 /* JsxOpeningFragment */: + return emitJsxOpeningElementOrFragment(node); case 252 /* JsxClosingElement */: - return emitJsxClosingElement(node); - case 253 /* JsxAttribute */: + case 255 /* JsxClosingFragment */: + return emitJsxClosingElementOrFragment(node); + case 256 /* JsxAttribute */: return emitJsxAttribute(node); - case 254 /* JsxAttributes */: + case 257 /* JsxAttributes */: return emitJsxAttributes(node); - case 255 /* JsxSpreadAttribute */: + case 258 /* JsxSpreadAttribute */: return emitJsxSpreadAttribute(node); - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: return emitJsxExpression(node); // Clauses - case 257 /* CaseClause */: + case 260 /* CaseClause */: return emitCaseClause(node); - case 258 /* DefaultClause */: + case 261 /* DefaultClause */: return emitDefaultClause(node); - case 259 /* HeritageClause */: + case 262 /* HeritageClause */: return emitHeritageClause(node); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return emitCatchClause(node); // Property assignments - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: return emitSpreadAssignment(node); // Enum - case 264 /* EnumMember */: + case 267 /* EnumMember */: return emitEnumMember(node); } // If the node is an expression, try to emit it as an expression with @@ -68897,10 +69084,12 @@ var ts; return emitJsxElement(node); case 250 /* JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); + case 253 /* JsxFragment */: + return emitJsxFragment(node); // Transformation nodes - case 288 /* PartiallyEmittedExpression */: + case 291 /* PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); - case 289 /* CommaListExpression */: + case 292 /* CommaListExpression */: return emitCommaList(node); } } @@ -68979,7 +69168,7 @@ var ts; emit(node.name); } emitIfPresent(node.questionToken); - if (node.parent && node.parent.kind === 273 /* JSDocFunctionType */ && !node.name) { + if (node.parent && node.parent.kind === 276 /* JSDocFunctionType */ && !node.name) { emit(node.type); } else { @@ -69941,7 +70130,7 @@ var ts; // function emitJsxElement(node) { emit(node.openingElement); - emitList(node, node.children, 131072 /* JsxElementChildren */); + emitList(node, node.children, 131072 /* JsxElementOrFragmentChildren */); emit(node.closingElement); } function emitJsxSelfClosingElement(node) { @@ -69954,22 +70143,31 @@ var ts; } write("/>"); } - function emitJsxOpeningElement(node) { + function emitJsxFragment(node) { + emit(node.openingFragment); + emitList(node, node.children, 131072 /* JsxElementOrFragmentChildren */); + emit(node.closingFragment); + } + function emitJsxOpeningElementOrFragment(node) { write("<"); - emitJsxTagName(node.tagName); - writeIfAny(node.attributes.properties, " "); - // We are checking here so we won't re-enter the emitting pipeline and emit extra sourcemap - if (node.attributes.properties && node.attributes.properties.length > 0) { - emit(node.attributes); + if (ts.isJsxOpeningElement(node)) { + emitJsxTagName(node.tagName); + // We are checking here so we won't re-enter the emitting pipeline and emit extra sourcemap + if (node.attributes.properties && node.attributes.properties.length > 0) { + write(" "); + emit(node.attributes); + } } write(">"); } function emitJsxText(node) { writer.writeLiteral(getTextOfNode(node, /*includeTrivia*/ true)); } - function emitJsxClosingElement(node) { + function emitJsxClosingElementOrFragment(node) { write(""); } function emitJsxAttributes(node) { @@ -70418,11 +70616,6 @@ var ts; function decreaseIndent() { writer.decreaseIndent(); } - function writeIfAny(nodes, text) { - if (ts.some(nodes)) { - write(text); - } - } function writeToken(token, pos, contextNode) { return onEmitSourceMapOfToken ? onEmitSourceMapOfToken(contextNode, token, pos, writeTokenText) @@ -70923,7 +71116,7 @@ var ts; ListFormat[ListFormat["EnumMembers"] = 81] = "EnumMembers"; ListFormat[ListFormat["CaseBlockClauses"] = 65] = "CaseBlockClauses"; ListFormat[ListFormat["NamedImportsOrExportsElements"] = 432] = "NamedImportsOrExportsElements"; - ListFormat[ListFormat["JsxElementChildren"] = 131072] = "JsxElementChildren"; + ListFormat[ListFormat["JsxElementOrFragmentChildren"] = 131072] = "JsxElementOrFragmentChildren"; ListFormat[ListFormat["JsxElementAttributes"] = 131328] = "JsxElementAttributes"; ListFormat[ListFormat["CaseOrDefaultClauseStatements"] = 81985] = "CaseOrDefaultClauseStatements"; ListFormat[ListFormat["HeritageClauseTypes"] = 272] = "HeritageClauseTypes"; @@ -72484,7 +72677,7 @@ var ts; return; } break; - case 259 /* HeritageClause */: + case 262 /* HeritageClause */: var heritageClause = node; if (heritageClause.token === 108 /* ImplementsKeyword */) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); @@ -74366,7 +74559,7 @@ var ts; var result = {}; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 261 /* PropertyAssignment */) { + if (element.kind !== 264 /* PropertyAssignment */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); continue; } @@ -75668,8 +75861,8 @@ var ts; case 176 /* BindingElement */: case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: - case 261 /* PropertyAssignment */: - case 262 /* ShorthandPropertyAssignment */: + case 264 /* PropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: case 151 /* MethodDeclaration */: case 150 /* MethodSignature */: case 152 /* Constructor */: @@ -75678,18 +75871,18 @@ var ts; case 228 /* FunctionDeclaration */: case 186 /* FunctionExpression */: case 187 /* ArrowFunction */: - case 260 /* CatchClause */: - case 253 /* JsxAttribute */: + case 263 /* CatchClause */: + case 256 /* JsxAttribute */: return 1 /* Value */; case 145 /* TypeParameter */: case 230 /* InterfaceDeclaration */: case 231 /* TypeAliasDeclaration */: case 163 /* TypeLiteral */: return 2 /* Type */; - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: // If it has no name node, it shares the name with the value declaration below it. return node.name === undefined ? 1 /* Value */ | 2 /* Type */ : 2 /* Type */; - case 264 /* EnumMember */: + case 267 /* EnumMember */: case 229 /* ClassDeclaration */: return 1 /* Value */ | 2 /* Type */; case 233 /* ModuleDeclaration */: @@ -75711,14 +75904,14 @@ var ts; case 244 /* ExportDeclaration */: return 7 /* All */; // An external module can be a Value - case 265 /* SourceFile */: + case 268 /* SourceFile */: return 4 /* Namespace */ | 1 /* Value */; } return 7 /* All */; } ts.getMeaningFromDeclaration = getMeaningFromDeclaration; function getMeaningFromLocation(node) { - if (node.kind === 265 /* SourceFile */) { + if (node.kind === 268 /* SourceFile */) { return 1 /* Value */; } else if (node.parent.kind === 243 /* ExportAssignment */) { @@ -75787,7 +75980,7 @@ var ts; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 201 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 259 /* HeritageClause */) { + if (!isLastClause && root.parent.kind === 201 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 262 /* HeritageClause */) { var decl = root.parent.parent.parent; return (decl.kind === 229 /* ClassDeclaration */ && root.parent.parent.token === 108 /* ImplementsKeyword */) || (decl.kind === 230 /* InterfaceDeclaration */ && root.parent.parent.token === 85 /* ExtendsKeyword */); @@ -75874,8 +76067,8 @@ var ts; switch (node.parent.kind) { case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: - case 261 /* PropertyAssignment */: - case 264 /* EnumMember */: + case 264 /* PropertyAssignment */: + case 267 /* EnumMember */: case 151 /* MethodDeclaration */: case 150 /* MethodSignature */: case 153 /* GetAccessor */: @@ -75897,7 +76090,7 @@ var ts; } ts.isExpressionOfExternalModuleImportEqualsDeclaration = isExpressionOfExternalModuleImportEqualsDeclaration; function getContainerNode(node) { - if (node.kind === 283 /* JSDocTypedefTag */) { + if (node.kind === 286 /* JSDocTypedefTag */) { // This doesn't just apply to the node immediately under the comment, but to everything in its parent's scope. // node.parent = the JSDoc comment, node.parent.parent = the node having the comment. // Then we get parent again in the loop. @@ -75909,7 +76102,7 @@ var ts; return undefined; } switch (node.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 151 /* MethodDeclaration */: case 150 /* MethodSignature */: case 228 /* FunctionDeclaration */: @@ -75927,7 +76120,7 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: return ts.isExternalModule(node) ? "module" /* moduleElement */ : "script" /* scriptElement */; case 233 /* ModuleDeclaration */: return "module" /* moduleElement */; @@ -75958,7 +76151,7 @@ var ts; case 155 /* CallSignature */: return "call" /* callSignatureElement */; case 152 /* Constructor */: return "constructor" /* constructorImplementationElement */; case 145 /* TypeParameter */: return "type parameter" /* typeParameterElement */; - case 264 /* EnumMember */: return "enum member" /* enumMemberElement */; + case 267 /* EnumMember */: return "enum member" /* enumMemberElement */; case 146 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? "property" /* memberVariableElement */ : "parameter" /* parameterElement */; case 237 /* ImportEqualsDeclaration */: case 242 /* ImportSpecifier */: @@ -75966,7 +76159,7 @@ var ts; case 246 /* ExportSpecifier */: case 240 /* NamespaceImport */: return "alias" /* alias */; - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return "type" /* typeElement */; case 194 /* BinaryExpression */: var kind = ts.getSpecialPropertyAssignmentKind(node); @@ -76069,7 +76262,7 @@ var ts; case 241 /* NamedImports */: case 245 /* NamedExports */: return nodeEndsWith(n, 18 /* CloseBraceToken */, sourceFile); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return isCompletedNode(n.block, sourceFile); case 182 /* NewExpression */: if (!n.arguments) { @@ -76123,8 +76316,8 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 22 /* CloseBracketToken */, sourceFile); - case 257 /* CaseClause */: - case 258 /* DefaultClause */: + case 260 /* CaseClause */: + case 261 /* DefaultClause */: // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed return false; case 214 /* ForStatement */: @@ -76314,8 +76507,8 @@ var ts; return n; } var children = n.getChildren(); - for (var _i = 0, children_2 = children; _i < children_2.length; _i++) { - var child = children_2[_i]; + for (var _i = 0, children_3 = children; _i < children_3.length; _i++) { + var child = children_3[_i]; var shouldDiveInChildNode = // previous token is enclosed somewhere in the child (child.pos <= previousToken.pos && child.end > previousToken.end) || @@ -76373,7 +76566,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 265 /* SourceFile */ || ts.isJSDocCommentContainingNode(n)); + ts.Debug.assert(startNode !== undefined || n.kind === 268 /* SourceFile */ || ts.isJSDocCommentContainingNode(n)); // Here we know that none of child token nodes embrace the position, // the only known case is when position is at the end of the file. // Try to find the rightmost token in the file without filtering. @@ -76434,13 +76627,13 @@ var ts; return true; } //
{ |
or
- if (token.kind === 27 /* LessThanToken */ && token.parent.kind === 256 /* JsxExpression */) { + if (token.kind === 27 /* LessThanToken */ && token.parent.kind === 259 /* JsxExpression */) { return true; } //
{ // | // } < /div> - if (token && token.kind === 18 /* CloseBraceToken */ && token.parent.kind === 256 /* JsxExpression */) { + if (token && token.kind === 18 /* CloseBraceToken */ && token.parent.kind === 259 /* JsxExpression */) { return true; } //
|
@@ -76580,7 +76773,7 @@ var ts; // [x, [a, b, c] ] = someExpression // or // {x, a: {a, b, c} } = someExpression - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 261 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 264 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { return true; } } @@ -77632,16 +77825,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); // e.g. "param" pos = tag.tagName.end; switch (tag.kind) { - case 279 /* JSDocParameterTag */: + case 282 /* JSDocParameterTag */: processJSDocParameterTag(tag); break; - case 282 /* JSDocTemplateTag */: + case 285 /* JSDocTemplateTag */: processJSDocTemplateTag(tag); break; - case 281 /* JSDocTypeTag */: + case 284 /* JSDocTypeTag */: processElement(tag.typeExpression); break; - case 280 /* JSDocReturnTag */: + case 283 /* JSDocReturnTag */: processElement(tag.typeExpression); break; } @@ -77743,7 +77936,7 @@ var ts; return 21 /* jsxSelfClosingTagName */; } break; - case 253 /* JsxAttribute */: + case 256 /* JsxAttribute */: if (token.parent.name === token) { return 22 /* jsxAttribute */; } @@ -77774,7 +77967,7 @@ var ts; if (token.parent.kind === 226 /* VariableDeclaration */ || token.parent.kind === 149 /* PropertyDeclaration */ || token.parent.kind === 146 /* Parameter */ || - token.parent.kind === 253 /* JsxAttribute */) { + token.parent.kind === 256 /* JsxAttribute */) { return 5 /* operator */; } } @@ -77791,7 +77984,7 @@ var ts; return 4 /* numericLiteral */; } else if (tokenKind === 9 /* StringLiteral */) { - return token.parent.kind === 253 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; + return token.parent.kind === 256 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; } else if (tokenKind === 12 /* RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. @@ -78349,7 +78542,7 @@ var ts; if (ts.isInString(sourceFile, position)) { return getStringLiteralCompletionEntries(sourceFile, position, typeChecker, compilerOptions, host, log); } - var completionData = getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, options); + var completionData = getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, options, compilerOptions.target); if (!completionData) { return undefined; } @@ -78426,7 +78619,7 @@ var ts; // Try to get a valid display name for this symbol, if we could not find one, then ignore it. // We would like to only show things that can be added after a dot, so for instance numeric properties can // not be accessed with a dot (a.1 <- invalid) - var displayName = getCompletionEntryDisplayNameForSymbol(symbol, target, performCharacterChecks, allowStringLiteral); + var displayName = getCompletionEntryDisplayNameForSymbol(symbol, target, performCharacterChecks, allowStringLiteral, origin); if (!displayName) { return undefined; } @@ -78483,7 +78676,7 @@ var ts; if (!node || node.kind !== 9 /* StringLiteral */) { return undefined; } - if (node.parent.kind === 261 /* PropertyAssignment */ && + if (node.parent.kind === 264 /* PropertyAssignment */ && node.parent.parent.kind === 178 /* ObjectLiteralExpression */ && node.parent.name === node) { // Get quoted name of properties of the object literal expression @@ -78615,7 +78808,7 @@ var ts; } function getSymbolCompletionFromEntryId(typeChecker, log, compilerOptions, sourceFile, position, _a, allSourceFiles) { var name = _a.name, source = _a.source; - var completionData = getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, { includeExternalModuleExports: true }); + var completionData = getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, { includeExternalModuleExports: true }, compilerOptions.target); if (!completionData) { return { type: "none" }; } @@ -78628,13 +78821,17 @@ var ts; // name against 'entryName' (which is known to be good), not building a new // completion entry. var symbol = ts.find(symbols, function (s) { - return getCompletionEntryDisplayNameForSymbol(s, compilerOptions.target, /*performCharacterChecks*/ false, allowStringLiteral) === name - && getSourceFromOrigin(symbolToOriginInfoMap[ts.getSymbolId(s)]) === source; + var origin = symbolToOriginInfoMap[ts.getSymbolId(s)]; + return getCompletionEntryDisplayNameForSymbol(s, compilerOptions.target, /*performCharacterChecks*/ false, allowStringLiteral, origin) === name + && getSourceFromOrigin(origin) === source; }); return symbol ? { type: "symbol", symbol: symbol, location: location, symbolToOriginInfoMap: symbolToOriginInfoMap } : { type: "none" }; } - function getCompletionEntryDetails(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles, host, rulesProvider) { - var name = entryId.name, source = entryId.source; + function getSymbolName(symbol, origin, target) { + return origin && origin.isDefaultExport && symbol.name === "default" ? ts.codefix.moduleSymbolToValidIdentifier(origin.moduleSymbol, target) : symbol.name; + } + function getCompletionEntryDetails(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles, host, rulesProvider, getCanonicalFileName) { + var name = entryId.name; // Compute all the completion symbols again. var symbolCompletion = getSymbolCompletionFromEntryId(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles); switch (symbolCompletion.type) { @@ -78653,10 +78850,10 @@ var ts; } case "symbol": { var symbol = symbolCompletion.symbol, location = symbolCompletion.location, symbolToOriginInfoMap = symbolCompletion.symbolToOriginInfoMap; - var codeActions = getCompletionEntryCodeActions(symbolToOriginInfoMap, symbol, typeChecker, host, compilerOptions, sourceFile, rulesProvider); + var _a = getCompletionEntryCodeActionsAndSourceDisplay(symbolToOriginInfoMap, symbol, typeChecker, host, compilerOptions, sourceFile, rulesProvider, getCanonicalFileName), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; var kindModifiers = ts.SymbolDisplay.getSymbolModifiers(symbol); - var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location, location, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind, tags = _a.tags; - return { name: name, kindModifiers: kindModifiers, kind: symbolKind, displayParts: displayParts, documentation: documentation, tags: tags, codeActions: codeActions, source: source === undefined ? undefined : [ts.textPart(source)] }; + var _b = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location, location, 7 /* All */), displayParts = _b.displayParts, documentation = _b.documentation, symbolKind = _b.symbolKind, tags = _b.tags; + return { name: name, kindModifiers: kindModifiers, kind: symbolKind, displayParts: displayParts, documentation: documentation, tags: tags, codeActions: codeActions, source: sourceDisplay }; } case "none": { // Didn't find a symbol with this name. See if we can find a keyword instead. @@ -78677,31 +78874,33 @@ var ts; } } Completions.getCompletionEntryDetails = getCompletionEntryDetails; - function getCompletionEntryCodeActions(symbolToOriginInfoMap, symbol, checker, host, compilerOptions, sourceFile, rulesProvider) { + function getCompletionEntryCodeActionsAndSourceDisplay(symbolToOriginInfoMap, symbol, checker, host, compilerOptions, sourceFile, rulesProvider, getCanonicalFileName) { var symbolOriginInfo = symbolToOriginInfoMap[ts.getSymbolId(symbol)]; if (!symbolOriginInfo) { - return undefined; + return { codeActions: undefined, sourceDisplay: undefined }; } var moduleSymbol = symbolOriginInfo.moduleSymbol, isDefaultExport = symbolOriginInfo.isDefaultExport; - return ts.codefix.getCodeActionForImport(moduleSymbol, { + var sourceDisplay = [ts.textPart(ts.codefix.getModuleSpecifierForNewImport(sourceFile, moduleSymbol, compilerOptions, getCanonicalFileName, host))]; + var codeActions = ts.codefix.getCodeActionForImport(moduleSymbol, { host: host, checker: checker, newLineCharacter: host.getNewLine(), compilerOptions: compilerOptions, sourceFile: sourceFile, rulesProvider: rulesProvider, - symbolName: symbol.name, - getCanonicalFileName: ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames ? host.useCaseSensitiveFileNames() : false), + symbolName: getSymbolName(symbol, symbolOriginInfo, compilerOptions.target), + getCanonicalFileName: getCanonicalFileName, symbolToken: undefined, kind: isDefaultExport ? 1 /* Default */ : 0 /* Named */, }); + return { sourceDisplay: sourceDisplay, codeActions: codeActions }; } function getCompletionEntrySymbol(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles) { var completion = getSymbolCompletionFromEntryId(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles); return completion.type === "symbol" ? completion.symbol : undefined; } Completions.getCompletionEntrySymbol = getCompletionEntrySymbol; - function getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, options) { + function getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, options, target) { var isJavaScriptFile = ts.isSourceFileJavaScript(sourceFile); var request; var start = ts.timestamp(); @@ -78751,11 +78950,11 @@ var ts; if (tag.tagName.pos <= position && position <= tag.tagName.end) { request = { kind: "JsDocTagName" }; } - if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 267 /* JSDocTypeExpression */) { + if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 270 /* JSDocTypeExpression */) { currentToken = ts.getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ true); if (!currentToken || (!ts.isDeclarationName(currentToken) && - (currentToken.parent.kind !== 284 /* JSDocPropertyTag */ || + (currentToken.parent.kind !== 287 /* JSDocPropertyTag */ || currentToken.parent.name !== currentToken))) { // Use as type location if inside tag's type expression insideJsDocTagTypeExpression = isCurrentlyEditingNode(tag.typeExpression); @@ -78904,11 +79103,11 @@ var ts; return { symbols: symbols, isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, allowStringLiteral: allowStringLiteral, isNewIdentifierLocation: isNewIdentifierLocation, location: location, isRightOfDot: (isRightOfDot || isRightOfOpenTag), request: request, keywordFilters: keywordFilters, symbolToOriginInfoMap: symbolToOriginInfoMap }; function isTagWithTypeExpression(tag) { switch (tag.kind) { - case 279 /* JSDocParameterTag */: - case 284 /* JSDocPropertyTag */: - case 280 /* JSDocReturnTag */: - case 281 /* JSDocTypeTag */: - case 283 /* JSDocTypedefTag */: + case 282 /* JSDocParameterTag */: + case 287 /* JSDocPropertyTag */: + case 283 /* JSDocReturnTag */: + case 284 /* JSDocTypeTag */: + case 286 /* JSDocTypedefTag */: return true; } } @@ -78940,7 +79139,7 @@ var ts; } } // If the module is merged with a value, we must get the type of the class and add its propertes (for inherited static methods). - if (!isTypeLocation && symbol.declarations.some(function (d) { return d.kind !== 265 /* SourceFile */ && d.kind !== 233 /* ModuleDeclaration */ && d.kind !== 232 /* EnumDeclaration */; })) { + if (!isTypeLocation && symbol.declarations.some(function (d) { return d.kind !== 268 /* SourceFile */ && d.kind !== 233 /* ModuleDeclaration */ && d.kind !== 232 /* EnumDeclaration */; })) { addTypeProperties(typeChecker.getTypeOfSymbolAtLocation(symbol, node)); } return; @@ -79049,15 +79248,15 @@ var ts; var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile; if (scopeNode) { isGlobalCompletion = - scopeNode.kind === 265 /* SourceFile */ || + scopeNode.kind === 268 /* SourceFile */ || scopeNode.kind === 196 /* TemplateExpression */ || - scopeNode.kind === 256 /* JsxExpression */ || + scopeNode.kind === 259 /* JsxExpression */ || ts.isStatement(scopeNode); } var symbolMeanings = 793064 /* Type */ | 107455 /* Value */ | 1920 /* Namespace */ | 2097152 /* Alias */; symbols = typeChecker.getSymbolsInScope(scopeNode, symbolMeanings); if (options.includeExternalModuleExports) { - getSymbolsFromOtherSourceFileExports(symbols, previousToken && ts.isIdentifier(previousToken) ? previousToken.text : ""); + getSymbolsFromOtherSourceFileExports(symbols, previousToken && ts.isIdentifier(previousToken) ? previousToken.text : "", target); } filterGlobalCompletion(symbols); return true; @@ -79124,7 +79323,7 @@ var ts; return ts.forEach(exportedSymbols, symbolCanBeReferencedAtTypeLocation); } } - function getSymbolsFromOtherSourceFileExports(symbols, tokenText) { + function getSymbolsFromOtherSourceFileExports(symbols, tokenText, target) { var tokenTextLowerCase = tokenText.toLowerCase(); ts.codefix.forEachExternalModule(typeChecker, allSourceFiles, function (moduleSymbol) { if (moduleSymbol === sourceFile.symbol) { @@ -79140,6 +79339,9 @@ var ts; symbol = localSymbol; name = localSymbol.name; } + else { + name = ts.codefix.moduleSymbolToValidIdentifier(moduleSymbol, target); + } } if (symbol.declarations && symbol.declarations.some(function (d) { return ts.isExportSpecifier(d) && !!d.parent.parent.moduleSpecifier; })) { // Don't add a completion for a re-export, only for the original. @@ -79504,7 +79706,7 @@ var ts; } } // class c { method() { } | method2() { } } - if (location && location.kind === 286 /* SyntaxList */ && ts.isClassLike(location.parent)) { + if (location && location.kind === 289 /* SyntaxList */ && ts.isClassLike(location.parent)) { return location.parent; } return undefined; @@ -79535,13 +79737,13 @@ var ts; case 41 /* SlashToken */: case 71 /* Identifier */: case 179 /* PropertyAccessExpression */: - case 254 /* JsxAttributes */: - case 253 /* JsxAttribute */: - case 255 /* JsxSpreadAttribute */: + case 257 /* JsxAttributes */: + case 256 /* JsxAttribute */: + case 258 /* JsxSpreadAttribute */: if (parent && (parent.kind === 250 /* JsxSelfClosingElement */ || parent.kind === 251 /* JsxOpeningElement */)) { return parent; } - else if (parent.kind === 253 /* JsxAttribute */) { + else if (parent.kind === 256 /* JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -79553,7 +79755,7 @@ var ts; // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 9 /* StringLiteral */: - if (parent && ((parent.kind === 253 /* JsxAttribute */) || (parent.kind === 255 /* JsxSpreadAttribute */))) { + if (parent && ((parent.kind === 256 /* JsxAttribute */) || (parent.kind === 258 /* JsxSpreadAttribute */))) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -79563,8 +79765,8 @@ var ts; break; case 18 /* CloseBraceToken */: if (parent && - parent.kind === 256 /* JsxExpression */ && - parent.parent && parent.parent.kind === 253 /* JsxAttribute */) { + parent.kind === 259 /* JsxExpression */ && + parent.parent && parent.parent.kind === 256 /* JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -79572,7 +79774,7 @@ var ts; // each JsxAttribute can have initializer as JsxExpression return parent.parent.parent.parent; } - if (parent && parent.kind === 255 /* JsxSpreadAttribute */) { + if (parent && parent.kind === 258 /* JsxSpreadAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -79611,7 +79813,7 @@ var ts; case 21 /* OpenBracketToken */: return containingNodeKind === 175 /* ArrayBindingPattern */; // var [x| case 19 /* OpenParenToken */: - return containingNodeKind === 260 /* CatchClause */ || + return containingNodeKind === 263 /* CatchClause */ || isFunctionLikeButNotConstructor(containingNodeKind); case 17 /* OpenBraceToken */: return containingNodeKind === 232 /* EnumDeclaration */ || // enum a { | @@ -79747,8 +79949,8 @@ var ts; for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 261 /* PropertyAssignment */ && - m.kind !== 262 /* ShorthandPropertyAssignment */ && + if (m.kind !== 264 /* PropertyAssignment */ && + m.kind !== 265 /* ShorthandPropertyAssignment */ && m.kind !== 176 /* BindingElement */ && m.kind !== 151 /* MethodDeclaration */ && m.kind !== 153 /* GetAccessor */ && @@ -79845,7 +80047,7 @@ var ts; if (isCurrentlyEditingNode(attr)) { continue; } - if (attr.kind === 253 /* JsxAttribute */) { + if (attr.kind === 256 /* JsxAttribute */) { seenNames.set(attr.name.escapedText, true); } } @@ -79860,8 +80062,8 @@ var ts; * * @return undefined if the name is of external module */ - function getCompletionEntryDisplayNameForSymbol(symbol, target, performCharacterChecks, allowStringLiteral) { - var name = symbol.name; + function getCompletionEntryDisplayNameForSymbol(symbol, target, performCharacterChecks, allowStringLiteral, origin) { + var name = getSymbolName(symbol, origin, target); if (!name) return undefined; // First check of the displayName is not external module; if it is an external module, it is not valid entry @@ -80194,7 +80396,7 @@ var ts; var child = throwStatement; while (child.parent) { var parent_2 = child.parent; - if (ts.isFunctionBlock(parent_2) || parent_2.kind === 265 /* SourceFile */) { + if (ts.isFunctionBlock(parent_2) || parent_2.kind === 268 /* SourceFile */) { return parent_2; } // A throw-statement is only owned by a try-statement if the try-statement has @@ -80271,10 +80473,10 @@ var ts; var container = declaration.parent; switch (container.kind) { case 234 /* ModuleBlock */: - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 207 /* Block */: - case 257 /* CaseClause */: - case 258 /* DefaultClause */: + case 260 /* CaseClause */: + case 261 /* DefaultClause */: // Container is either a class declaration or the declaration is a classDeclaration if (modifierFlag & 128 /* Abstract */) { return declaration.members.concat([declaration]); @@ -80322,7 +80524,7 @@ var ts; return container.kind === 229 /* ClassDeclaration */ || container.kind === 199 /* ClassExpression */; case 84 /* ExportKeyword */: case 124 /* DeclareKeyword */: - return container.kind === 234 /* ModuleBlock */ || container.kind === 265 /* SourceFile */; + return container.kind === 234 /* ModuleBlock */ || container.kind === 268 /* SourceFile */; case 117 /* AbstractKeyword */: return container.kind === 229 /* ClassDeclaration */ || declaration.kind === 229 /* ClassDeclaration */; default: @@ -80745,7 +80947,7 @@ var ts; } else if (!isAvailableThroughGlobal) { var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration); - ts.Debug.assert(sourceFileLike.kind === 265 /* SourceFile */ || sourceFileLike.kind === 233 /* ModuleDeclaration */); + ts.Debug.assert(sourceFileLike.kind === 268 /* SourceFile */ || sourceFileLike.kind === 233 /* ModuleDeclaration */); if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) { addIndirectUsers(sourceFileLike); } @@ -80910,7 +81112,7 @@ var ts; for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) { var referencingFile = sourceFiles_4[_i]; var searchSourceFile = searchModuleSymbol.valueDeclaration; - if (searchSourceFile.kind === 265 /* SourceFile */) { + if (searchSourceFile.kind === 268 /* SourceFile */) { for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) { var ref = _b[_a]; if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) { @@ -80957,7 +81159,7 @@ var ts; } /** Iterates over all statements at the top level or in module declarations. Returns the first truthy result. */ function forEachPossibleImportOrExportStatement(sourceFileLike, action) { - return ts.forEach(sourceFileLike.kind === 265 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { + return ts.forEach(sourceFileLike.kind === 268 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { return action(statement) || (isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action)); }); } @@ -81131,7 +81333,7 @@ var ts; if (parent.kind === 226 /* VariableDeclaration */) { var p = parent; return p.name !== node ? undefined : - p.parent.kind === 260 /* CatchClause */ ? undefined : p.parent.parent.kind === 208 /* VariableStatement */ ? p.parent.parent : undefined; + p.parent.kind === 263 /* CatchClause */ ? undefined : p.parent.parent.kind === 208 /* VariableStatement */ ? p.parent.parent : undefined; } else { return parent; @@ -81191,7 +81393,7 @@ var ts; return node.getSourceFile(); } var parent = node.parent; - if (parent.kind === 265 /* SourceFile */) { + if (parent.kind === 268 /* SourceFile */) { return parent; } ts.Debug.assert(parent.kind === 234 /* ModuleBlock */ && isAmbientModuleDeclaration(parent.parent)); @@ -81242,13 +81444,13 @@ var ts; } FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition; function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node) { - if (node.kind === 265 /* SourceFile */) { + if (node.kind === 268 /* SourceFile */) { return undefined; } var checker = program.getTypeChecker(); // If invoked directly on a shorthand property assignment, then return // the declaration of the symbol being assigned (not the symbol being assigned to). - if (node.parent.kind === 262 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 265 /* ShorthandPropertyAssignment */) { var result_5 = []; FindAllReferences.Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_5.push(nodeEntry(node)); }); return result_5; @@ -81285,29 +81487,29 @@ var ts; var info = (function () { switch (def.type) { case "symbol": { - var symbol = def.symbol, node_2 = def.node; - var _a = getDefinitionKindAndDisplayParts(symbol, node_2, checker), displayParts_1 = _a.displayParts, kind_1 = _a.kind; + var symbol = def.symbol, node_3 = def.node; + var _a = getDefinitionKindAndDisplayParts(symbol, node_3, checker), displayParts_1 = _a.displayParts, kind_1 = _a.kind; var name_4 = displayParts_1.map(function (p) { return p.text; }).join(""); - return { node: node_2, name: name_4, kind: kind_1, displayParts: displayParts_1 }; + return { node: node_3, name: name_4, kind: kind_1, displayParts: displayParts_1 }; } case "label": { - var node_3 = def.node; - return { node: node_3, name: node_3.text, kind: "label" /* label */, displayParts: [ts.displayPart(node_3.text, ts.SymbolDisplayPartKind.text)] }; + var node_4 = def.node; + return { node: node_4, name: node_4.text, kind: "label" /* label */, displayParts: [ts.displayPart(node_4.text, ts.SymbolDisplayPartKind.text)] }; } case "keyword": { - var node_4 = def.node; - var name_5 = ts.tokenToString(node_4.kind); - return { node: node_4, name: name_5, kind: "keyword" /* keyword */, displayParts: [{ text: name_5, kind: "keyword" /* keyword */ }] }; + var node_5 = def.node; + var name_5 = ts.tokenToString(node_5.kind); + return { node: node_5, name: name_5, kind: "keyword" /* keyword */, displayParts: [{ text: name_5, kind: "keyword" /* keyword */ }] }; } case "this": { - var node_5 = def.node; - var symbol = checker.getSymbolAtLocation(node_5); - var displayParts_2 = symbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node_5.getSourceFile(), ts.getContainerNode(node_5), node_5).displayParts; - return { node: node_5, name: "this", kind: "var" /* variableElement */, displayParts: displayParts_2 }; + var node_6 = def.node; + var symbol = checker.getSymbolAtLocation(node_6); + var displayParts_2 = symbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node_6.getSourceFile(), ts.getContainerNode(node_6), node_6).displayParts; + return { node: node_6, name: "this", kind: "var" /* variableElement */, displayParts: displayParts_2 }; } case "string": { - var node_6 = def.node; - return { node: node_6, name: node_6.text, kind: "var" /* variableElement */, displayParts: [ts.displayPart(ts.getTextOfNode(node_6), ts.SymbolDisplayPartKind.stringLiteral)] }; + var node_7 = def.node; + return { node: node_7, name: node_7.text, kind: "var" /* variableElement */, displayParts: [ts.displayPart(ts.getTextOfNode(node_7), ts.SymbolDisplayPartKind.stringLiteral)] }; } } })(); @@ -81417,7 +81619,7 @@ var ts; /** Core find-all-references algorithm. Handles special cases before delegating to `getReferencedSymbolsForSymbol`. */ function getReferencedSymbolsForNode(node, program, sourceFiles, cancellationToken, options) { if (options === void 0) { options = {}; } - if (node.kind === 265 /* SourceFile */) { + if (node.kind === 268 /* SourceFile */) { return undefined; } if (!options.implementations) { @@ -81476,7 +81678,7 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; switch (decl.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: // Don't include the source file itself. (This may not be ideal behavior, but awkward to include an entire file as a reference.) break; case 233 /* ModuleDeclaration */: @@ -81773,7 +81975,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (!container || container.kind === 265 /* SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { + if (!container || container.kind === 268 /* SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { // This is a global variable and not an external module, any declaration defined // within this scope is visible outside the file return undefined; @@ -82100,7 +82302,7 @@ var ts; if (refNode.kind !== 71 /* Identifier */) { return; } - if (refNode.parent.kind === 262 /* ShorthandPropertyAssignment */) { + if (refNode.parent.kind === 265 /* ShorthandPropertyAssignment */) { // Go ahead and dereference the shorthand assignment by going to its definition getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference); } @@ -82161,7 +82363,7 @@ var ts; function getContainingClassIfInHeritageClause(node) { if (node && node.parent) { if (node.kind === 201 /* ExpressionWithTypeArguments */ - && node.parent.kind === 259 /* HeritageClause */ + && node.parent.kind === 262 /* HeritageClause */ && ts.isClassLike(node.parent.parent)) { return node.parent.parent; } @@ -82315,7 +82517,7 @@ var ts; staticFlag &= ts.getModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 265 /* SourceFile */: + case 268 /* SourceFile */: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } @@ -82330,7 +82532,7 @@ var ts; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 265 /* SourceFile */) { + if (searchSpaceNode.kind === 268 /* SourceFile */) { ts.forEach(sourceFiles, function (sourceFile) { cancellationToken.throwIfCancellationRequested(); possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this"); @@ -82374,8 +82576,8 @@ var ts; result.push(FindAllReferences.nodeEntry(node)); } break; - case 265 /* SourceFile */: - if (container.kind === 265 /* SourceFile */ && !ts.isExternalModule(container)) { + case 268 /* SourceFile */: + if (container.kind === 268 /* SourceFile */ && !ts.isExternalModule(container)) { result.push(FindAllReferences.nodeEntry(node)); } break; @@ -82398,9 +82600,9 @@ var ts; function getReferencesForStringLiteralInFile(sourceFile, searchText, possiblePositions, references) { for (var _i = 0, possiblePositions_4 = possiblePositions; _i < possiblePositions_4.length; _i++) { var position = possiblePositions_4[_i]; - var node_7 = ts.getTouchingWord(sourceFile, position, /*includeJsDocComment*/ false); - if (node_7 && node_7.kind === 9 /* StringLiteral */ && node_7.text === searchText) { - references.push(FindAllReferences.nodeEntry(node_7, /*isInString*/ true)); + var node_8 = ts.getTouchingWord(sourceFile, position, /*includeJsDocComment*/ false); + if (node_8 && node_8.kind === 9 /* StringLiteral */ && node_8.text === searchText) { + references.push(FindAllReferences.nodeEntry(node_8, /*isInString*/ true)); } } } @@ -82415,7 +82617,7 @@ var ts; // If the location is name of property symbol from object literal destructuring pattern // Search the property symbol // for ( { property: p2 } of elems) { } - if (containingObjectLiteralElement.kind !== 262 /* ShorthandPropertyAssignment */) { + if (containingObjectLiteralElement.kind !== 265 /* ShorthandPropertyAssignment */) { var propertySymbol = getPropertySymbolOfDestructuringAssignment(location, checker); if (propertySymbol) { result.push(propertySymbol); @@ -82796,7 +82998,7 @@ var ts; // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. - if (node.parent.kind === 262 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 265 /* ShorthandPropertyAssignment */) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -83108,7 +83310,7 @@ var ts; forEachUnique(declarations, function (declaration) { for (var _i = 0, _a = ts.getJSDocTags(declaration); _i < _a.length; _i++) { var tag = _a[_i]; - if (tag.kind === 276 /* JSDocTag */) { + if (tag.kind === 279 /* JSDocTag */) { tags.push({ name: tag.tagName.text, text: tag.comment }); } } @@ -83299,7 +83501,7 @@ var ts; : undefined; return { commentOwner: commentOwner, parameters: parameters_1 }; } - case 265 /* SourceFile */: + case 268 /* SourceFile */: return undefined; case 233 /* ModuleDeclaration */: // If in walking up the tree, we hit a a nested namespace declaration, @@ -83484,7 +83686,7 @@ var ts; if (!ts.hasJavaScriptFileExtension(j)) return undefined; var inferredTypingName = ts.removeFileExtension(ts.getBaseFileName(j.toLowerCase())); - var cleanedTypingName = inferredTypingName.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); + var cleanedTypingName = ts.removeMinAndVersionNumbers(inferredTypingName); return safeList.get(cleanedTypingName); }); if (fromFileNames.length) { @@ -84028,7 +84230,7 @@ var ts; if (ts.hasJSDocNodes(node)) { ts.forEach(node.jsDoc, function (jsDoc) { ts.forEach(jsDoc.tags, function (tag) { - if (tag.kind === 283 /* JSDocTypedefTag */) { + if (tag.kind === 286 /* JSDocTypedefTag */) { addLeafNode(tag); } }); @@ -84140,7 +84342,7 @@ var ts; case 187 /* ArrowFunction */: case 199 /* ClassExpression */: return getFunctionOrClassName(node); - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return undefined; @@ -84158,7 +84360,7 @@ var ts; } } switch (node.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" @@ -84183,7 +84385,7 @@ var ts; return "()"; case 157 /* IndexSignature */: return "[]"; - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return ""; @@ -84229,9 +84431,9 @@ var ts; case 232 /* EnumDeclaration */: case 230 /* InterfaceDeclaration */: case 233 /* ModuleDeclaration */: - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 231 /* TypeAliasDeclaration */: - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return true; case 152 /* Constructor */: case 151 /* MethodDeclaration */: @@ -84252,7 +84454,7 @@ var ts; } switch (navigationBarNodeKind(item.parent)) { case 234 /* ModuleBlock */: - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 151 /* MethodDeclaration */: case 152 /* Constructor */: return true; @@ -84336,7 +84538,7 @@ var ts; return !member.name || member.name.kind === 144 /* ComputedPropertyName */; } function getNodeSpan(node) { - return node.kind === 265 /* SourceFile */ + return node.kind === 268 /* SourceFile */ ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromNode(node, curSourceFile); } @@ -84357,7 +84559,7 @@ var ts; node.parent.operatorToken.kind === 58 /* EqualsToken */) { return nodeText(node.parent.left).replace(whiteSpaceRegex, ""); } - else if (node.parent.kind === 261 /* PropertyAssignment */ && node.parent.name) { + else if (node.parent.kind === 264 /* PropertyAssignment */ && node.parent.name) { return nodeText(node.parent.name); } else if (ts.getModifierFlags(node) & 512 /* Default */) { @@ -84517,7 +84719,7 @@ var ts; parent.kind === 211 /* IfStatement */ || parent.kind === 213 /* WhileStatement */ || parent.kind === 220 /* WithStatement */ || - parent.kind === 260 /* CatchClause */) { + parent.kind === 263 /* CatchClause */) { addOutliningSpan(parent, openBrace_1, closeBrace_1, autoCollapse(n), /*useFullStart*/ true); break; } @@ -85871,7 +86073,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node, position, sourceFile) { - for (var n = node; n.kind !== 265 /* SourceFile */; n = n.parent) { + for (var n = node; n.kind !== 268 /* SourceFile */; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -86300,7 +86502,7 @@ var ts; symbolKind = "enum member" /* enumMemberElement */; addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 264 /* EnumMember */) { + if (declaration.kind === 267 /* EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -86406,7 +86608,7 @@ var ts; // For some special property access expressions like `exports.foo = foo` or `module.exports.foo = foo` // there documentation comments might be attached to the right hand side symbol of their declarations. // The pattern of such special property access is that the parent symbol is the symbol of the file. - if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 265 /* SourceFile */; })) { + if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 268 /* SourceFile */; })) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (!declaration.parent || declaration.parent.kind !== 194 /* BinaryExpression */) { @@ -86501,7 +86703,7 @@ var ts; // If the parent is not sourceFile or module block it is local variable for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { // Reached source file or module block - if (parent.kind === 265 /* SourceFile */ || parent.kind === 234 /* ModuleBlock */) { + if (parent.kind === 268 /* SourceFile */ || parent.kind === 234 /* ModuleBlock */) { return false; } } @@ -86721,7 +86923,7 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 253 /* JsxAttribute */: + case 256 /* JsxAttribute */: case 251 /* JsxOpeningElement */: case 252 /* JsxClosingElement */: case 250 /* JsxSelfClosingElement */: @@ -87434,7 +87636,7 @@ var ts; case 226 /* VariableDeclaration */: // equal in p = 0; case 146 /* Parameter */: - case 264 /* EnumMember */: + case 267 /* EnumMember */: case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: return context.currentTokenSpan.kind === 58 /* EqualsToken */ || context.nextTokenSpan.kind === 58 /* EqualsToken */; @@ -87540,7 +87742,7 @@ var ts; case 229 /* ClassDeclaration */: case 233 /* ModuleDeclaration */: case 232 /* EnumDeclaration */: - case 260 /* CatchClause */: + case 263 /* CatchClause */: case 234 /* ModuleBlock */: case 221 /* SwitchStatement */: return true; @@ -87567,7 +87769,7 @@ var ts; case 220 /* WithStatement */: // TODO // case SyntaxKind.ElseClause: - case 260 /* CatchClause */: + case 263 /* CatchClause */: return true; default: return false; @@ -87601,13 +87803,13 @@ var ts; return context.contextNode.kind !== 249 /* JsxElement */; }; Rules.IsJsxExpressionContext = function (context) { - return context.contextNode.kind === 256 /* JsxExpression */; + return context.contextNode.kind === 259 /* JsxExpression */; }; Rules.IsNextTokenParentJsxAttribute = function (context) { - return context.nextTokenParent.kind === 253 /* JsxAttribute */; + return context.nextTokenParent.kind === 256 /* JsxAttribute */; }; Rules.IsJsxAttributeContext = function (context) { - return context.contextNode.kind === 253 /* JsxAttribute */; + return context.contextNode.kind === 256 /* JsxAttribute */; }; Rules.IsJsxSelfClosingElementContext = function (context) { return context.contextNode.kind === 250 /* JsxSelfClosingElement */; @@ -88136,11 +88338,11 @@ var ts; case 233 /* ModuleDeclaration */: var body = parent.body; return body && body.kind === 234 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node); - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 207 /* Block */: case 234 /* ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -89237,7 +89439,7 @@ var ts; // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually // - parent and child are not on the same line var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && - (parent.kind === 265 /* SourceFile */ || !parentAndChildShareLine); + (parent.kind === 268 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Unknown */; } @@ -89449,8 +89651,8 @@ var ts; case 172 /* MappedType */: case 165 /* TupleType */: case 235 /* CaseBlock */: - case 258 /* DefaultClause */: - case 257 /* CaseClause */: + case 261 /* DefaultClause */: + case 260 /* CaseClause */: case 185 /* ParenthesizedExpression */: case 179 /* PropertyAccessExpression */: case 181 /* CallExpression */: @@ -89464,7 +89666,7 @@ var ts; case 174 /* ObjectBindingPattern */: case 251 /* JsxOpeningElement */: case 250 /* JsxSelfClosingElement */: - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: case 150 /* MethodSignature */: case 155 /* CallSignature */: case 156 /* ConstructSignature */: @@ -89478,7 +89680,7 @@ var ts; case 241 /* NamedImports */: case 246 /* ExportSpecifier */: case 242 /* ImportSpecifier */: - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: case 149 /* PropertyDeclaration */: return true; } @@ -90565,11 +90767,11 @@ var ts; if (!ts.isStringLiteral(token)) { throw ts.Debug.fail(); // These errors should only happen on the module name. } - var action = tryGetCodeActionForInstallPackageTypes(context.host, token.text); + var action = tryGetCodeActionForInstallPackageTypes(context.host, sourceFile.fileName, token.text); return action && [action]; }, }); - function tryGetCodeActionForInstallPackageTypes(host, moduleName) { + function tryGetCodeActionForInstallPackageTypes(host, fileName, moduleName) { var packageName = ts.getPackageName(moduleName).packageName; if (!host.isKnownTypesPackageName(packageName)) { // If !registry, registry not available yet, can't do anything. @@ -90579,7 +90781,7 @@ var ts; return { description: "Install '" + typesPackageName + "'", changes: [], - commands: [{ type: "install package", packageName: typesPackageName }], + commands: [{ type: "install package", file: fileName, packageName: typesPackageName }], }; } codefix.tryGetCodeActionForInstallPackageTypes = tryGetCodeActionForInstallPackageTypes; @@ -90991,7 +91193,7 @@ var ts; var original = ts.getTextOfNode(jsdocType); var type = checker.getTypeFromTypeNode(jsdocType); var actions = [createAction(jsdocType, sourceFile.fileName, original, checker.typeToString(type, /*enclosingDeclaration*/ undefined, 8 /* NoTruncation */))]; - if (jsdocType.kind === 270 /* JSDocNullableType */) { + if (jsdocType.kind === 273 /* JSDocNullableType */) { // for nullable types, suggest the flow-compatible `T | null | undefined` // in addition to the jsdoc/closure-compatible `T | null` var replacementWithUndefined = checker.typeToString(checker.getNullableType(type, 2048 /* Undefined */), /*enclosingDeclaration*/ undefined, 8 /* NoTruncation */); @@ -91210,10 +91412,12 @@ var ts; return parent; case 248 /* ExternalModuleReference */: return parent.parent; - default: - ts.Debug.assert(parent.kind === 244 /* ExportDeclaration */); + case 244 /* ExportDeclaration */: + case 181 /* CallExpression */:// For "require()" calls // Ignore these, can't add imports to them. return undefined; + default: + ts.Debug.fail(); } } function getCodeActionForNewImport(context, moduleSpecifier) { @@ -91265,6 +91469,7 @@ var ts; options.rootDirs && tryGetModuleNameFromRootDirs(options.rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName) || ts.removeFileExtension(getRelativePath(moduleFileName, sourceDirectory, getCanonicalFileName)); } + codefix.getModuleSpecifierForNewImport = getModuleSpecifierForNewImport; function tryGetModuleNameFromAmbientModule(moduleSymbol) { var decl = moduleSymbol.valueDeclaration; if (ts.isModuleDeclaration(decl) && ts.isStringLiteral(decl.name)) { @@ -91557,9 +91762,10 @@ var ts; var defaultExport = checker.tryGetMemberInModuleExports("default", moduleSymbol); if (defaultExport) { var localSymbol = ts.getLocalSymbolForExportDefault(defaultExport); - if (localSymbol && localSymbol.escapedName === symbolName && checkSymbolHasMeaning(localSymbol, currentTokenMeaning)) { + if ((localSymbol && localSymbol.escapedName === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, context.compilerOptions.target) === symbolName) + && checkSymbolHasMeaning(localSymbol || defaultExport, currentTokenMeaning)) { // check if this symbol is already used - var symbolId = ts.getUniqueSymbolId(localSymbol, checker); + var symbolId = ts.getUniqueSymbolId(localSymbol || defaultExport, checker); symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol, __assign({}, context, { kind: 1 /* Default */ }))); } } @@ -91589,6 +91795,36 @@ var ts; } } codefix.forEachExternalModule = forEachExternalModule; + function moduleSymbolToValidIdentifier(moduleSymbol, target) { + return moduleSpecifierToValidIdentifier(ts.removeFileExtension(ts.getBaseFileName(moduleSymbol.name)), target); + } + codefix.moduleSymbolToValidIdentifier = moduleSymbolToValidIdentifier; + function moduleSpecifierToValidIdentifier(moduleSpecifier, target) { + var res = ""; + var lastCharWasValid = true; + var firstCharCode = moduleSpecifier.charCodeAt(0); + if (ts.isIdentifierStart(firstCharCode, target)) { + res += String.fromCharCode(firstCharCode); + } + else { + lastCharWasValid = false; + } + for (var i = 1; i < moduleSpecifier.length; i++) { + var ch = moduleSpecifier.charCodeAt(i); + var isValid = ts.isIdentifierPart(ch, target); + if (isValid) { + var char = String.fromCharCode(ch); + if (!lastCharWasValid) { + char = char.toUpperCase(); + } + res += char; + } + lastCharWasValid = isValid; + } + // Need `|| "_"` to ensure result isn't empty. + var token = ts.stringToToken(res); + return token === undefined || !ts.isNonContextualKeyword(token) ? res || "_" : "_" + res; + } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); /* @internal */ @@ -92170,8 +92406,8 @@ var ts; case 194 /* BinaryExpression */: inferTypeFromBinaryExpressionContext(node, node.parent, checker, usageContext); break; - case 257 /* CaseClause */: - case 258 /* DefaultClause */: + case 260 /* CaseClause */: + case 261 /* DefaultClause */: inferTypeFromSwitchStatementLabelContext(node.parent, checker, usageContext); break; case 181 /* CallExpression */: @@ -92606,18 +92842,18 @@ var ts; return undefined; } switch (node.kind) { - case 268 /* JSDocAllType */: - case 269 /* JSDocUnknownType */: + case 271 /* JSDocAllType */: + case 272 /* JSDocUnknownType */: return ts.createTypeReferenceNode("any", ts.emptyArray); - case 272 /* JSDocOptionalType */: + case 275 /* JSDocOptionalType */: return transformJSDocOptionalType(node); - case 271 /* JSDocNonNullableType */: + case 274 /* JSDocNonNullableType */: return transformJSDocType(node.type); - case 270 /* JSDocNullableType */: + case 273 /* JSDocNullableType */: return transformJSDocNullableType(node); - case 274 /* JSDocVariadicType */: + case 277 /* JSDocVariadicType */: return transformJSDocVariadicType(node); - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: return transformJSDocFunctionType(node); case 146 /* Parameter */: return transformJSDocParameter(node); @@ -92644,7 +92880,7 @@ var ts; } function transformJSDocParameter(node) { var index = node.parent.parameters.indexOf(node); - var isRest = node.type.kind === 274 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; + var isRest = node.type.kind === 277 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; var name = node.name || (isRest ? "rest" : "arg" + index); var dotdotdot = isRest ? ts.createToken(24 /* DotDotDotToken */) : node.dotDotDotToken; return ts.createParameter(node.decorators, node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer); @@ -93235,7 +93471,7 @@ var ts; switch (node.kind) { case 228 /* FunctionDeclaration */: case 229 /* ClassDeclaration */: - if (node.parent.kind === 265 /* SourceFile */ && node.parent.externalModuleIndicator === undefined) { + if (node.parent.kind === 268 /* SourceFile */ && node.parent.externalModuleIndicator === undefined) { // You cannot extract global declarations (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.FunctionWillNotBeVisibleInTheNewScope)); } @@ -93259,7 +93495,7 @@ var ts; permittedJumps = 4 /* Return */; } break; - case 257 /* CaseClause */: + case 260 /* CaseClause */: // allow unlabeled break inside case clauses permittedJumps |= 1 /* Break */; break; @@ -93372,7 +93608,7 @@ var ts; // * Module/namespace or source file if (isScope(current)) { scopes.push(current); - if (current.kind === 265 /* SourceFile */) { + if (current.kind === 268 /* SourceFile */) { return scopes; } } @@ -94448,7 +94684,7 @@ var ts; */ function isExtractableExpression(node) { switch (node.parent.kind) { - case 264 /* EnumMember */: + case 267 /* EnumMember */: return false; } switch (node.kind) { @@ -94469,9 +94705,9 @@ var ts; function isBlockLike(node) { switch (node.kind) { case 207 /* Block */: - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 234 /* ModuleBlock */: - case 257 /* CaseClause */: + case 260 /* CaseClause */: return true; default: return false; @@ -94530,7 +94766,7 @@ var ts; var file = context.file, startPosition = context.startPosition; var node = ts.getTokenAtPosition(file, startPosition, /*includeJsDocComment*/ false); if (ts.isStringLiteral(node) && isModuleIdentifier(node) && ts.getResolvedModule(file, node.text) === undefined) { - return ts.codefix.tryGetCodeActionForInstallPackageTypes(context.host, node.text); + return ts.codefix.tryGetCodeActionForInstallPackageTypes(context.host, file.fileName, node.text); } } function isModuleIdentifier(node) { @@ -94646,7 +94882,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(286 /* SyntaxList */, nodes.pos, nodes.end, this); + var list = createNode(289 /* SyntaxList */, nodes.pos, nodes.end, this); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_9 = nodes; _i < nodes_9.length; _i++) { @@ -94670,9 +94906,9 @@ var ts; } if (ts.isJSDocCommentContainingNode(this)) { /** Don't add trivia for "tokens" since this is in a comment. */ - var children_3 = []; - this.forEachChild(function (child) { children_3.push(child); }); - this._children = children_3; + var children_4 = []; + this.forEachChild(function (child) { children_4.push(child); }); + this._children = children_4; return; } var children = []; @@ -94728,7 +94964,7 @@ var ts; if (!children.length) { return undefined; } - var child = ts.find(children, function (kid) { return kid.kind < 267 /* FirstJSDocNode */ || kid.kind > 285 /* LastJSDocNode */; }); + var child = ts.find(children, function (kid) { return kid.kind < 270 /* FirstJSDocNode */ || kid.kind > 288 /* LastJSDocNode */; }); return child.kind < 143 /* FirstNode */ ? child : child.getFirstToken(sourceFile); @@ -95066,7 +95302,7 @@ var ts; } } // falls through - case 264 /* EnumMember */: + case 267 /* EnumMember */: case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: addDeclaration(node); @@ -95608,7 +95844,7 @@ var ts; function getCompletionEntryDetails(fileName, position, name, formattingOptions, source) { synchronizeHostData(); var ruleProvider = formattingOptions ? getRuleProvider(formattingOptions) : undefined; - return ts.Completions.getCompletionEntryDetails(program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position, { name: name, source: source }, program.getSourceFiles(), host, ruleProvider); + return ts.Completions.getCompletionEntryDetails(program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position, { name: name, source: source }, program.getSourceFiles(), host, ruleProvider, getCanonicalFileName); } function getCompletionEntrySymbol(fileName, position, name, source) { synchronizeHostData(); @@ -95969,12 +96205,15 @@ var ts; return ts.codefix.getFixes({ errorCode: errorCode, sourceFile: sourceFile, span: span, program: program, newLineCharacter: newLineCharacter, host: host, cancellationToken: cancellationToken, rulesProvider: rulesProvider }); }); } - function applyCodeActionCommand(fileName, action) { - fileName = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + function applyCodeActionCommand(fileName, actionOrUndefined) { + var action = typeof fileName === "string" ? actionOrUndefined : fileName; + return ts.isArray(action) ? Promise.all(action.map(applySingleCodeActionCommand)) : applySingleCodeActionCommand(action); + } + function applySingleCodeActionCommand(action) { switch (action.type) { case "install package": return host.installPackage - ? host.installPackage({ fileName: fileName, packageName: action.packageName }) + ? host.installPackage({ fileName: ts.toPath(action.file, currentDirectory, getCanonicalFileName), packageName: action.packageName }) : Promise.reject("Host does not implement `installPackage`"); default: ts.Debug.fail(); @@ -96258,10 +96497,10 @@ var ts; } function isObjectLiteralElement(node) { switch (node.kind) { - case 253 /* JsxAttribute */: - case 255 /* JsxSpreadAttribute */: - case 261 /* PropertyAssignment */: - case 262 /* ShorthandPropertyAssignment */: + case 256 /* JsxAttribute */: + case 258 /* JsxSpreadAttribute */: + case 264 /* PropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: case 151 /* MethodDeclaration */: case 153 /* GetAccessor */: case 154 /* SetAccessor */: @@ -96283,7 +96522,7 @@ var ts; // falls through case 71 /* Identifier */: return isObjectLiteralElement(node.parent) && - (node.parent.parent.kind === 178 /* ObjectLiteralExpression */ || node.parent.parent.kind === 254 /* JsxAttributes */) && + (node.parent.parent.kind === 178 /* ObjectLiteralExpression */ || node.parent.parent.kind === 257 /* JsxAttributes */) && node.parent.name === node ? node.parent : undefined; } return undefined; @@ -96428,7 +96667,7 @@ var ts; // falls through case 234 /* ModuleBlock */: return spanInBlock(node); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return spanInBlock(node.block); case 210 /* ExpressionStatement */: // span on the expression @@ -96466,8 +96705,8 @@ var ts; case 221 /* SwitchStatement */: // span on switch(...) return textSpanEndingAtNextToken(node, node.expression); - case 257 /* CaseClause */: - case 258 /* DefaultClause */: + case 260 /* CaseClause */: + case 261 /* DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); case 224 /* TryStatement */: @@ -96496,7 +96735,7 @@ var ts; // falls through case 229 /* ClassDeclaration */: case 232 /* EnumDeclaration */: - case 264 /* EnumMember */: + case 267 /* EnumMember */: case 176 /* BindingElement */: // span on complete node return textSpan(node); @@ -96554,8 +96793,8 @@ var ts; // [a, b, ...c] or { a, b } or { d: x } from destructuring pattern if ((node.kind === 71 /* Identifier */ || node.kind === 198 /* SpreadElement */ || - node.kind === 261 /* PropertyAssignment */ || - node.kind === 262 /* ShorthandPropertyAssignment */) && + node.kind === 264 /* PropertyAssignment */ || + node.kind === 265 /* ShorthandPropertyAssignment */) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { return textSpan(node); } @@ -96606,7 +96845,7 @@ var ts; } } // If this is name of property assignment, set breakpoint in the initializer - if (node.parent.kind === 261 /* PropertyAssignment */ && + if (node.parent.kind === 264 /* PropertyAssignment */ && node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); @@ -96832,7 +97071,7 @@ var ts; return textSpan(node); } // falls through - case 260 /* CatchClause */: + case 263 /* CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); case 235 /* CaseBlock */: // breakpoint in last statement of the last clause @@ -96911,7 +97150,7 @@ var ts; function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration if (ts.isFunctionLike(node.parent) || - node.parent.kind === 261 /* PropertyAssignment */ || + node.parent.kind === 264 /* PropertyAssignment */ || node.parent.kind === 146 /* Parameter */) { return spanInPreviousNode(node); } diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts index 3b0f26c9b37..b32ffcb44f1 100644 --- a/lib/typescriptServices.d.ts +++ b/lib/typescriptServices.d.ts @@ -313,46 +313,49 @@ declare namespace ts { JsxSelfClosingElement = 250, JsxOpeningElement = 251, JsxClosingElement = 252, - JsxAttribute = 253, - JsxAttributes = 254, - JsxSpreadAttribute = 255, - JsxExpression = 256, - CaseClause = 257, - DefaultClause = 258, - HeritageClause = 259, - CatchClause = 260, - PropertyAssignment = 261, - ShorthandPropertyAssignment = 262, - SpreadAssignment = 263, - EnumMember = 264, - SourceFile = 265, - Bundle = 266, - JSDocTypeExpression = 267, - JSDocAllType = 268, - JSDocUnknownType = 269, - JSDocNullableType = 270, - JSDocNonNullableType = 271, - JSDocOptionalType = 272, - JSDocFunctionType = 273, - JSDocVariadicType = 274, - JSDocComment = 275, - JSDocTag = 276, - JSDocAugmentsTag = 277, - JSDocClassTag = 278, - JSDocParameterTag = 279, - JSDocReturnTag = 280, - JSDocTypeTag = 281, - JSDocTemplateTag = 282, - JSDocTypedefTag = 283, - JSDocPropertyTag = 284, - JSDocTypeLiteral = 285, - SyntaxList = 286, - NotEmittedStatement = 287, - PartiallyEmittedExpression = 288, - CommaListExpression = 289, - MergeDeclarationMarker = 290, - EndOfDeclarationMarker = 291, - Count = 292, + JsxFragment = 253, + JsxOpeningFragment = 254, + JsxClosingFragment = 255, + JsxAttribute = 256, + JsxAttributes = 257, + JsxSpreadAttribute = 258, + JsxExpression = 259, + CaseClause = 260, + DefaultClause = 261, + HeritageClause = 262, + CatchClause = 263, + PropertyAssignment = 264, + ShorthandPropertyAssignment = 265, + SpreadAssignment = 266, + EnumMember = 267, + SourceFile = 268, + Bundle = 269, + JSDocTypeExpression = 270, + JSDocAllType = 271, + JSDocUnknownType = 272, + JSDocNullableType = 273, + JSDocNonNullableType = 274, + JSDocOptionalType = 275, + JSDocFunctionType = 276, + JSDocVariadicType = 277, + JSDocComment = 278, + JSDocTag = 279, + JSDocAugmentsTag = 280, + JSDocClassTag = 281, + JSDocParameterTag = 282, + JSDocReturnTag = 283, + JSDocTypeTag = 284, + JSDocTemplateTag = 285, + JSDocTypedefTag = 286, + JSDocPropertyTag = 287, + JSDocTypeLiteral = 288, + SyntaxList = 289, + NotEmittedStatement = 290, + PartiallyEmittedExpression = 291, + CommaListExpression = 292, + MergeDeclarationMarker = 293, + EndOfDeclarationMarker = 294, + Count = 295, FirstAssignment = 58, LastAssignment = 70, FirstCompoundAssignment = 59, @@ -378,10 +381,10 @@ declare namespace ts { FirstBinaryOperator = 27, LastBinaryOperator = 70, FirstNode = 143, - FirstJSDocNode = 267, - LastJSDocNode = 285, - FirstJSDocTagNode = 276, - LastJSDocTagNode = 285, + FirstJSDocNode = 270, + LastJSDocNode = 288, + FirstJSDocTagNode = 279, + LastJSDocTagNode = 288, } enum NodeFlags { None = 0, @@ -1061,6 +1064,20 @@ declare namespace ts { tagName: JsxTagNameExpression; attributes: JsxAttributes; } + interface JsxFragment extends PrimaryExpression { + kind: SyntaxKind.JsxFragment; + openingFragment: JsxOpeningFragment; + children: NodeArray; + closingFragment: JsxClosingFragment; + } + interface JsxOpeningFragment extends Expression { + kind: SyntaxKind.JsxOpeningFragment; + parent?: JsxFragment; + } + interface JsxClosingFragment extends Expression { + kind: SyntaxKind.JsxClosingFragment; + parent?: JsxFragment; + } interface JsxAttribute extends ObjectLiteralElement { kind: SyntaxKind.JsxAttribute; parent?: JsxAttributes; @@ -1088,7 +1105,7 @@ declare namespace ts { containsOnlyWhiteSpaces: boolean; parent?: JsxElement; } - type JsxChild = JsxText | JsxExpression | JsxElement | JsxSelfClosingElement; + type JsxChild = JsxText | JsxExpression | JsxElement | JsxSelfClosingElement | JsxFragment; interface Statement extends Node { _statementBrand: any; } @@ -3056,6 +3073,9 @@ declare namespace ts { function isJsxSelfClosingElement(node: Node): node is JsxSelfClosingElement; function isJsxOpeningElement(node: Node): node is JsxOpeningElement; function isJsxClosingElement(node: Node): node is JsxClosingElement; + function isJsxFragment(node: Node): node is JsxFragment; + function isJsxOpeningFragment(node: Node): node is JsxOpeningFragment; + function isJsxClosingFragment(node: Node): node is JsxClosingFragment; function isJsxAttribute(node: Node): node is JsxAttribute; function isJsxAttributes(node: Node): node is JsxAttributes; function isJsxSpreadAttribute(node: Node): node is JsxSpreadAttribute; @@ -3447,6 +3467,8 @@ declare namespace ts { function updateJsxOpeningElement(node: JsxOpeningElement, tagName: JsxTagNameExpression, attributes: JsxAttributes): JsxOpeningElement; function createJsxClosingElement(tagName: JsxTagNameExpression): JsxClosingElement; function updateJsxClosingElement(node: JsxClosingElement, tagName: JsxTagNameExpression): JsxClosingElement; + function createJsxFragment(openingFragment: JsxOpeningFragment, children: ReadonlyArray, closingFragment: JsxClosingFragment): JsxFragment; + function updateJsxFragment(node: JsxFragment, openingFragment: JsxOpeningFragment, children: ReadonlyArray, closingFragment: JsxClosingFragment): JsxFragment; function createJsxAttribute(name: Identifier, initializer: StringLiteral | JsxExpression): JsxAttribute; function updateJsxAttribute(node: JsxAttribute, name: Identifier, initializer: StringLiteral | JsxExpression): JsxAttribute; function createJsxAttributes(properties: ReadonlyArray): JsxAttributes; @@ -3945,7 +3967,15 @@ declare namespace ts { isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean; getSpanOfEnclosingComment(fileName: string, position: number, onlyMultiLine: boolean): TextSpan; getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[], formatOptions: FormatCodeSettings): CodeAction[]; + applyCodeActionCommand(action: CodeActionCommand): Promise; + applyCodeActionCommand(action: CodeActionCommand[]): Promise; + applyCodeActionCommand(action: CodeActionCommand | CodeActionCommand[]): Promise; + /** @deprecated `fileName` will be ignored */ applyCodeActionCommand(fileName: string, action: CodeActionCommand): Promise; + /** @deprecated `fileName` will be ignored */ + applyCodeActionCommand(fileName: string, action: CodeActionCommand[]): Promise; + /** @deprecated `fileName` will be ignored */ + applyCodeActionCommand(fileName: string, action: CodeActionCommand | CodeActionCommand[]): Promise; getApplicableRefactors(fileName: string, positionOrRaneg: number | TextRange): ApplicableRefactorInfo[]; getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string): RefactorEditInfo | undefined; getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput; diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index 4d47deeb416..a1d0b8ad25b 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -313,56 +313,59 @@ var ts; SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 250] = "JsxSelfClosingElement"; SyntaxKind[SyntaxKind["JsxOpeningElement"] = 251] = "JsxOpeningElement"; SyntaxKind[SyntaxKind["JsxClosingElement"] = 252] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 253] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxAttributes"] = 254] = "JsxAttributes"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 255] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 256] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxFragment"] = 253] = "JsxFragment"; + SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 254] = "JsxOpeningFragment"; + SyntaxKind[SyntaxKind["JsxClosingFragment"] = 255] = "JsxClosingFragment"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 256] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxAttributes"] = 257] = "JsxAttributes"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 258] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 259] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 257] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 258] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 259] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 260] = "CatchClause"; + SyntaxKind[SyntaxKind["CaseClause"] = 260] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 261] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 262] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 263] = "CatchClause"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 261] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 262] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 263] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 264] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 265] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 266] = "SpreadAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 264] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 267] = "EnumMember"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 265] = "SourceFile"; - SyntaxKind[SyntaxKind["Bundle"] = 266] = "Bundle"; + SyntaxKind[SyntaxKind["SourceFile"] = 268] = "SourceFile"; + SyntaxKind[SyntaxKind["Bundle"] = 269] = "Bundle"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 267] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 270] = "JSDocTypeExpression"; // The * type - SyntaxKind[SyntaxKind["JSDocAllType"] = 268] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 271] = "JSDocAllType"; // The ? type - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 269] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 270] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 271] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 272] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 273] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 274] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocComment"] = 275] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocTag"] = 276] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 277] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocClassTag"] = 278] = "JSDocClassTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 279] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 280] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 281] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 282] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 283] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 284] = "JSDocPropertyTag"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 285] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 272] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 273] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 274] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 275] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 276] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 277] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 278] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTag"] = 279] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 280] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocClassTag"] = 281] = "JSDocClassTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 282] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 283] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 284] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 285] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 286] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 287] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 288] = "JSDocTypeLiteral"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 286] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 289] = "SyntaxList"; // Transformation nodes - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 287] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 288] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["CommaListExpression"] = 289] = "CommaListExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 290] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 291] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 290] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 291] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["CommaListExpression"] = 292] = "CommaListExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 293] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 294] = "EndOfDeclarationMarker"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 292] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 295] = "Count"; // Markers SyntaxKind[SyntaxKind["FirstAssignment"] = 58] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 70] = "LastAssignment"; @@ -389,10 +392,12 @@ var ts; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 27] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 70] = "LastBinaryOperator"; SyntaxKind[SyntaxKind["FirstNode"] = 143] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 267] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 285] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 276] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 285] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 270] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 288] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 279] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 288] = "LastJSDocTagNode"; + /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 117] = "FirstContextualKeyword"; + /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 142] = "LastContextualKeyword"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); var NodeFlags; (function (NodeFlags) { @@ -2513,6 +2518,10 @@ var ts; return Array.isArray ? Array.isArray(value) : value instanceof Array; } ts.isArray = isArray; + function toArray(value) { + return isArray(value) ? value : [value]; + } + ts.toArray = toArray; /** * Tests whether a value is string */ @@ -3555,6 +3564,16 @@ var ts; return (removeFileExtension(path) + newExtension); } ts.changeExtension = changeExtension; + /** + * Takes a string like "jquery-min.4.2.3" and returns "jquery" + */ + function removeMinAndVersionNumbers(fileName) { + // Match a "." or "-" followed by a version number or 'min' at the end of the name + var trailingMinOrVersion = /[.-]((min)|(\d+(\.\d+)*))$/; + // The "min" or version may both be present, in either order, so try applying the above twice. + return fileName.replace(trailingMinOrVersion, "").replace(trailingMinOrVersion, ""); + } + ts.removeMinAndVersionNumbers = removeMinAndVersionNumbers; function Symbol(flags, name) { this.flags = flags; this.escapedName = name; @@ -3964,10 +3983,9 @@ var ts; function addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath) { var existingResult = getCachedFileSystemEntries(fileOrDirectoryPath); if (existingResult) { - // This was a folder already present, remove it if this doesnt exist any more - if (!host.directoryExists(fileOrDirectory)) { - cachedReadDirectoryResult.delete(fileOrDirectoryPath); - } + // Just clear the cache for now + // For now just clear the cache, since this could mean that multiple level entries might need to be re-evaluated + clearCache(); } else { // This was earlier a file (hence not in cached directory contents) @@ -3980,8 +3998,14 @@ var ts; fileExists: host.fileExists(fileOrDirectoryPath), directoryExists: host.directoryExists(fileOrDirectoryPath) }; - updateFilesOfFileSystemEntry(parentResult, baseName, fsQueryResult.fileExists); - updateFileSystemEntry(parentResult.directories, baseName, fsQueryResult.directoryExists); + if (fsQueryResult.directoryExists || hasEntry(parentResult.directories, baseName)) { + // Folder added or removed, clear the cache instead of updating the folder and its structure + clearCache(); + } + else { + // No need to update the directory structure, just files + updateFilesOfFileSystemEntry(parentResult, baseName, fsQueryResult.fileExists); + } return fsQueryResult; } } @@ -5394,6 +5418,9 @@ var ts; super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: diag(17011, ts.DiagnosticCategory.Error, "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", "'super' must be called before accessing a property of 'super' in the constructor of a derived class."), _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2: diag(17012, ts.DiagnosticCategory.Error, "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012", "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'?"), Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: diag(17013, ts.DiagnosticCategory.Error, "Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013", "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor."), + JSX_fragment_has_no_corresponding_closing_tag: diag(17014, ts.DiagnosticCategory.Error, "JSX_fragment_has_no_corresponding_closing_tag_17014", "JSX fragment has no corresponding closing tag."), + Expected_corresponding_closing_tag_for_JSX_fragment: diag(17015, ts.DiagnosticCategory.Error, "Expected_corresponding_closing_tag_for_JSX_fragment_17015", "Expected corresponding closing tag for JSX fragment."), + JSX_fragment_is_not_supported_when_using_jsxFactory: diag(17016, ts.DiagnosticCategory.Error, "JSX_fragment_is_not_supported_when_using_jsxFactory_17016", "JSX fragment is not supported when using --jsxFactory"), Circularity_detected_while_resolving_configuration_Colon_0: diag(18000, ts.DiagnosticCategory.Error, "Circularity_detected_while_resolving_configuration_Colon_0_18000", "Circularity detected while resolving configuration: {0}"), A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: diag(18001, ts.DiagnosticCategory.Error, "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", "A path in an 'extends' option must be relative or rooted, but '{0}' is not."), The_files_list_in_config_file_0_is_empty: diag(18002, ts.DiagnosticCategory.Error, "The_files_list_in_config_file_0_is_empty_18002", "The 'files' list in config file '{0}' is empty."), @@ -5446,6 +5473,11 @@ var ts; return token >= 71 /* Identifier */; } ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; + /* @internal */ + function tokenIsIdentifierOrKeywordOrGreaterThan(token) { + return token === 29 /* GreaterThanToken */ || tokenIsIdentifierOrKeyword(token); + } + ts.tokenIsIdentifierOrKeywordOrGreaterThan = tokenIsIdentifierOrKeywordOrGreaterThan; var textToToken = ts.createMapFromTemplate({ "abstract": 117 /* AbstractKeyword */, "any": 119 /* AnyKeyword */, @@ -7356,7 +7388,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 265 /* SourceFile */) { + while (node && node.kind !== 268 /* SourceFile */) { node = node.parent; } return node; @@ -7477,7 +7509,7 @@ var ts; // the syntax list itself considers them as normal trivia. Therefore if we simply skip // trivia for the list, we may have skipped the JSDocComment as well. So we should process its // first child to determine the actual position of its first token. - if (node.kind === 286 /* SyntaxList */ && node._children.length > 0) { + if (node.kind === 289 /* SyntaxList */ && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); @@ -7594,7 +7626,7 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 226 /* VariableDeclaration */ && node.parent.kind === 260 /* CatchClause */; + return node.kind === 226 /* VariableDeclaration */ && node.parent.kind === 263 /* CatchClause */; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { @@ -7620,7 +7652,7 @@ var ts; return node && node.kind === 233 /* ModuleDeclaration */ && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 265 /* SourceFile */ || + return node.kind === 268 /* SourceFile */ || node.kind === 233 /* ModuleDeclaration */ || ts.isFunctionLike(node); } @@ -7637,7 +7669,7 @@ var ts; return false; } switch (node.parent.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: return ts.isExternalModule(node.parent); case 234 /* ModuleBlock */: return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); @@ -7652,9 +7684,9 @@ var ts; /* @internal */ function isBlockScope(node, parentNode) { switch (node.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 235 /* CaseBlock */: - case 260 /* CatchClause */: + case 263 /* CatchClause */: case 233 /* ModuleDeclaration */: case 214 /* ForStatement */: case 215 /* ForInStatement */: @@ -7683,12 +7715,12 @@ var ts; case 157 /* IndexSignature */: case 160 /* FunctionType */: case 161 /* ConstructorType */: - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: case 229 /* ClassDeclaration */: case 199 /* ClassExpression */: case 230 /* InterfaceDeclaration */: case 231 /* TypeAliasDeclaration */: - case 282 /* JSDocTemplateTag */: + case 285 /* JSDocTemplateTag */: case 228 /* FunctionDeclaration */: case 151 /* MethodDeclaration */: case 152 /* Constructor */: @@ -7809,7 +7841,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file @@ -7825,7 +7857,7 @@ var ts; case 230 /* InterfaceDeclaration */: case 233 /* ModuleDeclaration */: case 232 /* EnumDeclaration */: - case 264 /* EnumMember */: + case 267 /* EnumMember */: case 228 /* FunctionDeclaration */: case 186 /* FunctionExpression */: case 151 /* MethodDeclaration */: @@ -8012,11 +8044,11 @@ var ts; case 216 /* ForOfStatement */: case 220 /* WithStatement */: case 221 /* SwitchStatement */: - case 257 /* CaseClause */: - case 258 /* DefaultClause */: + case 260 /* CaseClause */: + case 261 /* DefaultClause */: case 222 /* LabeledStatement */: case 224 /* TryStatement */: - case 260 /* CatchClause */: + case 263 /* CatchClause */: return ts.forEachChild(node, traverse); } } @@ -8084,12 +8116,12 @@ var ts; if (node) { switch (node.kind) { case 176 /* BindingElement */: - case 264 /* EnumMember */: + case 267 /* EnumMember */: case 146 /* Parameter */: - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: case 226 /* VariableDeclaration */: return true; } @@ -8147,7 +8179,7 @@ var ts; ts.isThisTypePredicate = isThisTypePredicate; function getPropertyAssignment(objectLiteral, key, key2) { return ts.filter(objectLiteral.properties, function (property) { - if (property.kind === 261 /* PropertyAssignment */) { + if (property.kind === 264 /* PropertyAssignment */) { var propName = getTextOfPropertyName(property.name); return key === propName || (key2 && key2 === propName); } @@ -8216,7 +8248,7 @@ var ts; case 156 /* ConstructSignature */: case 157 /* IndexSignature */: case 232 /* EnumDeclaration */: - case 265 /* SourceFile */: + case 268 /* SourceFile */: return node; } } @@ -8422,6 +8454,7 @@ var ts; case 200 /* OmittedExpression */: case 249 /* JsxElement */: case 250 /* JsxSelfClosingElement */: + case 253 /* JsxFragment */: case 197 /* YieldExpression */: case 191 /* AwaitExpression */: case 204 /* MetaProperty */: @@ -8452,8 +8485,8 @@ var ts; case 146 /* Parameter */: case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: - case 264 /* EnumMember */: - case 261 /* PropertyAssignment */: + case 267 /* EnumMember */: + case 264 /* PropertyAssignment */: case 176 /* BindingElement */: return parent.initializer === node; case 210 /* ExpressionStatement */: @@ -8463,7 +8496,7 @@ var ts; case 219 /* ReturnStatement */: case 220 /* WithStatement */: case 221 /* SwitchStatement */: - case 257 /* CaseClause */: + case 260 /* CaseClause */: case 223 /* ThrowStatement */: return parent.expression === node; case 214 /* ForStatement */: @@ -8484,9 +8517,9 @@ var ts; case 144 /* ComputedPropertyName */: return node === parent.expression; case 147 /* Decorator */: - case 256 /* JsxExpression */: - case 255 /* JsxSpreadAttribute */: - case 263 /* SpreadAssignment */: + case 259 /* JsxExpression */: + case 258 /* JsxSpreadAttribute */: + case 266 /* SpreadAssignment */: return true; case 201 /* ExpressionWithTypeArguments */: return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent); @@ -8668,8 +8701,8 @@ var ts; case 146 /* Parameter */: case 151 /* MethodDeclaration */: case 150 /* MethodSignature */: - case 262 /* ShorthandPropertyAssignment */: - case 261 /* PropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: + case 264 /* PropertyAssignment */: case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: return node.questionToken !== undefined; @@ -8679,7 +8712,7 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 273 /* JSDocFunctionType */ && + return node.kind === 276 /* JSDocFunctionType */ && node.parameters.length > 0 && node.parameters[0].name && node.parameters[0].name.escapedText === "new"; @@ -8732,7 +8765,7 @@ var ts; // * @returns {number} // */ // var x = function(name) { return name.length; } - if (parent && (parent.kind === 261 /* PropertyAssignment */ || getNestedModuleDeclaration(parent))) { + if (parent && (parent.kind === 264 /* PropertyAssignment */ || getNestedModuleDeclaration(parent))) { getJSDocCommentsAndTagsWorker(parent); } if (parent && parent.parent && @@ -8777,7 +8810,7 @@ var ts; } ts.getParameterSymbolFromJSDoc = getParameterSymbolFromJSDoc; function getJSDocHost(node) { - ts.Debug.assert(node.parent.kind === 275 /* JSDocComment */); + ts.Debug.assert(node.parent.kind === 278 /* JSDocComment */); return node.parent.parent; } ts.getJSDocHost = getJSDocHost; @@ -8823,13 +8856,13 @@ var ts; case 198 /* SpreadElement */: node = parent; break; - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: if (parent.name !== node) { return 0 /* None */; } node = parent.parent; break; - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: if (parent.name === node) { return 0 /* None */; } @@ -8873,7 +8906,7 @@ var ts; ts.isNodeDescendantOf = isNodeDescendantOf; function isInAmbientContext(node) { while (node) { - if (hasModifier(node, 2 /* Ambient */) || (node.kind === 265 /* SourceFile */ && node.isDeclarationFile)) { + if (hasModifier(node, 2 /* Ambient */) || (node.kind === 268 /* SourceFile */ && node.isDeclarationFile)) { return true; } node = node.parent; @@ -8926,8 +8959,8 @@ var ts; case 150 /* MethodSignature */: case 153 /* GetAccessor */: case 154 /* SetAccessor */: - case 264 /* EnumMember */: - case 261 /* PropertyAssignment */: + case 267 /* EnumMember */: + case 264 /* PropertyAssignment */: case 179 /* PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; @@ -8945,7 +8978,7 @@ var ts; // Property name in binding element or import specifier return parent.propertyName === node; case 246 /* ExportSpecifier */: - case 253 /* JsxAttribute */: + case 256 /* JsxAttribute */: // Any name in an export specifier or JSX Attribute return true; } @@ -9054,6 +9087,14 @@ var ts; return 72 /* FirstKeyword */ <= token && token <= 142 /* LastKeyword */; } ts.isKeyword = isKeyword; + function isContextualKeyword(token) { + return 117 /* FirstContextualKeyword */ <= token && token <= 142 /* LastContextualKeyword */; + } + ts.isContextualKeyword = isContextualKeyword; + function isNonContextualKeyword(token) { + return isKeyword(token) && !isContextualKeyword(token); + } + ts.isNonContextualKeyword = isNonContextualKeyword; function isTrivia(token) { return 2 /* FirstTriviaToken */ <= token && token <= 7 /* LastTriviaToken */; } @@ -9219,7 +9260,7 @@ var ts; || kind === 153 /* GetAccessor */ || kind === 154 /* SetAccessor */ || kind === 233 /* ModuleDeclaration */ - || kind === 265 /* SourceFile */; + || kind === 268 /* SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(range) { @@ -9311,6 +9352,7 @@ var ts; case 199 /* ClassExpression */: case 249 /* JsxElement */: case 250 /* JsxSelfClosingElement */: + case 253 /* JsxFragment */: case 12 /* RegularExpressionLiteral */: case 13 /* NoSubstitutionTemplateLiteral */: case 196 /* TemplateExpression */: @@ -9397,7 +9439,7 @@ var ts; return 2; case 198 /* SpreadElement */: return 1; - case 289 /* CommaListExpression */: + case 292 /* CommaListExpression */: return 0; default: return -1; @@ -11079,8 +11121,8 @@ var ts; return undefined; } switch (declaration.kind) { - case 284 /* JSDocPropertyTag */: - case 279 /* JSDocParameterTag */: { + case 287 /* JSDocPropertyTag */: + case 282 /* JSDocParameterTag */: { var name = declaration.name; if (name.kind === 143 /* QualifiedName */) { return name.right; @@ -11099,7 +11141,7 @@ var ts; return undefined; } } - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return getNameOfJSDocTypedef(declaration); case 243 /* ExportAssignment */: { var expression = declaration.expression; @@ -11138,33 +11180,33 @@ var ts; * for example on a variable declaration whose initializer is a function expression. */ function hasJSDocParameterTags(node) { - return !!getFirstJSDocTag(node, 279 /* JSDocParameterTag */); + return !!getFirstJSDocTag(node, 282 /* JSDocParameterTag */); } ts.hasJSDocParameterTags = hasJSDocParameterTags; /** Gets the JSDoc augments tag for the node if present */ function getJSDocAugmentsTag(node) { - return getFirstJSDocTag(node, 277 /* JSDocAugmentsTag */); + return getFirstJSDocTag(node, 280 /* JSDocAugmentsTag */); } ts.getJSDocAugmentsTag = getJSDocAugmentsTag; /** Gets the JSDoc class tag for the node if present */ function getJSDocClassTag(node) { - return getFirstJSDocTag(node, 278 /* JSDocClassTag */); + return getFirstJSDocTag(node, 281 /* JSDocClassTag */); } ts.getJSDocClassTag = getJSDocClassTag; /** Gets the JSDoc return tag for the node if present */ function getJSDocReturnTag(node) { - return getFirstJSDocTag(node, 280 /* JSDocReturnTag */); + return getFirstJSDocTag(node, 283 /* JSDocReturnTag */); } ts.getJSDocReturnTag = getJSDocReturnTag; /** Gets the JSDoc template tag for the node if present */ function getJSDocTemplateTag(node) { - return getFirstJSDocTag(node, 282 /* JSDocTemplateTag */); + return getFirstJSDocTag(node, 285 /* JSDocTemplateTag */); } ts.getJSDocTemplateTag = getJSDocTemplateTag; /** Gets the JSDoc type tag for the node if present and valid */ function getJSDocTypeTag(node) { // We should have already issued an error if there were multiple type jsdocs, so just use the first one. - var tag = getFirstJSDocTag(node, 281 /* JSDocTypeTag */); + var tag = getFirstJSDocTag(node, 284 /* JSDocTypeTag */); if (tag && tag.typeExpression && tag.typeExpression.type) { return tag; } @@ -11183,7 +11225,7 @@ var ts; * tag directly on the node would be returned. */ function getJSDocType(node) { - var tag = getFirstJSDocTag(node, 281 /* JSDocTypeTag */); + var tag = getFirstJSDocTag(node, 284 /* JSDocTypeTag */); if (!tag && node.kind === 146 /* Parameter */) { var paramTags = getJSDocParameterTags(node); if (paramTags) { @@ -11445,7 +11487,7 @@ var ts; } ts.isParenthesizedExpression = isParenthesizedExpression; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 288 /* PartiallyEmittedExpression */) { + while (node.kind === 291 /* PartiallyEmittedExpression */) { node = node.expression; } return node; @@ -11723,137 +11765,149 @@ var ts; return node.kind === 252 /* JsxClosingElement */; } ts.isJsxClosingElement = isJsxClosingElement; + function isJsxFragment(node) { + return node.kind === 253 /* JsxFragment */; + } + ts.isJsxFragment = isJsxFragment; + function isJsxOpeningFragment(node) { + return node.kind === 254 /* JsxOpeningFragment */; + } + ts.isJsxOpeningFragment = isJsxOpeningFragment; + function isJsxClosingFragment(node) { + return node.kind === 255 /* JsxClosingFragment */; + } + ts.isJsxClosingFragment = isJsxClosingFragment; function isJsxAttribute(node) { - return node.kind === 253 /* JsxAttribute */; + return node.kind === 256 /* JsxAttribute */; } ts.isJsxAttribute = isJsxAttribute; function isJsxAttributes(node) { - return node.kind === 254 /* JsxAttributes */; + return node.kind === 257 /* JsxAttributes */; } ts.isJsxAttributes = isJsxAttributes; function isJsxSpreadAttribute(node) { - return node.kind === 255 /* JsxSpreadAttribute */; + return node.kind === 258 /* JsxSpreadAttribute */; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxExpression(node) { - return node.kind === 256 /* JsxExpression */; + return node.kind === 259 /* JsxExpression */; } ts.isJsxExpression = isJsxExpression; // Clauses function isCaseClause(node) { - return node.kind === 257 /* CaseClause */; + return node.kind === 260 /* CaseClause */; } ts.isCaseClause = isCaseClause; function isDefaultClause(node) { - return node.kind === 258 /* DefaultClause */; + return node.kind === 261 /* DefaultClause */; } ts.isDefaultClause = isDefaultClause; function isHeritageClause(node) { - return node.kind === 259 /* HeritageClause */; + return node.kind === 262 /* HeritageClause */; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 260 /* CatchClause */; + return node.kind === 263 /* CatchClause */; } ts.isCatchClause = isCatchClause; // Property assignments function isPropertyAssignment(node) { - return node.kind === 261 /* PropertyAssignment */; + return node.kind === 264 /* PropertyAssignment */; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 262 /* ShorthandPropertyAssignment */; + return node.kind === 265 /* ShorthandPropertyAssignment */; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isSpreadAssignment(node) { - return node.kind === 263 /* SpreadAssignment */; + return node.kind === 266 /* SpreadAssignment */; } ts.isSpreadAssignment = isSpreadAssignment; // Enum function isEnumMember(node) { - return node.kind === 264 /* EnumMember */; + return node.kind === 267 /* EnumMember */; } ts.isEnumMember = isEnumMember; // Top-level nodes function isSourceFile(node) { - return node.kind === 265 /* SourceFile */; + return node.kind === 268 /* SourceFile */; } ts.isSourceFile = isSourceFile; function isBundle(node) { - return node.kind === 266 /* Bundle */; + return node.kind === 269 /* Bundle */; } ts.isBundle = isBundle; // JSDoc function isJSDocTypeExpression(node) { - return node.kind === 267 /* JSDocTypeExpression */; + return node.kind === 270 /* JSDocTypeExpression */; } ts.isJSDocTypeExpression = isJSDocTypeExpression; function isJSDocAllType(node) { - return node.kind === 268 /* JSDocAllType */; + return node.kind === 271 /* JSDocAllType */; } ts.isJSDocAllType = isJSDocAllType; function isJSDocUnknownType(node) { - return node.kind === 269 /* JSDocUnknownType */; + return node.kind === 272 /* JSDocUnknownType */; } ts.isJSDocUnknownType = isJSDocUnknownType; function isJSDocNullableType(node) { - return node.kind === 270 /* JSDocNullableType */; + return node.kind === 273 /* JSDocNullableType */; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 271 /* JSDocNonNullableType */; + return node.kind === 274 /* JSDocNonNullableType */; } ts.isJSDocNonNullableType = isJSDocNonNullableType; function isJSDocOptionalType(node) { - return node.kind === 272 /* JSDocOptionalType */; + return node.kind === 275 /* JSDocOptionalType */; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 273 /* JSDocFunctionType */; + return node.kind === 276 /* JSDocFunctionType */; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 274 /* JSDocVariadicType */; + return node.kind === 277 /* JSDocVariadicType */; } ts.isJSDocVariadicType = isJSDocVariadicType; function isJSDoc(node) { - return node.kind === 275 /* JSDocComment */; + return node.kind === 278 /* JSDocComment */; } ts.isJSDoc = isJSDoc; function isJSDocAugmentsTag(node) { - return node.kind === 277 /* JSDocAugmentsTag */; + return node.kind === 280 /* JSDocAugmentsTag */; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocParameterTag(node) { - return node.kind === 279 /* JSDocParameterTag */; + return node.kind === 282 /* JSDocParameterTag */; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 280 /* JSDocReturnTag */; + return node.kind === 283 /* JSDocReturnTag */; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocTypeTag(node) { - return node.kind === 281 /* JSDocTypeTag */; + return node.kind === 284 /* JSDocTypeTag */; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 282 /* JSDocTemplateTag */; + return node.kind === 285 /* JSDocTemplateTag */; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 283 /* JSDocTypedefTag */; + return node.kind === 286 /* JSDocTypedefTag */; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocPropertyTag(node) { - return node.kind === 284 /* JSDocPropertyTag */; + return node.kind === 287 /* JSDocPropertyTag */; } ts.isJSDocPropertyTag = isJSDocPropertyTag; function isJSDocPropertyLikeTag(node) { - return node.kind === 284 /* JSDocPropertyTag */ || node.kind === 279 /* JSDocParameterTag */; + return node.kind === 287 /* JSDocPropertyTag */ || node.kind === 282 /* JSDocParameterTag */; } ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; function isJSDocTypeLiteral(node) { - return node.kind === 285 /* JSDocTypeLiteral */; + return node.kind === 288 /* JSDocTypeLiteral */; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; })(ts || (ts = {})); @@ -11864,7 +11918,7 @@ var ts; (function (ts) { /* @internal */ function isSyntaxList(n) { - return n.kind === 286 /* SyntaxList */; + return n.kind === 289 /* SyntaxList */; } ts.isSyntaxList = isSyntaxList; /* @internal */ @@ -12010,7 +12064,7 @@ var ts; case 156 /* ConstructSignature */: case 157 /* IndexSignature */: case 160 /* FunctionType */: - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: case 161 /* ConstructorType */: return true; default: @@ -12057,9 +12111,9 @@ var ts; ts.isTypeElement = isTypeElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 261 /* PropertyAssignment */ - || kind === 262 /* ShorthandPropertyAssignment */ - || kind === 263 /* SpreadAssignment */ + return kind === 264 /* PropertyAssignment */ + || kind === 265 /* ShorthandPropertyAssignment */ + || kind === 266 /* SpreadAssignment */ || kind === 151 /* MethodDeclaration */ || kind === 153 /* GetAccessor */ || kind === 154 /* SetAccessor */ @@ -12081,13 +12135,13 @@ var ts; || kind === 95 /* NullKeyword */ || kind === 130 /* NeverKeyword */ || kind === 201 /* ExpressionWithTypeArguments */ - || kind === 268 /* JSDocAllType */ - || kind === 269 /* JSDocUnknownType */ - || kind === 270 /* JSDocNullableType */ - || kind === 271 /* JSDocNonNullableType */ - || kind === 272 /* JSDocOptionalType */ - || kind === 273 /* JSDocFunctionType */ - || kind === 274 /* JSDocVariadicType */; + || kind === 271 /* JSDocAllType */ + || kind === 272 /* JSDocUnknownType */ + || kind === 273 /* JSDocNullableType */ + || kind === 274 /* JSDocNonNullableType */ + || kind === 275 /* JSDocOptionalType */ + || kind === 276 /* JSDocFunctionType */ + || kind === 277 /* JSDocVariadicType */; } /** * Node test that determines whether a node is a valid type node. @@ -12225,6 +12279,7 @@ var ts; case 181 /* CallExpression */: case 249 /* JsxElement */: case 250 /* JsxSelfClosingElement */: + case 253 /* JsxFragment */: case 183 /* TaggedTemplateExpression */: case 177 /* ArrayLiteralExpression */: case 185 /* ParenthesizedExpression */: @@ -12300,8 +12355,8 @@ var ts; case 198 /* SpreadElement */: case 202 /* AsExpression */: case 200 /* OmittedExpression */: - case 289 /* CommaListExpression */: - case 288 /* PartiallyEmittedExpression */: + case 292 /* CommaListExpression */: + case 291 /* PartiallyEmittedExpression */: return true; default: return isUnaryExpressionKind(kind); @@ -12315,12 +12370,12 @@ var ts; ts.isAssertionExpression = isAssertionExpression; /* @internal */ function isPartiallyEmittedExpression(node) { - return node.kind === 288 /* PartiallyEmittedExpression */; + return node.kind === 291 /* PartiallyEmittedExpression */; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; /* @internal */ function isNotEmittedStatement(node) { - return node.kind === 287 /* NotEmittedStatement */; + return node.kind === 290 /* NotEmittedStatement */; } ts.isNotEmittedStatement = isNotEmittedStatement; /* @internal */ @@ -12408,7 +12463,7 @@ var ts; || kind === 199 /* ClassExpression */ || kind === 152 /* Constructor */ || kind === 232 /* EnumDeclaration */ - || kind === 264 /* EnumMember */ + || kind === 267 /* EnumMember */ || kind === 246 /* ExportSpecifier */ || kind === 228 /* FunctionDeclaration */ || kind === 186 /* FunctionExpression */ @@ -12417,22 +12472,22 @@ var ts; || kind === 237 /* ImportEqualsDeclaration */ || kind === 242 /* ImportSpecifier */ || kind === 230 /* InterfaceDeclaration */ - || kind === 253 /* JsxAttribute */ + || kind === 256 /* JsxAttribute */ || kind === 151 /* MethodDeclaration */ || kind === 150 /* MethodSignature */ || kind === 233 /* ModuleDeclaration */ || kind === 236 /* NamespaceExportDeclaration */ || kind === 240 /* NamespaceImport */ || kind === 146 /* Parameter */ - || kind === 261 /* PropertyAssignment */ + || kind === 264 /* PropertyAssignment */ || kind === 149 /* PropertyDeclaration */ || kind === 148 /* PropertySignature */ || kind === 154 /* SetAccessor */ - || kind === 262 /* ShorthandPropertyAssignment */ + || kind === 265 /* ShorthandPropertyAssignment */ || kind === 231 /* TypeAliasDeclaration */ || kind === 145 /* TypeParameter */ || kind === 226 /* VariableDeclaration */ - || kind === 283 /* JSDocTypedefTag */; + || kind === 286 /* JSDocTypedefTag */; } function isDeclarationStatementKind(kind) { return kind === 228 /* FunctionDeclaration */ @@ -12467,14 +12522,14 @@ var ts; || kind === 208 /* VariableStatement */ || kind === 213 /* WhileStatement */ || kind === 220 /* WithStatement */ - || kind === 287 /* NotEmittedStatement */ - || kind === 291 /* EndOfDeclarationMarker */ - || kind === 290 /* MergeDeclarationMarker */; + || kind === 290 /* NotEmittedStatement */ + || kind === 294 /* EndOfDeclarationMarker */ + || kind === 293 /* MergeDeclarationMarker */; } /* @internal */ function isDeclaration(node) { if (node.kind === 145 /* TypeParameter */) { - return node.parent.kind !== 282 /* JSDocTemplateTag */ || ts.isInJavaScriptFile(node); + return node.parent.kind !== 285 /* JSDocTemplateTag */ || ts.isInJavaScriptFile(node); } return isDeclarationKind(node.kind); } @@ -12504,7 +12559,7 @@ var ts; if (node.kind !== 207 /* Block */) return false; if (node.parent !== undefined) { - if (node.parent.kind === 224 /* TryStatement */ || node.parent.kind === 260 /* CatchClause */) { + if (node.parent.kind === 224 /* TryStatement */ || node.parent.kind === 263 /* CatchClause */) { return false; } } @@ -12532,23 +12587,24 @@ var ts; function isJsxChild(node) { var kind = node.kind; return kind === 249 /* JsxElement */ - || kind === 256 /* JsxExpression */ + || kind === 259 /* JsxExpression */ || kind === 250 /* JsxSelfClosingElement */ - || kind === 10 /* JsxText */; + || kind === 10 /* JsxText */ + || kind === 253 /* JsxFragment */; } ts.isJsxChild = isJsxChild; /* @internal */ function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 253 /* JsxAttribute */ - || kind === 255 /* JsxSpreadAttribute */; + return kind === 256 /* JsxAttribute */ + || kind === 258 /* JsxSpreadAttribute */; } ts.isJsxAttributeLike = isJsxAttributeLike; /* @internal */ function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 9 /* StringLiteral */ - || kind === 256 /* JsxExpression */; + || kind === 259 /* JsxExpression */; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isJsxOpeningLikeElement(node) { @@ -12560,26 +12616,26 @@ var ts; // Clauses function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 257 /* CaseClause */ - || kind === 258 /* DefaultClause */; + return kind === 260 /* CaseClause */ + || kind === 261 /* DefaultClause */; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; // JSDoc /** True if node is of some JSDoc syntax kind. */ /* @internal */ function isJSDocNode(node) { - return node.kind >= 267 /* FirstJSDocNode */ && node.kind <= 285 /* LastJSDocNode */; + return node.kind >= 270 /* FirstJSDocNode */ && node.kind <= 288 /* LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; /** True if node is of a kind that may contain comment text. */ function isJSDocCommentContainingNode(node) { - return node.kind === 275 /* JSDocComment */ || isJSDocTag(node); + return node.kind === 278 /* JSDocComment */ || isJSDocTag(node); } ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode; // TODO: determine what this does before making it public. /* @internal */ function isJSDocTag(node) { - return node.kind >= 276 /* FirstJSDocTagNode */ && node.kind <= 285 /* LastJSDocTagNode */; + return node.kind >= 279 /* FirstJSDocTagNode */ && node.kind <= 288 /* LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function isSetAccessor(node) { @@ -12616,7 +12672,7 @@ var ts; var IdentifierConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 265 /* SourceFile */) { + if (kind === 268 /* SourceFile */) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 71 /* Identifier */) { @@ -12673,19 +12729,19 @@ var ts; visitNode(cbNode, node.constraint) || visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: return visitNode(cbNode, node.expression); case 146 /* Parameter */: case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: case 226 /* VariableDeclaration */: case 176 /* BindingElement */: return visitNodes(cbNode, cbNodes, node.decorators) || @@ -12817,7 +12873,7 @@ var ts; case 207 /* Block */: case 234 /* ModuleBlock */: return visitNodes(cbNode, cbNodes, node.statements); - case 265 /* SourceFile */: + case 268 /* SourceFile */: return visitNodes(cbNode, cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); case 208 /* VariableStatement */: @@ -12865,10 +12921,10 @@ var ts; visitNode(cbNode, node.caseBlock); case 235 /* CaseBlock */: return visitNodes(cbNode, cbNodes, node.clauses); - case 257 /* CaseClause */: + case 260 /* CaseClause */: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.statements); - case 258 /* DefaultClause */: + case 261 /* DefaultClause */: return visitNodes(cbNode, cbNodes, node.statements); case 222 /* LabeledStatement */: return visitNode(cbNode, node.label) || @@ -12879,7 +12935,7 @@ var ts; return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 147 /* Decorator */: @@ -12910,7 +12966,7 @@ var ts; visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.members); - case 264 /* EnumMember */: + case 267 /* EnumMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 233 /* ModuleDeclaration */: @@ -12957,7 +13013,7 @@ var ts; return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 144 /* ComputedPropertyName */: return visitNode(cbNode, node.expression); - case 259 /* HeritageClause */: + case 262 /* HeritageClause */: return visitNodes(cbNode, cbNodes, node.types); case 201 /* ExpressionWithTypeArguments */: return visitNode(cbNode, node.expression) || @@ -12966,45 +13022,49 @@ var ts; return visitNode(cbNode, node.expression); case 247 /* MissingDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators); - case 289 /* CommaListExpression */: + case 292 /* CommaListExpression */: return visitNodes(cbNode, cbNodes, node.elements); case 249 /* JsxElement */: return visitNode(cbNode, node.openingElement) || visitNodes(cbNode, cbNodes, node.children) || visitNode(cbNode, node.closingElement); + case 253 /* JsxFragment */: + return visitNode(cbNode, node.openingFragment) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingFragment); case 250 /* JsxSelfClosingElement */: case 251 /* JsxOpeningElement */: return visitNode(cbNode, node.tagName) || visitNode(cbNode, node.attributes); - case 254 /* JsxAttributes */: + case 257 /* JsxAttributes */: return visitNodes(cbNode, cbNodes, node.properties); - case 253 /* JsxAttribute */: + case 256 /* JsxAttribute */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 255 /* JsxSpreadAttribute */: + case 258 /* JsxSpreadAttribute */: return visitNode(cbNode, node.expression); - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: return visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.expression); case 252 /* JsxClosingElement */: return visitNode(cbNode, node.tagName); - case 267 /* JSDocTypeExpression */: + case 270 /* JSDocTypeExpression */: return visitNode(cbNode, node.type); - case 271 /* JSDocNonNullableType */: + case 274 /* JSDocNonNullableType */: return visitNode(cbNode, node.type); - case 270 /* JSDocNullableType */: + case 273 /* JSDocNullableType */: return visitNode(cbNode, node.type); - case 272 /* JSDocOptionalType */: + case 275 /* JSDocOptionalType */: return visitNode(cbNode, node.type); - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: return visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 274 /* JSDocVariadicType */: + case 277 /* JSDocVariadicType */: return visitNode(cbNode, node.type); - case 275 /* JSDocComment */: + case 278 /* JSDocComment */: return visitNodes(cbNode, cbNodes, node.tags); - case 279 /* JSDocParameterTag */: - case 284 /* JSDocPropertyTag */: + case 282 /* JSDocParameterTag */: + case 287 /* JSDocPropertyTag */: if (node.isNameFirst) { return visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression); @@ -13013,17 +13073,17 @@ var ts; return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); } - case 280 /* JSDocReturnTag */: + case 283 /* JSDocReturnTag */: return visitNode(cbNode, node.typeExpression); - case 281 /* JSDocTypeTag */: + case 284 /* JSDocTypeTag */: return visitNode(cbNode, node.typeExpression); - case 277 /* JSDocAugmentsTag */: + case 280 /* JSDocAugmentsTag */: return visitNode(cbNode, node.class); - case 282 /* JSDocTemplateTag */: + case 285 /* JSDocTemplateTag */: return visitNodes(cbNode, cbNodes, node.typeParameters); - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: if (node.typeExpression && - node.typeExpression.kind === 267 /* JSDocTypeExpression */) { + node.typeExpression.kind === 270 /* JSDocTypeExpression */) { return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName); } @@ -13031,7 +13091,7 @@ var ts; return visitNode(cbNode, node.fullName) || visitNode(cbNode, node.typeExpression); } - case 285 /* JSDocTypeLiteral */: + case 288 /* JSDocTypeLiteral */: if (node.jsDocPropertyTags) { for (var _i = 0, _a = node.jsDocPropertyTags; _i < _a.length; _i++) { var tag = _a[_i]; @@ -13039,7 +13099,7 @@ var ts; } } return; - case 288 /* PartiallyEmittedExpression */: + case 291 /* PartiallyEmittedExpression */: return visitNode(cbNode, node.expression); } } @@ -13348,7 +13408,7 @@ var ts; function createSourceFile(fileName, languageVersion, scriptKind) { // code from createNode is inlined here so createNode won't have to deal with special case of creating source files // this is quite rare comparing to other nodes and createNode should be as fast as possible - var sourceFile = new SourceFileConstructor(265 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); + var sourceFile = new SourceFileConstructor(268 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -13885,6 +13945,10 @@ var ts; nextToken(); return ts.tokenIsIdentifierOrKeyword(token()); } + function nextTokenIsIdentifierOrKeywordOrGreaterThan() { + nextToken(); + return ts.tokenIsIdentifierOrKeywordOrGreaterThan(token()); + } function isHeritageClauseExtendsOrImplementsKeyword() { if (token() === 108 /* ImplementsKeyword */ || token() === 85 /* ExtendsKeyword */) { @@ -14145,8 +14209,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 257 /* CaseClause */: - case 258 /* DefaultClause */: + case 260 /* CaseClause */: + case 261 /* DefaultClause */: return true; } } @@ -14190,7 +14254,7 @@ var ts; return false; } function isReusableEnumMember(node) { - return node.kind === 264 /* EnumMember */; + return node.kind === 267 /* EnumMember */; } function isReusableTypeMember(node) { if (node) { @@ -14476,7 +14540,7 @@ var ts; return finishNode(node); } function parseJSDocAllType() { - var result = createNode(268 /* JSDocAllType */); + var result = createNode(271 /* JSDocAllType */); nextToken(); return finishNode(result); } @@ -14499,18 +14563,18 @@ var ts; token() === 29 /* GreaterThanToken */ || token() === 58 /* EqualsToken */ || token() === 49 /* BarToken */) { - var result = createNode(269 /* JSDocUnknownType */, pos); + var result = createNode(272 /* JSDocUnknownType */, pos); return finishNode(result); } else { - var result = createNode(270 /* JSDocNullableType */, pos); + var result = createNode(273 /* JSDocNullableType */, pos); result.type = parseType(); return finishNode(result); } } function parseJSDocFunctionType() { if (lookAhead(nextTokenIsOpenParen)) { - var result = createNode(273 /* JSDocFunctionType */); + var result = createNode(276 /* JSDocFunctionType */); nextToken(); fillSignature(56 /* ColonToken */, 4 /* Type */ | 32 /* JSDoc */, result); return addJSDocComment(finishNode(result)); @@ -14945,9 +15009,9 @@ var ts; case 89 /* FunctionKeyword */: return parseJSDocFunctionType(); case 24 /* DotDotDotToken */: - return parseJSDocNodeWithType(274 /* JSDocVariadicType */); + return parseJSDocNodeWithType(277 /* JSDocVariadicType */); case 51 /* ExclamationToken */: - return parseJSDocNodeWithType(271 /* JSDocNonNullableType */); + return parseJSDocNodeWithType(274 /* JSDocNonNullableType */); case 13 /* NoSubstitutionTemplateLiteral */: case 9 /* StringLiteral */: case 8 /* NumericLiteral */: @@ -15032,13 +15096,13 @@ var ts; if (!(contextFlags & 1048576 /* JSDoc */)) { return type; } - type = createJSDocPostfixType(272 /* JSDocOptionalType */, type); + type = createJSDocPostfixType(275 /* JSDocOptionalType */, type); break; case 51 /* ExclamationToken */: - type = createJSDocPostfixType(271 /* JSDocNonNullableType */, type); + type = createJSDocPostfixType(274 /* JSDocNonNullableType */, type); break; case 55 /* QuestionToken */: - type = createJSDocPostfixType(270 /* JSDocNullableType */, type); + type = createJSDocPostfixType(273 /* JSDocNullableType */, type); break; case 21 /* OpenBracketToken */: parseExpected(21 /* OpenBracketToken */); @@ -15983,9 +16047,9 @@ var ts; node.operand = parseLeftHandSideExpressionOrHigher(); return finishNode(node); } - else if (sourceFile.languageVariant === 1 /* JSX */ && token() === 27 /* LessThanToken */ && lookAhead(nextTokenIsIdentifierOrKeyword)) { + else if (sourceFile.languageVariant === 1 /* JSX */ && token() === 27 /* LessThanToken */ && lookAhead(nextTokenIsIdentifierOrKeywordOrGreaterThan)) { // JSXElement is part of primaryExpression - return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true); + return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ true); } var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); @@ -16126,19 +16190,26 @@ var ts; return lhs.name.escapedText === rhs.name.escapedText && tagNamesAreEquivalent(lhs.expression, rhs.expression); } - function parseJsxElementOrSelfClosingElement(inExpressionContext) { - var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); + function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext) { + var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); var result; if (opening.kind === 251 /* JsxOpeningElement */) { var node = createNode(249 /* JsxElement */, opening.pos); node.openingElement = opening; - node.children = parseJsxChildren(node.openingElement.tagName); + node.children = parseJsxChildren(node.openingElement); node.closingElement = parseJsxClosingElement(inExpressionContext); if (!tagNamesAreEquivalent(node.openingElement.tagName, node.closingElement.tagName)) { parseErrorAtPosition(node.closingElement.pos, node.closingElement.end - node.closingElement.pos, ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNodeFromSourceText(sourceText, node.openingElement.tagName)); } result = finishNode(node); } + else if (opening.kind === 254 /* JsxOpeningFragment */) { + var node = createNode(253 /* JsxFragment */, opening.pos); + node.openingFragment = opening; + node.children = parseJsxChildren(node.openingFragment); + node.closingFragment = parseJsxClosingFragment(inExpressionContext); + result = finishNode(node); + } else { ts.Debug.assert(opening.kind === 250 /* JsxSelfClosingElement */); // Nothing else to do for self-closing elements @@ -16152,7 +16223,7 @@ var ts; // Since JSX elements are invalid < operands anyway, this lookahead parse will only occur in error scenarios // of one sort or another. if (inExpressionContext && token() === 27 /* LessThanToken */) { - var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true); }); + var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); var badNode = createNode(194 /* BinaryExpression */, result.pos); @@ -16180,11 +16251,11 @@ var ts; case 17 /* OpenBraceToken */: return parseJsxExpression(/*inExpressionContext*/ false); case 27 /* LessThanToken */: - return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ false); + return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ false); } ts.Debug.fail("Unknown JSX child kind " + token()); } - function parseJsxChildren(openingTagName) { + function parseJsxChildren(openingTag) { var list = []; var listPos = getNodePos(); var saveParsingContext = parsingContext; @@ -16198,7 +16269,13 @@ var ts; else if (token() === 1 /* EndOfFileToken */) { // If we hit EOF, issue the error at the tag that lacks the closing element // rather than at the end of the file (which is useless) - parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTagName)); + if (ts.isJsxOpeningFragment(openingTag)) { + parseErrorAtPosition(openingTag.pos, openingTag.end - openingTag.pos, ts.Diagnostics.JSX_fragment_has_no_corresponding_closing_tag); + } + else { + var openingTagName = openingTag.tagName; + parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTagName)); + } break; } else if (token() === 7 /* ConflictMarkerTrivia */) { @@ -16213,13 +16290,18 @@ var ts; return createNodeArray(list, listPos); } function parseJsxAttributes() { - var jsxAttributes = createNode(254 /* JsxAttributes */); + var jsxAttributes = createNode(257 /* JsxAttributes */); jsxAttributes.properties = parseList(13 /* JsxAttributes */, parseJsxAttribute); return finishNode(jsxAttributes); } - function parseJsxOpeningOrSelfClosingElement(inExpressionContext) { + function parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext) { var fullStart = scanner.getStartPos(); parseExpected(27 /* LessThanToken */); + if (token() === 29 /* GreaterThanToken */) { + parseExpected(29 /* GreaterThanToken */); + var node_1 = createNode(254 /* JsxOpeningFragment */, fullStart); + return finishNode(node_1); + } var tagName = parseJsxElementName(); var attributes = parseJsxAttributes(); var node; @@ -16263,7 +16345,7 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(256 /* JsxExpression */); + var node = createNode(259 /* JsxExpression */); parseExpected(17 /* OpenBraceToken */); if (token() !== 18 /* CloseBraceToken */) { node.dotDotDotToken = parseOptionalToken(24 /* DotDotDotToken */); @@ -16283,7 +16365,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(253 /* JsxAttribute */); + var node = createNode(256 /* JsxAttribute */); node.name = parseIdentifierName(); if (token() === 58 /* EqualsToken */) { switch (scanJsxAttributeValue()) { @@ -16298,7 +16380,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(255 /* JsxSpreadAttribute */); + var node = createNode(258 /* JsxSpreadAttribute */); parseExpected(17 /* OpenBraceToken */); parseExpected(24 /* DotDotDotToken */); node.expression = parseExpression(); @@ -16318,6 +16400,22 @@ var ts; } return finishNode(node); } + function parseJsxClosingFragment(inExpressionContext) { + var node = createNode(255 /* JsxClosingFragment */); + parseExpected(28 /* LessThanSlashToken */); + if (ts.tokenIsIdentifierOrKeyword(token())) { + var unexpectedTagName = parseJsxElementName(); + parseErrorAtPosition(unexpectedTagName.pos, unexpectedTagName.end - unexpectedTagName.pos, ts.Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment); + } + if (inExpressionContext) { + parseExpected(29 /* GreaterThanToken */); + } + else { + parseExpected(29 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false); + scanJsxText(); + } + return finishNode(node); + } function parseTypeAssertion() { var node = createNode(184 /* TypeAssertionExpression */); parseExpected(27 /* LessThanToken */); @@ -16545,7 +16643,7 @@ var ts; var fullStart = scanner.getStartPos(); var dotDotDotToken = parseOptionalToken(24 /* DotDotDotToken */); if (dotDotDotToken) { - var spreadElement = createNode(263 /* SpreadAssignment */, fullStart); + var spreadElement = createNode(266 /* SpreadAssignment */, fullStart); spreadElement.expression = parseAssignmentExpressionOrHigher(); return addJSDocComment(finishNode(spreadElement)); } @@ -16570,7 +16668,7 @@ var ts; // this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 26 /* CommaToken */ || token() === 18 /* CloseBraceToken */ || token() === 58 /* EqualsToken */); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(262 /* ShorthandPropertyAssignment */, fullStart); + var shorthandDeclaration = createNode(265 /* ShorthandPropertyAssignment */, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(58 /* EqualsToken */); @@ -16581,7 +16679,7 @@ var ts; return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(261 /* PropertyAssignment */, fullStart); + var propertyAssignment = createNode(264 /* PropertyAssignment */, fullStart); propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; @@ -16635,10 +16733,10 @@ var ts; var fullStart = scanner.getStartPos(); parseExpected(94 /* NewKeyword */); if (parseOptional(23 /* DotToken */)) { - var node_1 = createNode(204 /* MetaProperty */, fullStart); - node_1.keywordToken = 94 /* NewKeyword */; - node_1.name = parseIdentifierName(); - return finishNode(node_1); + var node_2 = createNode(204 /* MetaProperty */, fullStart); + node_2.keywordToken = 94 /* NewKeyword */; + node_2.name = parseIdentifierName(); + return finishNode(node_2); } var node = createNode(182 /* NewExpression */, fullStart); node.expression = parseMemberExpressionOrHigher(); @@ -16796,7 +16894,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(257 /* CaseClause */); + var node = createNode(260 /* CaseClause */); parseExpected(73 /* CaseKeyword */); node.expression = allowInAnd(parseExpression); parseExpected(56 /* ColonToken */); @@ -16804,7 +16902,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(258 /* DefaultClause */); + var node = createNode(261 /* DefaultClause */); parseExpected(79 /* DefaultKeyword */); parseExpected(56 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); @@ -16855,7 +16953,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(260 /* CatchClause */); + var result = createNode(263 /* CatchClause */); parseExpected(74 /* CatchKeyword */); if (parseOptional(19 /* OpenParenToken */)) { result.variableDeclaration = parseVariableDeclaration(); @@ -17580,7 +17678,7 @@ var ts; function parseHeritageClause() { var tok = token(); if (tok === 85 /* ExtendsKeyword */ || tok === 108 /* ImplementsKeyword */) { - var node = createNode(259 /* HeritageClause */); + var node = createNode(262 /* HeritageClause */); node.token = tok; nextToken(); node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments); @@ -17633,7 +17731,7 @@ var ts; // ConstantEnumMemberSection, which starts at the beginning of an enum declaration // or any time an integer literal initializer is encountered. function parseEnumMember() { - var node = createNode(264 /* EnumMember */, scanner.getStartPos()); + var node = createNode(267 /* EnumMember */, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return addJSDocComment(finishNode(node)); @@ -18050,7 +18148,7 @@ var ts; } JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; function parseJSDocTypeExpression(requireBraces) { - var result = createNode(267 /* JSDocTypeExpression */, scanner.getTokenPos()); + var result = createNode(270 /* JSDocTypeExpression */, scanner.getTokenPos()); if (!parseExpected(17 /* OpenBraceToken */) && requireBraces) { return undefined; } @@ -18234,7 +18332,7 @@ var ts; content.charCodeAt(start + 3) !== 42 /* asterisk */; } function createJSDocComment() { - var result = createNode(275 /* JSDocComment */, start); + var result = createNode(278 /* JSDocComment */, start); result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd); result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -18358,7 +18456,7 @@ var ts; return comments; } function parseUnknownTag(atToken, tagName) { - var result = createNode(276 /* JSDocTag */, atToken.pos); + var result = createNode(279 /* JSDocTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -18412,8 +18510,8 @@ var ts; typeExpression = tryParseTypeExpression(); } var result = target === 1 /* Parameter */ ? - createNode(279 /* JSDocParameterTag */, atToken.pos) : - createNode(284 /* JSDocPropertyTag */, atToken.pos); + createNode(282 /* JSDocParameterTag */, atToken.pos) : + createNode(287 /* JSDocPropertyTag */, atToken.pos); var nestedTypeLiteral = parseNestedTypeLiteral(typeExpression, name); if (nestedTypeLiteral) { typeExpression = nestedTypeLiteral; @@ -18429,7 +18527,7 @@ var ts; } function parseNestedTypeLiteral(typeExpression, name) { if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) { - var typeLiteralExpression = createNode(267 /* JSDocTypeExpression */, scanner.getTokenPos()); + var typeLiteralExpression = createNode(270 /* JSDocTypeExpression */, scanner.getTokenPos()); var child = void 0; var jsdocTypeLiteral = void 0; var start_2 = scanner.getStartPos(); @@ -18441,7 +18539,7 @@ var ts; children.push(child); } if (children) { - jsdocTypeLiteral = createNode(285 /* JSDocTypeLiteral */, start_2); + jsdocTypeLiteral = createNode(288 /* JSDocTypeLiteral */, start_2); jsdocTypeLiteral.jsDocPropertyTags = children; if (typeExpression.type.kind === 164 /* ArrayType */) { jsdocTypeLiteral.isArrayType = true; @@ -18452,27 +18550,27 @@ var ts; } } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 280 /* JSDocReturnTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 283 /* JSDocReturnTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } - var result = createNode(280 /* JSDocReturnTag */, atToken.pos); + var result = createNode(283 /* JSDocReturnTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 281 /* JSDocTypeTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 284 /* JSDocTypeTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } - var result = createNode(281 /* JSDocTypeTag */, atToken.pos); + var result = createNode(284 /* JSDocTypeTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = parseJSDocTypeExpression(/*requireBraces*/ true); return finishNode(result); } function parseAugmentsTag(atToken, tagName) { - var result = createNode(277 /* JSDocAugmentsTag */, atToken.pos); + var result = createNode(280 /* JSDocAugmentsTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.class = parseExpressionWithTypeArgumentsForAugments(); @@ -18500,7 +18598,7 @@ var ts; return node; } function parseClassTag(atToken, tagName) { - var tag = createNode(278 /* JSDocClassTag */, atToken.pos); + var tag = createNode(281 /* JSDocClassTag */, atToken.pos); tag.atToken = atToken; tag.tagName = tagName; return finishNode(tag); @@ -18508,7 +18606,7 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(283 /* JSDocTypedefTag */, atToken.pos); + var typedefTag = createNode(286 /* JSDocTypedefTag */, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(/*flags*/ 0); @@ -18533,9 +18631,9 @@ var ts; var start_3 = scanner.getStartPos(); while (child = tryParse(function () { return parseChildParameterOrPropertyTag(0 /* Property */); })) { if (!jsdocTypeLiteral) { - jsdocTypeLiteral = createNode(285 /* JSDocTypeLiteral */, start_3); + jsdocTypeLiteral = createNode(288 /* JSDocTypeLiteral */, start_3); } - if (child.kind === 281 /* JSDocTypeTag */) { + if (child.kind === 284 /* JSDocTypeTag */) { if (childTypeTag) { break; } @@ -18597,7 +18695,7 @@ var ts; case 57 /* AtToken */: if (canParseTag) { var child = tryParseChildTag(target); - if (child && child.kind === 279 /* JSDocParameterTag */ && + if (child && child.kind === 282 /* JSDocParameterTag */ && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; } @@ -18647,7 +18745,7 @@ var ts; return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 282 /* JSDocTemplateTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 285 /* JSDocTemplateTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } // Type parameter list looks like '@template T,U,V' @@ -18672,7 +18770,7 @@ var ts; break; } } - var result = createNode(282 /* JSDocTemplateTag */, atToken.pos); + var result = createNode(285 /* JSDocTemplateTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = createNodeArray(typeParameters, typeParametersPos); @@ -19442,16 +19540,16 @@ var ts; case 228 /* FunctionDeclaration */: case 229 /* ClassDeclaration */: return (ts.hasModifier(node, 512 /* Default */) ? "default" /* Default */ : undefined); - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: return (ts.isJSDocConstructSignature(node) ? "__new" /* New */ : "__call" /* Call */); case 146 /* Parameter */: // Parameters with names are handled at the top of this function. Parameters // without names can only come from JSDocFunctionTypes. - ts.Debug.assert(node.parent.kind === 273 /* JSDocFunctionType */); + ts.Debug.assert(node.parent.kind === 276 /* JSDocFunctionType */); var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "arg" + index; - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: var name_2 = ts.getNameOfJSDocTypedef(node); return typeof name_2 !== "undefined" ? name_2.escapedText : undefined; } @@ -19583,9 +19681,9 @@ var ts; // during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation // and this case is specially handled. Module augmentations should only be merged with original module definition // and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed. - if (node.kind === 283 /* JSDocTypedefTag */) + if (node.kind === 286 /* JSDocTypedefTag */) ts.Debug.assert(ts.isInJavaScriptFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file. - var isJSDocTypedefInJSDocNamespace = node.kind === 283 /* JSDocTypedefTag */ && + var isJSDocTypedefInJSDocNamespace = node.kind === 286 /* JSDocTypedefTag */ && node.name && node.name.kind === 71 /* Identifier */ && node.name.isInJSDocNamespace; @@ -19670,7 +19768,7 @@ var ts; if (hasExplicitReturn) node.flags |= 256 /* HasExplicitReturn */; } - if (node.kind === 265 /* SourceFile */) { + if (node.kind === 268 /* SourceFile */) { node.flags |= emitFlags; } if (isIIFE) { @@ -19793,7 +19891,7 @@ var ts; case 235 /* CaseBlock */: bindCaseBlock(node); break; - case 257 /* CaseClause */: + case 260 /* CaseClause */: bindCaseClause(node); break; case 222 /* LabeledStatement */: @@ -19820,10 +19918,10 @@ var ts; case 181 /* CallExpression */: bindCallExpressionFlow(node); break; - case 275 /* JSDocComment */: + case 278 /* JSDocComment */: bindJSDocComment(node); break; - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: bindJSDocTypedefTag(node); break; default: @@ -20217,7 +20315,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 258 /* DefaultClause */; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 261 /* DefaultClause */; }); // We mark a switch statement as possibly exhaustive if it has no default clause and if all // case clauses have unreachable end points (e.g. they all return). node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; @@ -20316,13 +20414,13 @@ var ts; else if (node.kind === 178 /* ObjectLiteralExpression */) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 261 /* PropertyAssignment */) { + if (p.kind === 264 /* PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 262 /* ShorthandPropertyAssignment */) { + else if (p.kind === 265 /* ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 263 /* SpreadAssignment */) { + else if (p.kind === 266 /* SpreadAssignment */) { bindAssignmentTargetFlow(p.expression); } } @@ -20428,7 +20526,7 @@ var ts; } function bindJSDocComment(node) { ts.forEachChild(node, function (n) { - if (n.kind !== 283 /* JSDocTypedefTag */) { + if (n.kind !== 286 /* JSDocTypedefTag */) { bind(n); } }); @@ -20474,8 +20572,8 @@ var ts; case 232 /* EnumDeclaration */: case 178 /* ObjectLiteralExpression */: case 163 /* TypeLiteral */: - case 285 /* JSDocTypeLiteral */: - case 254 /* JsxAttributes */: + case 288 /* JSDocTypeLiteral */: + case 257 /* JsxAttributes */: return 1 /* IsContainer */; case 230 /* InterfaceDeclaration */: return 1 /* IsContainer */ | 64 /* IsInterface */; @@ -20483,7 +20581,7 @@ var ts; case 231 /* TypeAliasDeclaration */: case 172 /* MappedType */: return 1 /* IsContainer */ | 32 /* HasLocals */; - case 265 /* SourceFile */: + case 268 /* SourceFile */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */; case 151 /* MethodDeclaration */: if (ts.isObjectLiteralOrClassExpressionMethod(node)) { @@ -20496,7 +20594,7 @@ var ts; case 153 /* GetAccessor */: case 154 /* SetAccessor */: case 155 /* CallSignature */: - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: case 160 /* FunctionType */: case 156 /* ConstructSignature */: case 157 /* IndexSignature */: @@ -20509,7 +20607,7 @@ var ts; return 4 /* IsControlFlowContainer */; case 149 /* PropertyDeclaration */: return node.initializer ? 4 /* IsControlFlowContainer */ : 0; - case 260 /* CatchClause */: + case 263 /* CatchClause */: case 214 /* ForStatement */: case 215 /* ForInStatement */: case 216 /* ForOfStatement */: @@ -20550,7 +20648,7 @@ var ts; // handlers to take care of declaring these child members. case 233 /* ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 265 /* SourceFile */: + case 268 /* SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); case 199 /* ClassExpression */: case 229 /* ClassDeclaration */: @@ -20558,10 +20656,10 @@ var ts; case 232 /* EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); case 163 /* TypeLiteral */: - case 285 /* JSDocTypeLiteral */: + case 288 /* JSDocTypeLiteral */: case 178 /* ObjectLiteralExpression */: case 230 /* InterfaceDeclaration */: - case 254 /* JsxAttributes */: + case 257 /* JsxAttributes */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the @@ -20581,7 +20679,7 @@ var ts; case 228 /* FunctionDeclaration */: case 186 /* FunctionExpression */: case 187 /* ArrowFunction */: - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: case 231 /* TypeAliasDeclaration */: case 172 /* MappedType */: // All the children of these container types are never visible through another @@ -20604,8 +20702,8 @@ var ts; : declareSymbol(file.locals, /*parent*/ undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 265 /* SourceFile */ ? node : node.body; - if (body && (body.kind === 265 /* SourceFile */ || body.kind === 234 /* ModuleBlock */)) { + var body = node.kind === 268 /* SourceFile */ ? node : node.body; + if (body && (body.kind === 268 /* SourceFile */ || body.kind === 234 /* ModuleBlock */)) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; if (stat.kind === 244 /* ExportDeclaration */ || stat.kind === 243 /* ExportAssignment */) { @@ -20703,7 +20801,7 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 263 /* SpreadAssignment */ || prop.name.kind !== 71 /* Identifier */) { + if (prop.kind === 266 /* SpreadAssignment */ || prop.name.kind !== 71 /* Identifier */) { continue; } var identifier = prop.name; @@ -20715,7 +20813,7 @@ var ts; // c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true. // 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 === 261 /* PropertyAssignment */ || prop.kind === 262 /* ShorthandPropertyAssignment */ || prop.kind === 151 /* MethodDeclaration */ + var currentKind = prop.kind === 264 /* PropertyAssignment */ || prop.kind === 265 /* ShorthandPropertyAssignment */ || prop.kind === 151 /* MethodDeclaration */ ? 1 /* Property */ : 2 /* Accessor */; var existingKind = seen.get(identifier.escapedText); @@ -20749,7 +20847,7 @@ var ts; case 233 /* ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 265 /* SourceFile */: + case 268 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -20859,7 +20957,7 @@ var ts; function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 /* ES2015 */) { // Report error if function is not top level function declaration - if (blockScopeContainer.kind !== 265 /* SourceFile */ && + if (blockScopeContainer.kind !== 268 /* SourceFile */ && blockScopeContainer.kind !== 233 /* ModuleDeclaration */ && !ts.isFunctionLike(blockScopeContainer)) { // We check first if the name is inside class declaration or class expression; if so give explicit message @@ -20962,7 +21060,7 @@ var ts; } for (var _b = 0, _c = jsDoc.tags; _b < _c.length; _b++) { var tag = _c[_b]; - if (tag.kind === 283 /* JSDocTypedefTag */) { + if (tag.kind === 286 /* JSDocTypedefTag */) { var savedParent = parent; parent = jsDoc; bind(tag); @@ -21001,7 +21099,7 @@ var ts; // current "blockScopeContainer" needs to be set to its immediate namespace parent. if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 283 /* JSDocTypedefTag */) { + while (parentNode && parentNode.kind !== 286 /* JSDocTypedefTag */) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); @@ -21009,7 +21107,7 @@ var ts; } // falls through case 99 /* ThisKeyword */: - if (currentFlow && (ts.isExpression(node) || parent.kind === 262 /* ShorthandPropertyAssignment */)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 265 /* ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); @@ -21043,7 +21141,7 @@ var ts; ts.Debug.fail("Unknown special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return checkStrictModeCatchClause(node); case 188 /* DeleteExpression */: return checkStrictModeDeleteExpression(node); @@ -21072,10 +21170,10 @@ var ts; case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: return bindPropertyWorker(node); - case 261 /* PropertyAssignment */: - case 262 /* ShorthandPropertyAssignment */: + case 264 /* PropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */); - case 264 /* EnumMember */: + case 267 /* EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 900095 /* EnumMemberExcludes */); case 155 /* CallSignature */: case 156 /* ConstructSignature */: @@ -21097,11 +21195,11 @@ var ts; case 154 /* SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */); case 160 /* FunctionType */: - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: case 161 /* ConstructorType */: return bindFunctionOrConstructorType(node); case 163 /* TypeLiteral */: - case 285 /* JSDocTypeLiteral */: + case 288 /* JSDocTypeLiteral */: case 172 /* MappedType */: return bindAnonymousTypeWorker(node); case 178 /* ObjectLiteralExpression */: @@ -21129,9 +21227,9 @@ var ts; case 233 /* ModuleDeclaration */: return bindModuleDeclaration(node); // Jsx-attributes - case 254 /* JsxAttributes */: + case 257 /* JsxAttributes */: return bindJsxAttributes(node); - case 253 /* JsxAttribute */: + case 256 /* JsxAttribute */: return bindJsxAttribute(node, 4 /* Property */, 0 /* PropertyExcludes */); // Imports and exports case 237 /* ImportEqualsDeclaration */: @@ -21147,7 +21245,7 @@ var ts; return bindExportDeclaration(node); case 243 /* ExportAssignment */: return bindExportAssignment(node); - case 265 /* SourceFile */: + case 268 /* SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); case 207 /* Block */: @@ -21157,18 +21255,18 @@ var ts; // falls through case 234 /* ModuleBlock */: return updateStrictModeStatementList(node.statements); - case 279 /* JSDocParameterTag */: - if (node.parent.kind !== 285 /* JSDocTypeLiteral */) { + case 282 /* JSDocParameterTag */: + if (node.parent.kind !== 288 /* JSDocTypeLiteral */) { break; } // falls through - case 284 /* JSDocPropertyTag */: + case 287 /* JSDocPropertyTag */: var propTag = node; - var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 272 /* JSDocOptionalType */ ? + var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 275 /* JSDocOptionalType */ ? 4 /* Property */ | 16777216 /* Optional */ : 4 /* Property */; return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* PropertyExcludes */); - case 283 /* JSDocTypedefTag */: { + case 286 /* JSDocTypedefTag */: { var fullName = node.fullName; if (!fullName || fullName.kind === 71 /* Identifier */) { return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); @@ -21223,7 +21321,7 @@ var ts; if (node.modifiers && node.modifiers.length) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); } - if (node.parent.kind !== 265 /* SourceFile */) { + if (node.parent.kind !== 268 /* SourceFile */) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); return; } @@ -21587,9 +21685,9 @@ var ts; return computeClassDeclaration(node, subtreeFlags); case 199 /* ClassExpression */: return computeClassExpression(node, subtreeFlags); - case 259 /* HeritageClause */: + case 262 /* HeritageClause */: return computeHeritageClause(node, subtreeFlags); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return computeCatchClause(node, subtreeFlags); case 201 /* ExpressionWithTypeArguments */: return computeExpressionWithTypeArguments(node, subtreeFlags); @@ -22093,7 +22191,7 @@ var ts; case 124 /* DeclareKeyword */: case 76 /* ConstKeyword */: case 232 /* EnumDeclaration */: - case 264 /* EnumMember */: + case 267 /* EnumMember */: case 184 /* TypeAssertionExpression */: case 202 /* AsExpression */: case 203 /* NonNullExpression */: @@ -22106,10 +22204,13 @@ var ts; case 251 /* JsxOpeningElement */: case 10 /* JsxText */: case 252 /* JsxClosingElement */: - case 253 /* JsxAttribute */: - case 254 /* JsxAttributes */: - case 255 /* JsxSpreadAttribute */: - case 256 /* JsxExpression */: + case 253 /* JsxFragment */: + case 254 /* JsxOpeningFragment */: + case 255 /* JsxClosingFragment */: + case 256 /* JsxAttribute */: + case 257 /* JsxAttributes */: + case 258 /* JsxSpreadAttribute */: + case 259 /* JsxExpression */: // These nodes are Jsx syntax. transformFlags |= 4 /* AssertJsx */; break; @@ -22119,7 +22220,7 @@ var ts; case 16 /* TemplateTail */: case 196 /* TemplateExpression */: case 183 /* TaggedTemplateExpression */: - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: case 115 /* StaticKeyword */: case 204 /* MetaProperty */: // These nodes are ES6 syntax. @@ -22204,7 +22305,7 @@ var ts; case 198 /* SpreadElement */: transformFlags |= 192 /* AssertES2015 */ | 524288 /* ContainsSpread */; break; - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectSpread */; break; case 97 /* SuperKeyword */: @@ -22272,7 +22373,7 @@ var ts; transformFlags |= 192 /* AssertES2015 */; } break; - case 265 /* SourceFile */: + case 268 /* SourceFile */: if (subtreeFlags & 32768 /* ContainsCapturedLexicalThis */) { transformFlags |= 192 /* AssertES2015 */; } @@ -22342,7 +22443,7 @@ var ts; return -3 /* TypeExcludes */; case 178 /* ObjectLiteralExpression */: return 540087617 /* ObjectLiteralExcludes */; - case 260 /* CatchClause */: + case 263 /* CatchClause */: return 537920833 /* CatchClauseExcludes */; case 174 /* ObjectBindingPattern */: case 175 /* ArrayBindingPattern */: @@ -24235,7 +24336,7 @@ var ts; return type.flags & 32768 /* Object */ ? type.objectFlags : 0; } function isGlobalSourceFile(node) { - return node.kind === 265 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 268 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -24401,7 +24502,7 @@ var ts; // - parameters are only in the scope of function body // This restriction does not apply to JSDoc comment types because they are parented // at a higher level than type parameters would normally be - if (meaning & result.flags & 793064 /* Type */ && lastLocation.kind !== 275 /* JSDocComment */) { + if (meaning & result.flags & 793064 /* Type */ && lastLocation.kind !== 278 /* JSDocComment */) { useResult = result.flags & 262144 /* TypeParameter */ // type parameters are visible in parameter list, return type and type parameter list ? lastLocation === location.type || @@ -24430,14 +24531,14 @@ var ts; } } switch (location.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; // falls through case 233 /* ModuleDeclaration */: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 265 /* SourceFile */ || ts.isAmbientModule(location)) { + if (location.kind === 268 /* SourceFile */ || ts.isAmbientModule(location)) { // It's an external module. First see if the module has an export default and if the local // name of that export default matches. if (result = moduleExports.get("default")) { @@ -24610,7 +24711,7 @@ var ts; } if (!result) { if (lastLocation) { - ts.Debug.assert(lastLocation.kind === 265 /* SourceFile */); + ts.Debug.assert(lastLocation.kind === 268 /* SourceFile */); if (lastLocation.commonJsModuleIndicator && name === "exports") { return lastLocation.symbol; } @@ -25435,7 +25536,7 @@ var ts; } } switch (location.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } @@ -25626,7 +25727,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 265 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 268 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -25932,7 +26033,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || // is exported function symbol ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 265 /* SourceFile */ || declaration.parent.kind === 234 /* ModuleBlock */; + return declaration.parent.kind === 268 /* SourceFile */ || declaration.parent.kind === 234 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -26699,7 +26800,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || // is exported function symbol ts.some(symbol.declarations, function (declaration) { - return declaration.parent.kind === 265 /* SourceFile */ || declaration.parent.kind === 234 /* ModuleBlock */; + return declaration.parent.kind === 268 /* SourceFile */ || declaration.parent.kind === 234 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -27109,7 +27210,7 @@ var ts; var parent = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedModifierFlags(node) & 1 /* Export */) && - !(node.kind !== 237 /* ImportEqualsDeclaration */ && parent.kind !== 265 /* SourceFile */ && ts.isInAmbientContext(parent))) { + !(node.kind !== 237 /* ImportEqualsDeclaration */ && parent.kind !== 268 /* SourceFile */ && ts.isInAmbientContext(parent))) { return isGlobalSourceFile(parent); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible @@ -27151,7 +27252,7 @@ var ts; // Type parameters are always visible case 145 /* TypeParameter */: // Source file and namespace export are always visible - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 236 /* NamespaceExportDeclaration */: return true; // Export assignments do not create name bindings outside the module @@ -27504,7 +27605,7 @@ var ts; return trueType; } // If it is a short-hand property assignment, use the type of the identifier - if (declaration.kind === 262 /* ShorthandPropertyAssignment */) { + if (declaration.kind === 265 /* ShorthandPropertyAssignment */) { return checkIdentifier(declaration.name); } // If the declaration specifies a binding pattern, use the type implied by the binding pattern @@ -27648,7 +27749,7 @@ var ts; // During a normal type check we'll never get to here with a property assignment (the check of the containing // object literal uses a different path). We exclude widening only so that language services and type verification // tools see the actual type. - if (declaration.kind === 261 /* PropertyAssignment */) { + if (declaration.kind === 264 /* PropertyAssignment */) { return type; } return getWidenedType(type); @@ -27935,13 +28036,13 @@ var ts; case 150 /* MethodSignature */: case 160 /* FunctionType */: case 161 /* ConstructorType */: - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: case 228 /* FunctionDeclaration */: case 151 /* MethodDeclaration */: case 186 /* FunctionExpression */: case 187 /* ArrowFunction */: case 231 /* TypeAliasDeclaration */: - case 282 /* JSDocTemplateTag */: + case 285 /* JSDocTemplateTag */: case 172 /* MappedType */: var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); if (node.kind === 172 /* MappedType */) { @@ -28237,9 +28338,9 @@ var ts; return unknownType; } var declaration = ts.find(symbol.declarations, function (d) { - return d.kind === 283 /* JSDocTypedefTag */ || d.kind === 231 /* TypeAliasDeclaration */; + return d.kind === 286 /* JSDocTypedefTag */ || d.kind === 231 /* TypeAliasDeclaration */; }); - var typeNode = declaration.kind === 283 /* JSDocTypedefTag */ ? declaration.typeExpression : declaration.type; + var typeNode = declaration.kind === 286 /* JSDocTypedefTag */ ? declaration.typeExpression : declaration.type; // If typeNode is missing, we will error in checkJSDocTypedefTag. var type = typeNode ? getTypeFromTypeNode(typeNode) : unknownType; if (popTypeResolution()) { @@ -29346,7 +29447,7 @@ var ts; } function isJSDocOptionalParameter(node) { if (ts.isInJavaScriptFile(node)) { - if (node.type && node.type.kind === 272 /* JSDocOptionalType */) { + if (node.type && node.type.kind === 275 /* JSDocOptionalType */) { return true; } var paramTags = ts.getJSDocParameterTags(node); @@ -29357,7 +29458,7 @@ var ts; return true; } if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 272 /* JSDocOptionalType */; + return paramTag.typeExpression.type.kind === 275 /* JSDocOptionalType */; } } } @@ -29594,7 +29695,7 @@ var ts; case 154 /* SetAccessor */: case 186 /* FunctionExpression */: case 187 /* ArrowFunction */: - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: // Don't include signature if node is the implementation of an overloaded function. A node is considered // an implementation node if it has a body and the previous node is of the same kind and immediately // precedes the implementation node (i.e. has the same parent and ends where the implementation starts). @@ -30916,8 +31017,8 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 119 /* AnyKeyword */: - case 268 /* JSDocAllType */: - case 269 /* JSDocUnknownType */: + case 271 /* JSDocAllType */: + case 272 /* JSDocUnknownType */: return anyType; case 136 /* StringKeyword */: return stringType; @@ -30958,18 +31059,18 @@ var ts; return getTypeFromUnionTypeNode(node); case 167 /* IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 270 /* JSDocNullableType */: + case 273 /* JSDocNullableType */: return getTypeFromJSDocNullableTypeNode(node); case 168 /* ParenthesizedType */: - case 271 /* JSDocNonNullableType */: - case 272 /* JSDocOptionalType */: - case 267 /* JSDocTypeExpression */: + case 274 /* JSDocNonNullableType */: + case 275 /* JSDocOptionalType */: + case 270 /* JSDocTypeExpression */: return getTypeFromTypeNode(node.type); case 160 /* FunctionType */: case 161 /* ConstructorType */: case 163 /* TypeLiteral */: - case 285 /* JSDocTypeLiteral */: - case 273 /* JSDocFunctionType */: + case 288 /* JSDocTypeLiteral */: + case 276 /* JSDocFunctionType */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 170 /* TypeOperator */: return getTypeFromTypeOperatorNode(node); @@ -30983,7 +31084,7 @@ var ts; case 143 /* QualifiedName */: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); - case 274 /* JSDocVariadicType */: + case 277 /* JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); default: return unknownType; @@ -31277,16 +31378,16 @@ var ts; case 194 /* BinaryExpression */: return node.operatorToken.kind === 54 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: return isContextSensitive(node.initializer); case 185 /* ParenthesizedExpression */: return isContextSensitive(node.expression); - case 254 /* JsxAttributes */: + case 257 /* JsxAttributes */: return ts.forEach(node.properties, isContextSensitive); - case 253 /* JsxAttribute */: + case 256 /* JsxAttribute */: // If there is no initializer, JSX attribute has a boolean value of true which is not context sensitive. return node.initializer && isContextSensitive(node.initializer); - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: // It is possible to that node.expression is undefined (e.g
) return node.expression && isContextSensitive(node.expression); } @@ -34042,7 +34143,7 @@ var ts; } function getAssignedTypeOfBinaryExpression(node) { var isDestructuringDefaultAssignment = node.parent.kind === 177 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || - node.parent.kind === 261 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); + node.parent.kind === 264 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); @@ -34078,9 +34179,9 @@ var ts; return getAssignedTypeOfArrayLiteralElement(parent, node); case 198 /* SpreadElement */: return getAssignedTypeOfSpreadExpression(parent); - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent); - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return unknownType; @@ -34152,7 +34253,7 @@ var ts; getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 257 /* CaseClause */) { + if (clause.kind === 260 /* CaseClause */) { var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } @@ -34985,7 +35086,7 @@ var ts; return ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || node.kind === 234 /* ModuleBlock */ || - node.kind === 265 /* SourceFile */ || + node.kind === 268 /* SourceFile */ || node.kind === 149 /* PropertyDeclaration */; }); } @@ -35197,7 +35298,7 @@ var ts; function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 /* ES2015 */ || (symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 || - symbol.valueDeclaration.parent.kind === 260 /* CatchClause */) { + symbol.valueDeclaration.parent.kind === 263 /* CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -35406,7 +35507,7 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 273 /* JSDocFunctionType */) { + if (jsdocType && jsdocType.kind === 276 /* JSDocFunctionType */) { var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && @@ -35600,7 +35701,7 @@ var ts; return (func.kind === 151 /* MethodDeclaration */ || func.kind === 153 /* GetAccessor */ || func.kind === 154 /* SetAccessor */) && func.parent.kind === 178 /* ObjectLiteralExpression */ ? func.parent : - func.kind === 186 /* FunctionExpression */ && func.parent.kind === 261 /* PropertyAssignment */ ? func.parent.parent : + func.kind === 186 /* FunctionExpression */ && func.parent.kind === 264 /* PropertyAssignment */ ? func.parent.parent : undefined; } function getThisTypeArgument(type) { @@ -35639,7 +35740,7 @@ var ts; if (thisType) { return instantiateType(thisType, getContextualMapper(containingLiteral)); } - if (literal.parent.kind !== 261 /* PropertyAssignment */) { + if (literal.parent.kind !== 264 /* PropertyAssignment */) { break; } literal = literal.parent.parent; @@ -35928,7 +36029,12 @@ var ts; // JSX expression can appear in two position : JSX Element's children or JSX attribute var jsxAttributes = ts.isJsxAttributeLike(node.parent) ? node.parent.parent : - node.parent.openingElement.attributes; // node.parent is JsxElement + ts.isJsxElement(node.parent) ? + node.parent.openingElement.attributes : + undefined; // node.parent is JsxFragment with no attributes + if (!jsxAttributes) { + return undefined; // don't check children of a fragment + } // When we trying to resolve JsxOpeningLikeElement as a stateless function element, we will already give its attributes a contextual type // which is a type of the parameter of the signature we are trying out. // If there is no contextual type (e.g. we are trying to resolve stateful component), get attributes type from resolving element's tagName @@ -36017,10 +36123,10 @@ var ts; return getTypeFromTypeNode(parent.type); case 194 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 261 /* PropertyAssignment */: - case 262 /* ShorthandPropertyAssignment */: + case 264 /* PropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent); - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: return getApparentTypeOfContextualType(parent.parent); case 177 /* ArrayLiteralExpression */: { var arrayLiteral = parent; @@ -36037,10 +36143,10 @@ var ts; var tag = ts.isInJavaScriptFile(parent) ? ts.getJSDocTypeTag(parent) : undefined; return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(parent); } - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: return getContextualTypeForJsxExpression(parent); - case 253 /* JsxAttribute */: - case 255 /* JsxSpreadAttribute */: + case 256 /* JsxAttribute */: + case 258 /* JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent); case 251 /* JsxOpeningElement */: case 250 /* JsxSelfClosingElement */: @@ -36313,15 +36419,15 @@ var ts; var memberDecl = node.properties[i]; var member = memberDecl.symbol; var literalName = void 0; - if (memberDecl.kind === 261 /* PropertyAssignment */ || - memberDecl.kind === 262 /* ShorthandPropertyAssignment */ || + if (memberDecl.kind === 264 /* PropertyAssignment */ || + memberDecl.kind === 265 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { var jsdocType = void 0; if (isInJSFile) { jsdocType = getTypeForDeclarationFromJSDocComment(memberDecl); } var type = void 0; - if (memberDecl.kind === 261 /* PropertyAssignment */) { + if (memberDecl.kind === 264 /* PropertyAssignment */) { if (memberDecl.name.kind === 144 /* ComputedPropertyName */) { var t = checkComputedPropertyName(memberDecl.name); if (t.flags & 224 /* Literal */) { @@ -36334,7 +36440,7 @@ var ts; type = checkObjectLiteralMethod(memberDecl, checkMode); } else { - ts.Debug.assert(memberDecl.kind === 262 /* ShorthandPropertyAssignment */); + ts.Debug.assert(memberDecl.kind === 265 /* ShorthandPropertyAssignment */); type = checkExpressionForMutableLocation(memberDecl.name, checkMode); } if (jsdocType) { @@ -36346,8 +36452,8 @@ var ts; if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. - var isOptional = (memberDecl.kind === 261 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 262 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 264 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 265 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 16777216 /* Optional */; } @@ -36375,7 +36481,7 @@ var ts; prop.target = member; member = prop; } - else if (memberDecl.kind === 263 /* SpreadAssignment */) { + else if (memberDecl.kind === 266 /* SpreadAssignment */) { if (languageVersion < 2 /* ES2015 */) { checkExternalEmitHelpers(memberDecl, 2 /* Assign */); } @@ -36465,12 +36571,12 @@ var ts; type.flags & 196608 /* UnionOrIntersection */ && !ts.forEach(type.types, function (t) { return !isValidSpreadType(t); })); } function checkJsxSelfClosingElement(node) { - checkJsxOpeningLikeElement(node); + checkJsxOpeningLikeElementOrOpeningFragment(node); return getJsxGlobalElementType() || anyType; } function checkJsxElement(node) { // Check attributes - checkJsxOpeningLikeElement(node.openingElement); + checkJsxOpeningLikeElementOrOpeningFragment(node.openingElement); // Perform resolution on the closing tag so that rename/go to definition/etc work if (isJsxIntrinsicIdentifier(node.closingElement.tagName)) { getIntrinsicTagSymbol(node.closingElement); @@ -36480,6 +36586,13 @@ var ts; } return getJsxGlobalElementType() || anyType; } + function checkJsxFragment(node) { + checkJsxOpeningLikeElementOrOpeningFragment(node.openingFragment); + if (compilerOptions.jsx === 2 /* React */ && compilerOptions.jsxFactory) { + error(node, ts.Diagnostics.JSX_fragment_is_not_supported_when_using_jsxFactory); + } + return getJsxGlobalElementType() || anyType; + } /** * Returns true iff the JSX element name would be a valid JS identifier, ignoring restrictions about keywords not being identifiers */ @@ -36542,7 +36655,7 @@ var ts; } } else { - ts.Debug.assert(attributeDecl.kind === 255 /* JsxSpreadAttribute */); + ts.Debug.assert(attributeDecl.kind === 258 /* JsxSpreadAttribute */); if (attributesArray.length > 0) { spread = getSpreadType(spread, createJsxAttributesType(attributes.symbol, attributesTable), openingLikeElement.symbol, /*propagatedFlags*/ 0); attributesArray = []; @@ -36579,20 +36692,7 @@ var ts; var parent = openingLikeElement.parent.kind === 249 /* JsxElement */ ? openingLikeElement.parent : undefined; // We have to check that openingElement of the parent is the one we are visiting as this may not be true for selfClosingElement if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) { - var childrenTypes = []; - for (var _c = 0, _d = parent.children; _c < _d.length; _c++) { - var child = _d[_c]; - // In React, JSX text that contains only whitespaces will be ignored so we don't want to type-check that - // because then type of children property will have constituent of string type. - if (child.kind === 10 /* JsxText */) { - if (!child.containsOnlyWhiteSpaces) { - childrenTypes.push(stringType); - } - } - else { - childrenTypes.push(checkExpression(child, checkMode)); - } - } + var childrenTypes = checkJsxChildren(parent, checkMode); if (!hasSpreadAnyType && jsxChildrenPropertyName && jsxChildrenPropertyName !== "") { // Error if there is a attribute named "children" explicitly specified and children element. // This is because children element will overwrite the value from attributes. @@ -36626,6 +36726,23 @@ var ts; return result; } } + function checkJsxChildren(node, checkMode) { + var childrenTypes = []; + for (var _i = 0, _a = node.children; _i < _a.length; _i++) { + var child = _a[_i]; + // In React, JSX text that contains only whitespaces will be ignored so we don't want to type-check that + // because then type of children property will have constituent of string type. + if (child.kind === 10 /* JsxText */) { + if (!child.containsOnlyWhiteSpaces) { + childrenTypes.push(stringType); + } + } + else { + childrenTypes.push(checkExpression(child, checkMode)); + } + } + return childrenTypes; + } /** * Check attributes property of opening-like element. This function is called during chooseOverload to get call signature of a JSX opening-like element. * (See "checkApplicableSignatureForJsxOpeningLikeElement" for how the function is used) @@ -37093,14 +37210,18 @@ var ts; } } } - function checkJsxOpeningLikeElement(node) { - checkGrammarJsxElement(node); + function checkJsxOpeningLikeElementOrOpeningFragment(node) { + var isNodeOpeningLikeElement = ts.isJsxOpeningLikeElement(node); + if (isNodeOpeningLikeElement) { + checkGrammarJsxElement(node); + } checkJsxPreconditions(node); // The reactNamespace/jsxFactory's root symbol should be marked as 'used' so we don't incorrectly elide its import. // And if there is no reactNamespace/jsxFactory's symbol in scope when targeting React emit, we should issue an error. var reactRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? ts.Diagnostics.Cannot_find_name_0 : undefined; var reactNamespace = getJsxNamespace(); - var reactSym = resolveName(node.tagName, reactNamespace, 107455 /* Value */, reactRefErr, reactNamespace, /*isUse*/ true); + var reactLocation = isNodeOpeningLikeElement ? node.tagName : node; + var reactSym = resolveName(reactLocation, reactNamespace, 107455 /* Value */, reactRefErr, reactNamespace, /*isUse*/ true); if (reactSym) { // Mark local symbol as referenced here because it might not have been marked // if jsx emit was not react as there wont be error being emitted @@ -37110,7 +37231,12 @@ var ts; markAliasSymbolAsReferenced(reactSym); } } - checkJsxAttributesAssignableToTagNameAttributes(node); + if (isNodeOpeningLikeElement) { + checkJsxAttributesAssignableToTagNameAttributes(node); + } + else { + checkJsxChildren(node.parent); + } } /** * Check if a property with the given name is known anywhere in the given type. In an object type, a property @@ -37393,7 +37519,7 @@ var ts; switch (node.kind) { case 149 /* PropertyDeclaration */: return true; - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: // We might be in `a = { b: this.b }`, so keep looking. See `tests/cases/compiler/useBeforeDeclaration_propertyAssignment.ts`. return false; default: @@ -39769,7 +39895,7 @@ var ts; } /** Note: If property cannot be a SpreadAssignment, then allProperties does not need to be provided */ function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { - if (property.kind === 261 /* PropertyAssignment */ || property.kind === 262 /* ShorthandPropertyAssignment */) { + if (property.kind === 264 /* PropertyAssignment */ || property.kind === 265 /* ShorthandPropertyAssignment */) { var name = property.name; if (name.kind === 144 /* ComputedPropertyName */) { checkComputedPropertyName(name); @@ -39784,7 +39910,7 @@ var ts; isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1 /* Number */) || getIndexTypeOfType(objectLiteralType, 0 /* String */); if (type) { - if (property.kind === 262 /* ShorthandPropertyAssignment */) { + if (property.kind === 265 /* ShorthandPropertyAssignment */) { return checkDestructuringAssignment(property, type); } else { @@ -39796,7 +39922,7 @@ var ts; error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name)); } } - else if (property.kind === 263 /* SpreadAssignment */) { + else if (property.kind === 266 /* SpreadAssignment */) { if (languageVersion < 5 /* ESNext */) { checkExternalEmitHelpers(property, 4 /* Rest */); } @@ -39872,7 +39998,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode) { var target; - if (exprOrAssignment.kind === 262 /* ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 265 /* ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { // In strict null checking mode, if a default value of a non-undefined type is specified, remove @@ -39902,7 +40028,7 @@ var ts; } function checkReferenceAssignment(target, sourceType, checkMode) { var targetType = checkExpression(target, checkMode); - var error = target.parent.kind === 263 /* SpreadAssignment */ ? + var error = target.parent.kind === 266 /* SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; if (checkReferenceExpression(target, error)) { @@ -40501,13 +40627,15 @@ var ts; return undefinedWideningType; case 197 /* YieldExpression */: return checkYieldExpression(node); - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: return checkJsxExpression(node, checkMode); case 249 /* JsxElement */: return checkJsxElement(node); case 250 /* JsxSelfClosingElement */: return checkJsxSelfClosingElement(node); - case 254 /* JsxAttributes */: + case 253 /* JsxFragment */: + return checkJsxFragment(node); + case 257 /* JsxAttributes */: return checkJsxAttributes(node, checkMode); case 251 /* JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); @@ -41445,7 +41573,7 @@ var ts; case 230 /* InterfaceDeclaration */: case 231 /* TypeAliasDeclaration */: // A jsdoc typedef is, by definition, a type alias - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return 2 /* ExportType */; case 233 /* ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ @@ -41912,7 +42040,7 @@ var ts; error(classLike, ts.Diagnostics.JSDoc_0_is_not_attached_to_a_class, ts.idText(node.tagName)); return; } - var augmentsTags = ts.getAllJSDocTagsOfKind(classLike, 277 /* JSDocAugmentsTag */); + var augmentsTags = ts.getAllJSDocTagsOfKind(classLike, 280 /* JSDocAugmentsTag */); ts.Debug.assert(augmentsTags.length > 0); if (augmentsTags.length > 1) { error(augmentsTags[1], ts.Diagnostics.Class_declarations_cannot_have_more_than_one_augments_or_extends_tag); @@ -42005,7 +42133,7 @@ var ts; for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) { var node = deferredUnusedIdentifierNodes_1[_i]; switch (node.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 233 /* ModuleDeclaration */: checkUnusedModuleMembers(node); break; @@ -42278,7 +42406,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 265 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 268 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -42293,7 +42421,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 265 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { + if (parent.kind === 268 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -42350,7 +42478,7 @@ var ts; (container.kind === 207 /* Block */ && ts.isFunctionLike(container.parent) || container.kind === 234 /* ModuleBlock */ || container.kind === 233 /* ModuleDeclaration */ || - container.kind === 265 /* SourceFile */); + container.kind === 268 /* SourceFile */); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error // otherwise if variable has an initializer - show error that initialization will fail @@ -43091,7 +43219,7 @@ var ts; var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 258 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 261 /* DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -43103,7 +43231,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 257 /* CaseClause */) { + if (produceDiagnostics && clause.kind === 260 /* CaseClause */) { var caseClause = clause; // TypeScript 1.0 spec (April 2014): 5.9 // In a 'switch' statement, each 'case' expression must be of a type that is comparable @@ -43776,7 +43904,7 @@ var ts; var declaration = memberSymbol.valueDeclaration; if (declaration !== member) { if (isBlockScopedNameDeclaredBeforeUse(declaration, member)) { - return getNodeLinks(declaration).enumMemberValue; + return getEnumMemberValue(declaration); } error(expr, ts.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums); return 0; @@ -44041,7 +44169,7 @@ var ts; return false; } var inAmbientExternalModule = node.parent.kind === 234 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 265 /* SourceFile */ && !inAmbientExternalModule) { + if (node.parent.kind !== 268 /* SourceFile */ && !inAmbientExternalModule) { error(moduleName, node.kind === 244 /* ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); @@ -44170,7 +44298,7 @@ var ts; var inAmbientExternalModule = node.parent.kind === 234 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 234 /* ModuleBlock */ && !node.moduleSpecifier && ts.isInAmbientContext(node); - if (node.parent.kind !== 265 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + if (node.parent.kind !== 268 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -44187,7 +44315,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 265 /* SourceFile */ || node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 233 /* ModuleDeclaration */; + var isInAppropriateContext = node.parent.kind === 268 /* SourceFile */ || node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 233 /* ModuleDeclaration */; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -44213,7 +44341,7 @@ var ts; // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors. return; } - var container = node.parent.kind === 265 /* SourceFile */ ? node.parent : node.parent.parent; + var container = node.parent.kind === 268 /* SourceFile */ ? node.parent : node.parent.parent; if (container.kind === 233 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); @@ -44363,25 +44491,25 @@ var ts; case 168 /* ParenthesizedType */: case 170 /* TypeOperator */: return checkSourceElement(node.type); - case 277 /* JSDocAugmentsTag */: + case 280 /* JSDocAugmentsTag */: return checkJSDocAugmentsTag(node); - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return checkJSDocTypedefTag(node); - case 279 /* JSDocParameterTag */: + case 282 /* JSDocParameterTag */: return checkJSDocParameterTag(node); - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: checkSignatureDeclaration(node); // falls through - case 274 /* JSDocVariadicType */: - case 271 /* JSDocNonNullableType */: - case 270 /* JSDocNullableType */: - case 268 /* JSDocAllType */: - case 269 /* JSDocUnknownType */: + case 277 /* JSDocVariadicType */: + case 274 /* JSDocNonNullableType */: + case 273 /* JSDocNullableType */: + case 271 /* JSDocAllType */: + case 272 /* JSDocUnknownType */: if (!ts.isInJavaScriptFile(node) && !ts.isInJSDoc(node)) { grammarErrorOnNode(node, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); } return; - case 267 /* JSDocTypeExpression */: + case 270 /* JSDocTypeExpression */: return checkSourceElement(node.type); case 171 /* IndexedAccessType */: return checkIndexedAccessType(node); @@ -44794,10 +44922,10 @@ var ts; return entityNameSymbol; } } - if (entityName.parent.kind === 279 /* JSDocParameterTag */) { + if (entityName.parent.kind === 282 /* JSDocParameterTag */) { return ts.getParameterSymbolFromJSDoc(entityName.parent); } - if (entityName.parent.kind === 145 /* TypeParameter */ && entityName.parent.parent.kind === 282 /* JSDocTemplateTag */) { + if (entityName.parent.kind === 145 /* TypeParameter */ && entityName.parent.parent.kind === 285 /* JSDocTemplateTag */) { ts.Debug.assert(!ts.isInJavaScriptFile(entityName)); // Otherwise `isDeclarationName` would have been true. var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent); return typeParameter && typeParameter.symbol; @@ -44831,7 +44959,7 @@ var ts; var meaning = entityName.parent.kind === 159 /* TypeReference */ ? 793064 /* Type */ : 1920 /* Namespace */; return resolveEntityName(entityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); } - else if (entityName.parent.kind === 253 /* JsxAttribute */) { + else if (entityName.parent.kind === 256 /* JsxAttribute */) { return getJsxAttributePropertySymbol(entityName.parent); } if (entityName.parent.kind === 158 /* TypePredicate */) { @@ -44841,7 +44969,7 @@ var ts; return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 265 /* SourceFile */) { + if (node.kind === 268 /* SourceFile */) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } if (isInsideWithStatementBody(node)) { @@ -44925,7 +45053,7 @@ var ts; // The function returns a value symbol of an identifier in the short-hand property assignment. // This is necessary as an identifier in short-hand property assignment can contains two meaning: // property name and property value. - if (location && location.kind === 262 /* ShorthandPropertyAssignment */) { + if (location && location.kind === 265 /* ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 107455 /* Value */ | 2097152 /* Alias */); } return undefined; @@ -45012,7 +45140,7 @@ var ts; } // If this is from nested object binding pattern // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { - if (expr.parent.kind === 261 /* PropertyAssignment */) { + if (expr.parent.kind === 264 /* PropertyAssignment */) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); } @@ -45157,7 +45285,7 @@ var ts; } var parentSymbol_1 = getParentOfSymbol(symbol); if (parentSymbol_1) { - if (parentSymbol_1.flags & 512 /* ValueModule */ && parentSymbol_1.valueDeclaration.kind === 265 /* SourceFile */) { + if (parentSymbol_1.flags & 512 /* ValueModule */ && parentSymbol_1.valueDeclaration.kind === 268 /* SourceFile */) { var symbolFile = parentSymbol_1.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); // If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined. @@ -45272,7 +45400,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(node) { node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 265 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 268 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -45345,7 +45473,7 @@ var ts; } function canHaveConstantValue(node) { switch (node.kind) { - case 264 /* EnumMember */: + case 267 /* EnumMember */: case 179 /* PropertyAccessExpression */: case 180 /* ElementAccessExpression */: return true; @@ -45353,7 +45481,7 @@ var ts; return false; } function getConstantValue(node) { - if (node.kind === 264 /* EnumMember */) { + if (node.kind === 267 /* EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -45615,7 +45743,7 @@ var ts; break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 265 /* SourceFile */ && current.flags & 512 /* ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 268 /* SourceFile */ && current.flags & 512 /* ValueModule */) { return false; } // check that at least one declaration of top level symbol originates from type declaration file @@ -45635,7 +45763,7 @@ var ts; if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 265 /* SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 268 /* SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors @@ -45805,7 +45933,7 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 265 /* SourceFile */) { + else if (node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 268 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128 /* Abstract */) { @@ -45828,7 +45956,7 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 265 /* SourceFile */) { + else if (node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 268 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } else if (node.kind === 146 /* Parameter */) { @@ -45873,7 +46001,7 @@ var ts; flags |= 1 /* Export */; break; case 79 /* DefaultKeyword */: - var container = node.parent.kind === 265 /* SourceFile */ ? node.parent : node.parent.parent; + var container = node.parent.kind === 268 /* SourceFile */ ? node.parent : node.parent.parent; if (container.kind === 233 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } @@ -45995,7 +46123,7 @@ var ts; case 146 /* Parameter */: return false; default: - if (node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 265 /* SourceFile */) { + if (node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 268 /* SourceFile */) { return false; } switch (node.kind) { @@ -46258,7 +46386,7 @@ var ts; var GetOrSetAccessor = GetAccessor | SetAccessor; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 263 /* SpreadAssignment */) { + if (prop.kind === 266 /* SpreadAssignment */) { continue; } var name = prop.name; @@ -46266,7 +46394,7 @@ var ts; // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name); } - if (prop.kind === 262 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 265 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); @@ -46289,7 +46417,7 @@ 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 = void 0; - if (prop.kind === 261 /* PropertyAssignment */ || prop.kind === 262 /* ShorthandPropertyAssignment */) { + if (prop.kind === 264 /* PropertyAssignment */ || prop.kind === 265 /* ShorthandPropertyAssignment */) { // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name.kind === 8 /* NumericLiteral */) { @@ -46339,7 +46467,7 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 255 /* JsxSpreadAttribute */) { + if (attr.kind === 258 /* JsxSpreadAttribute */) { continue; } var jsxAttr = attr; @@ -46351,7 +46479,7 @@ var ts; return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 256 /* JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 259 /* JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -46791,7 +46919,7 @@ var ts; // to prevent noisiness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 207 /* Block */ || node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 265 /* SourceFile */) { + if (node.parent.kind === 207 /* Block */ || node.parent.kind === 234 /* ModuleBlock */ || node.parent.kind === 268 /* SourceFile */) { var links_1 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_1.hasReportedStatementInAmbientContext) { @@ -46815,7 +46943,7 @@ var ts; else if (ts.isChildOfNodeWithKind(node, 173 /* LiteralType */)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 264 /* EnumMember */)) { + else if (ts.isChildOfNodeWithKind(node, 267 /* EnumMember */)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -48723,8 +48851,24 @@ var ts; : node; } ts.updateJsxClosingElement = updateJsxClosingElement; + function createJsxFragment(openingFragment, children, closingFragment) { + var node = createSynthesizedNode(253 /* JsxFragment */); + node.openingFragment = openingFragment; + node.children = createNodeArray(children); + node.closingFragment = closingFragment; + return node; + } + ts.createJsxFragment = createJsxFragment; + function updateJsxFragment(node, openingFragment, children, closingFragment) { + return node.openingFragment !== openingFragment + || node.children !== children + || node.closingFragment !== closingFragment + ? updateNode(createJsxFragment(openingFragment, children, closingFragment), node) + : node; + } + ts.updateJsxFragment = updateJsxFragment; function createJsxAttribute(name, initializer) { - var node = createSynthesizedNode(253 /* JsxAttribute */); + var node = createSynthesizedNode(256 /* JsxAttribute */); node.name = name; node.initializer = initializer; return node; @@ -48738,7 +48882,7 @@ var ts; } ts.updateJsxAttribute = updateJsxAttribute; function createJsxAttributes(properties) { - var node = createSynthesizedNode(254 /* JsxAttributes */); + var node = createSynthesizedNode(257 /* JsxAttributes */); node.properties = createNodeArray(properties); return node; } @@ -48750,7 +48894,7 @@ var ts; } ts.updateJsxAttributes = updateJsxAttributes; function createJsxSpreadAttribute(expression) { - var node = createSynthesizedNode(255 /* JsxSpreadAttribute */); + var node = createSynthesizedNode(258 /* JsxSpreadAttribute */); node.expression = expression; return node; } @@ -48762,7 +48906,7 @@ var ts; } ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; function createJsxExpression(dotDotDotToken, expression) { - var node = createSynthesizedNode(256 /* JsxExpression */); + var node = createSynthesizedNode(259 /* JsxExpression */); node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; @@ -48776,7 +48920,7 @@ var ts; ts.updateJsxExpression = updateJsxExpression; // Clauses function createCaseClause(expression, statements) { - var node = createSynthesizedNode(257 /* CaseClause */); + var node = createSynthesizedNode(260 /* CaseClause */); node.expression = ts.parenthesizeExpressionForList(expression); node.statements = createNodeArray(statements); return node; @@ -48790,7 +48934,7 @@ var ts; } ts.updateCaseClause = updateCaseClause; function createDefaultClause(statements) { - var node = createSynthesizedNode(258 /* DefaultClause */); + var node = createSynthesizedNode(261 /* DefaultClause */); node.statements = createNodeArray(statements); return node; } @@ -48802,7 +48946,7 @@ var ts; } ts.updateDefaultClause = updateDefaultClause; function createHeritageClause(token, types) { - var node = createSynthesizedNode(259 /* HeritageClause */); + var node = createSynthesizedNode(262 /* HeritageClause */); node.token = token; node.types = createNodeArray(types); return node; @@ -48815,7 +48959,7 @@ var ts; } ts.updateHeritageClause = updateHeritageClause; function createCatchClause(variableDeclaration, block) { - var node = createSynthesizedNode(260 /* CatchClause */); + var node = createSynthesizedNode(263 /* CatchClause */); node.variableDeclaration = ts.isString(variableDeclaration) ? createVariableDeclaration(variableDeclaration) : variableDeclaration; node.block = block; return node; @@ -48830,7 +48974,7 @@ var ts; ts.updateCatchClause = updateCatchClause; // Property assignments function createPropertyAssignment(name, initializer) { - var node = createSynthesizedNode(261 /* PropertyAssignment */); + var node = createSynthesizedNode(264 /* PropertyAssignment */); node.name = asName(name); node.questionToken = undefined; node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined; @@ -48845,7 +48989,7 @@ var ts; } ts.updatePropertyAssignment = updatePropertyAssignment; function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - var node = createSynthesizedNode(262 /* ShorthandPropertyAssignment */); + var node = createSynthesizedNode(265 /* ShorthandPropertyAssignment */); node.name = asName(name); node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? ts.parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; @@ -48859,7 +49003,7 @@ var ts; } ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment; function createSpreadAssignment(expression) { - var node = createSynthesizedNode(263 /* SpreadAssignment */); + var node = createSynthesizedNode(266 /* SpreadAssignment */); node.expression = expression !== undefined ? ts.parenthesizeExpressionForList(expression) : undefined; return node; } @@ -48872,7 +49016,7 @@ var ts; ts.updateSpreadAssignment = updateSpreadAssignment; // Enum function createEnumMember(name, initializer) { - var node = createSynthesizedNode(264 /* EnumMember */); + var node = createSynthesizedNode(267 /* EnumMember */); node.name = asName(name); node.initializer = initializer && ts.parenthesizeExpressionForList(initializer); return node; @@ -48888,7 +49032,7 @@ var ts; // Top-level nodes function updateSourceFileNode(node, statements) { if (node.statements !== statements) { - var updated = createSynthesizedNode(265 /* SourceFile */); + var updated = createSynthesizedNode(268 /* SourceFile */); updated.flags |= node.flags; updated.statements = createNodeArray(statements); updated.endOfFileToken = node.endOfFileToken; @@ -48967,7 +49111,7 @@ var ts; * @param original The original statement. */ function createNotEmittedStatement(original) { - var node = createSynthesizedNode(287 /* NotEmittedStatement */); + var node = createSynthesizedNode(290 /* NotEmittedStatement */); node.original = original; setTextRange(node, original); return node; @@ -48979,7 +49123,7 @@ var ts; */ /* @internal */ function createEndOfDeclarationMarker(original) { - var node = createSynthesizedNode(291 /* EndOfDeclarationMarker */); + var node = createSynthesizedNode(294 /* EndOfDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -48991,7 +49135,7 @@ var ts; */ /* @internal */ function createMergeDeclarationMarker(original) { - var node = createSynthesizedNode(290 /* MergeDeclarationMarker */); + var node = createSynthesizedNode(293 /* MergeDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -49006,7 +49150,7 @@ var ts; * @param location The location for the expression. Defaults to the positions from "original" if provided. */ function createPartiallyEmittedExpression(expression, original) { - var node = createSynthesizedNode(288 /* PartiallyEmittedExpression */); + var node = createSynthesizedNode(291 /* PartiallyEmittedExpression */); node.expression = expression; node.original = original; setTextRange(node, original); @@ -49022,7 +49166,7 @@ var ts; ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; function flattenCommaElements(node) { if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) { - if (node.kind === 289 /* CommaListExpression */) { + if (node.kind === 292 /* CommaListExpression */) { return node.elements; } if (ts.isBinaryExpression(node) && node.operatorToken.kind === 26 /* CommaToken */) { @@ -49032,7 +49176,7 @@ var ts; return node; } function createCommaList(elements) { - var node = createSynthesizedNode(289 /* CommaListExpression */); + var node = createSynthesizedNode(292 /* CommaListExpression */); node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)); return node; } @@ -49044,7 +49188,7 @@ var ts; } ts.updateCommaList = updateCommaList; function createBundle(sourceFiles) { - var node = ts.createNode(266 /* Bundle */); + var node = ts.createNode(269 /* Bundle */); node.sourceFiles = sourceFiles; return node; } @@ -49180,7 +49324,7 @@ var ts; // To avoid holding onto transformation artifacts, we keep track of any // parse tree node we are annotating. This allows us to clean them up after // all transformations have completed. - if (node.kind === 265 /* SourceFile */) { + if (node.kind === 268 /* SourceFile */) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = ts.getSourceFileOfNode(node); @@ -49570,6 +49714,26 @@ var ts; /*typeArguments*/ undefined, argumentsList), location); } ts.createExpressionForJsxElement = createExpressionForJsxElement; + function createExpressionForJsxFragment(jsxFactoryEntity, reactNamespace, children, parentElement, location) { + var tagName = ts.createPropertyAccess(createReactNamespace(reactNamespace, parentElement), "Fragment"); + var argumentsList = [tagName]; + argumentsList.push(ts.createNull()); + if (children && children.length > 0) { + if (children.length > 1) { + for (var _i = 0, children_2 = children; _i < children_2.length; _i++) { + var child = children_2[_i]; + child.startsOnNewLine = true; + argumentsList.push(child); + } + } + else { + argumentsList.push(children[0]); + } + } + return ts.setTextRange(ts.createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement), + /*typeArguments*/ undefined, argumentsList), location); + } + ts.createExpressionForJsxFragment = createExpressionForJsxFragment; // Helpers function getHelperName(name) { return ts.setEmitFlags(ts.createIdentifier(name), 4096 /* HelperName */ | 2 /* AdviseOnEmitNode */); @@ -49763,9 +49927,9 @@ var ts; case 153 /* GetAccessor */: case 154 /* SetAccessor */: return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: return createExpressionForPropertyAssignment(property, receiver); - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: return createExpressionForShorthandPropertyAssignment(property, receiver); case 151 /* MethodDeclaration */: return createExpressionForMethodDeclaration(property, receiver); @@ -50410,7 +50574,7 @@ var ts; case 179 /* PropertyAccessExpression */: node = node.expression; continue; - case 288 /* PartiallyEmittedExpression */: + case 291 /* PartiallyEmittedExpression */: node = node.expression; continue; } @@ -50440,7 +50604,7 @@ var ts; case 202 /* AsExpression */: case 203 /* NonNullExpression */: return (kinds & 2 /* Assertions */) !== 0; - case 288 /* PartiallyEmittedExpression */: + case 291 /* PartiallyEmittedExpression */: return (kinds & 4 /* PartiallyEmittedExpressions */) !== 0; } return false; @@ -50484,7 +50648,7 @@ var ts; case 184 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression); case 202 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type); case 203 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression); - case 288 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression); + case 291 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression); } } /** @@ -50689,7 +50853,7 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: // `b` in `({ a: b } = ...)` // `b` in `({ a: b = 1 } = ...)` // `{b}` in `({ a: {b} } = ...)` @@ -50701,11 +50865,11 @@ var ts; // `b[0]` in `({ a: b[0] } = ...)` // `b[0]` in `({ a: b[0] = 1 } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: // `a` in `({ a } = ...)` // `a` in `({ a = 1 } = ...)` return bindingElement.name; - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: // `a` in `({ ...a } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } @@ -50742,7 +50906,7 @@ var ts; // `...` in `let [...a] = ...` return bindingElement.dotDotDotToken; case 198 /* SpreadElement */: - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: // `...` in `[...a] = ...` return bindingElement; } @@ -50766,7 +50930,7 @@ var ts; : propertyName; } break; - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: // `a` in `({ a: b } = ...)` // `[a]` in `({ [a]: b } = ...)` // `"a"` in `({ "a": b } = ...)` @@ -50778,7 +50942,7 @@ var ts; : propertyName; } break; - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: // `a` in `({ ...a } = ...)` return bindingElement.name; } @@ -51233,40 +51397,42 @@ var ts; return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNode(node.attributes, visitor, ts.isJsxAttributes)); case 252 /* JsxClosingElement */: return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 253 /* JsxAttribute */: + case 253 /* JsxFragment */: + return ts.updateJsxFragment(node, visitNode(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingFragment, visitor, ts.isJsxClosingFragment)); + case 256 /* JsxAttribute */: return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 254 /* JsxAttributes */: + case 257 /* JsxAttributes */: return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); - case 255 /* JsxSpreadAttribute */: + case 258 /* JsxSpreadAttribute */: return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); // Clauses - case 257 /* CaseClause */: + case 260 /* CaseClause */: return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); - case 258 /* DefaultClause */: + case 261 /* DefaultClause */: return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 259 /* HeritageClause */: + case 262 /* HeritageClause */: return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); // Property assignments - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); // Enum - case 264 /* EnumMember */: + case 267 /* EnumMember */: return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); // Top-level nodes - case 265 /* SourceFile */: + case 268 /* SourceFile */: return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); // Transformation nodes - case 288 /* PartiallyEmittedExpression */: + case 291 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); - case 289 /* CommaListExpression */: + case 292 /* CommaListExpression */: return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression)); default: // No need to visit nodes with no children. @@ -51322,7 +51488,7 @@ var ts; case 209 /* EmptyStatement */: case 200 /* OmittedExpression */: case 225 /* DebuggerStatement */: - case 287 /* NotEmittedStatement */: + case 290 /* NotEmittedStatement */: // No need to visit nodes with no children. break; // Names @@ -51639,67 +51805,72 @@ var ts; result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingElement, cbNode, result); break; + case 253 /* JsxFragment */: + result = reduceNode(node.openingFragment, cbNode, result); + result = ts.reduceLeft(node.children, cbNode, result); + result = reduceNode(node.closingFragment, cbNode, result); + break; case 250 /* JsxSelfClosingElement */: case 251 /* JsxOpeningElement */: result = reduceNode(node.tagName, cbNode, result); result = reduceNode(node.attributes, cbNode, result); break; - case 254 /* JsxAttributes */: + case 257 /* JsxAttributes */: result = reduceNodes(node.properties, cbNodes, result); break; case 252 /* JsxClosingElement */: result = reduceNode(node.tagName, cbNode, result); break; - case 253 /* JsxAttribute */: + case 256 /* JsxAttribute */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 255 /* JsxSpreadAttribute */: + case 258 /* JsxSpreadAttribute */: result = reduceNode(node.expression, cbNode, result); break; - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: result = reduceNode(node.expression, cbNode, result); break; // Clauses - case 257 /* CaseClause */: + case 260 /* CaseClause */: result = reduceNode(node.expression, cbNode, result); // falls through - case 258 /* DefaultClause */: + case 261 /* DefaultClause */: result = reduceNodes(node.statements, cbNodes, result); break; - case 259 /* HeritageClause */: + case 262 /* HeritageClause */: result = reduceNodes(node.types, cbNodes, result); break; - case 260 /* CatchClause */: + case 263 /* CatchClause */: result = reduceNode(node.variableDeclaration, cbNode, result); result = reduceNode(node.block, cbNode, result); break; // Property assignments - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: result = reduceNode(node.expression, cbNode, result); break; // Enum - case 264 /* EnumMember */: + case 267 /* EnumMember */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; // Top-level nodes - case 265 /* SourceFile */: + case 268 /* SourceFile */: result = reduceNodes(node.statements, cbNodes, result); break; // Transformation nodes - case 288 /* PartiallyEmittedExpression */: + case 291 /* PartiallyEmittedExpression */: result = reduceNode(node.expression, cbNode, result); break; - case 289 /* CommaListExpression */: + case 292 /* CommaListExpression */: result = reduceNodes(node.elements, cbNodes, result); break; default: @@ -52583,7 +52754,7 @@ var ts; */ function onBeforeVisitNode(node) { switch (node.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 235 /* CaseBlock */: case 234 /* ModuleBlock */: case 207 /* Block */: @@ -52840,7 +53011,7 @@ var ts; // - index signatures // - method overload signatures return visitClassExpression(node); - case 259 /* HeritageClause */: + case 262 /* HeritageClause */: // This is a heritage clause with TypeScript syntax extensions. // // TypeScript heritage clause extensions include: @@ -54680,7 +54851,7 @@ var ts; // enums in any other scope are emitted as a `let` declaration. var statement = ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ ts.createVariableDeclaration(ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)) - ], currentScope.kind === 265 /* SourceFile */ ? 0 /* None */ : 1 /* Let */)); + ], currentScope.kind === 268 /* SourceFile */ ? 0 /* None */ : 1 /* Let */)); ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { @@ -55129,7 +55300,7 @@ var ts; // We need to enable substitutions for identifiers and shorthand property assignments. This allows us to // substitute the names of exported members of a namespace. context.enableSubstitution(71 /* Identifier */); - context.enableSubstitution(262 /* ShorthandPropertyAssignment */); + context.enableSubstitution(265 /* ShorthandPropertyAssignment */); // We need to be notified when entering and exiting namespaces. context.enableEmitNotification(233 /* ModuleDeclaration */); } @@ -55239,7 +55410,7 @@ var ts; // If we are nested within a namespace declaration, we may need to qualifiy // an identifier that is exported from a merged namespace. var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false); - if (container && container.kind !== 265 /* SourceFile */) { + if (container && container.kind !== 268 /* SourceFile */) { var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 233 /* ModuleDeclaration */) || (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 232 /* EnumDeclaration */); if (substitute) { @@ -55761,7 +55932,7 @@ var ts; return visitExpressionStatement(node); case 185 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, noDestructuringValue); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return visitCatchClause(node); default: return ts.visitEachChild(node, visitor, context); @@ -55796,7 +55967,7 @@ var ts; var objects = []; for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { var e = elements_3[_i]; - if (e.kind === 263 /* SpreadAssignment */) { + if (e.kind === 266 /* SpreadAssignment */) { if (chunkObject) { objects.push(ts.createObjectLiteral(chunkObject)); chunkObject = undefined; @@ -55808,7 +55979,7 @@ var ts; if (!chunkObject) { chunkObject = []; } - if (e.kind === 261 /* PropertyAssignment */) { + if (e.kind === 264 /* PropertyAssignment */) { var p = e; chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); } @@ -56340,7 +56511,9 @@ var ts; return visitJsxElement(node, /*isChild*/ false); case 250 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ false); - case 256 /* JsxExpression */: + case 253 /* JsxFragment */: + return visitJsxFragment(node, /*isChild*/ false); + case 259 /* JsxExpression */: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -56350,12 +56523,14 @@ var ts; switch (node.kind) { case 10 /* JsxText */: return visitJsxText(node); - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: return visitJsxExpression(node); case 249 /* JsxElement */: return visitJsxElement(node, /*isChild*/ true); case 250 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ true); + case 253 /* JsxFragment */: + return visitJsxFragment(node, /*isChild*/ true); default: ts.Debug.failBadSyntaxKind(node); return undefined; @@ -56367,6 +56542,9 @@ var ts; function visitJsxSelfClosingElement(node, isChild) { return visitJsxOpeningLikeElement(node, /*children*/ undefined, isChild, /*location*/ node); } + function visitJsxFragment(node, isChild) { + return visitJsxOpeningFragment(node.openingFragment, node.children, isChild, /*location*/ node); + } function visitJsxOpeningLikeElement(node, children, isChild, location) { var tagName = getTagName(node); var objectProperties; @@ -56399,6 +56577,13 @@ var ts; } return element; } + function visitJsxOpeningFragment(node, children, isChild, location) { + var element = ts.createExpressionForJsxFragment(context.getEmitResolver().getJsxFactoryEntity(), compilerOptions.reactNamespace, ts.mapDefined(children, transformJsxChildToExpression), node, location); + if (isChild) { + ts.startOnNewLine(element); + } + return element; + } function transformJsxSpreadAttributeToExpression(node) { return ts.visitNode(node.expression, visitor, ts.isExpression); } @@ -56415,7 +56600,7 @@ var ts; var decoded = tryDecodeEntities(node.text); return decoded ? ts.setTextRange(ts.createLiteral(decoded), node) : node; } - else if (node.kind === 256 /* JsxExpression */) { + else if (node.kind === 259 /* JsxExpression */) { if (node.expression === undefined) { return ts.createTrue(); } @@ -57129,9 +57314,9 @@ var ts; return visitExpressionStatement(node); case 178 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return visitCatchClause(node); - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: return visitShorthandPropertyAssignment(node); case 144 /* ComputedPropertyName */: return visitComputedPropertyName(node); @@ -59030,10 +59215,10 @@ var ts; case 151 /* MethodDeclaration */: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -59889,7 +60074,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; context.enableSubstitution(179 /* PropertyAccessExpression */); - context.enableSubstitution(261 /* PropertyAssignment */); + context.enableSubstitution(264 /* PropertyAssignment */); return transformSourceFile; /** * Transforms an ES5 source file to ES3. @@ -61403,7 +61588,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 258 /* DefaultClause */ && defaultClauseIndex === -1) { + if (clause.kind === 261 /* DefaultClause */ && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -61416,7 +61601,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 257 /* CaseClause */) { + if (clause.kind === 260 /* CaseClause */) { var caseClause = clause; if (containsYield(caseClause.expression) && pendingClauses.length > 0) { break; @@ -62651,8 +62836,8 @@ var ts; context.enableSubstitution(194 /* BinaryExpression */); // Substitutes assignments to exported symbols. context.enableSubstitution(192 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. context.enableSubstitution(193 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(262 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. - context.enableEmitNotification(265 /* SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(265 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. + context.enableEmitNotification(268 /* SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var currentSourceFile; // The current file. @@ -62970,9 +63155,9 @@ var ts; return visitFunctionDeclaration(node); case 229 /* ClassDeclaration */: return visitClassDeclaration(node); - case 290 /* MergeDeclarationMarker */: + case 293 /* MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 291 /* EndOfDeclarationMarker */: + case 294 /* EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return ts.visitEachChild(node, importCallExpressionVisitor, context); @@ -63655,7 +63840,7 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 265 /* SourceFile */) { + if (node.kind === 268 /* SourceFile */) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; noSubstitution = []; @@ -63743,7 +63928,7 @@ var ts; } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 265 /* SourceFile */) { + if (exportContainer && exportContainer.kind === 268 /* SourceFile */) { return ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node)), /*location*/ node); } @@ -63888,7 +64073,7 @@ var ts; context.enableSubstitution(194 /* BinaryExpression */); // Substitutes assignments to exported symbols. context.enableSubstitution(192 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. context.enableSubstitution(193 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableEmitNotification(265 /* SourceFile */); // Restore state when substituting nodes in a file. + context.enableEmitNotification(268 /* SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var exportFunctionsMap = []; // The export function associated with a source file. @@ -64459,7 +64644,7 @@ var ts; function shouldHoistVariableDeclarationList(node) { // hoist only non-block scoped declarations or block scoped declarations parented by source file return (ts.getEmitFlags(node) & 2097152 /* NoHoisting */) === 0 - && (enclosingBlockScopedContainer.kind === 265 /* SourceFile */ + && (enclosingBlockScopedContainer.kind === 268 /* SourceFile */ || (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0); } /** @@ -64786,19 +64971,19 @@ var ts; return visitSwitchStatement(node); case 235 /* CaseBlock */: return visitCaseBlock(node); - case 257 /* CaseClause */: + case 260 /* CaseClause */: return visitCaseClause(node); - case 258 /* DefaultClause */: + case 261 /* DefaultClause */: return visitDefaultClause(node); case 224 /* TryStatement */: return visitTryStatement(node); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return visitCatchClause(node); case 207 /* Block */: return visitBlock(node); - case 290 /* MergeDeclarationMarker */: + case 293 /* MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 291 /* EndOfDeclarationMarker */: + case 294 /* EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return destructuringAndImportCallVisitor(node); @@ -65049,7 +65234,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 265 /* SourceFile */; + return container !== undefined && container.kind === 268 /* SourceFile */; } else { return false; @@ -65082,7 +65267,7 @@ var ts; * @param emitCallback A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 265 /* SourceFile */) { + if (node.kind === 268 /* SourceFile */) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -65254,7 +65439,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); - if (exportContainer && exportContainer.kind === 265 /* SourceFile */) { + if (exportContainer && exportContainer.kind === 268 /* SourceFile */) { exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -65295,7 +65480,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(265 /* SourceFile */); + context.enableEmitNotification(268 /* SourceFile */); context.enableSubstitution(71 /* Identifier */); var currentSourceFile; return transformSourceFile; @@ -65465,7 +65650,7 @@ var ts; * @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files. */ function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) { - var enabledSyntaxKindFeatures = new Array(292 /* Count */); + var enabledSyntaxKindFeatures = new Array(295 /* Count */); var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentVariableDeclarationsStack = []; @@ -65805,7 +65990,7 @@ var ts; } if (compilerOptions.mapRoot) { sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); - if (sourceFileOrBundle.kind === 265 /* SourceFile */) { + if (sourceFileOrBundle.kind === 268 /* SourceFile */) { // For modules or multiple emit files the mapRoot will have directory structure like the sources // So if src\a.ts and src\lib\b.ts are compiled together user would be moving the maps into mapRoot\a.js.map and mapRoot\lib\b.js.map sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFileOrBundle, host, sourceMapDir)); @@ -65950,7 +66135,7 @@ var ts; source = undefined; if (source) setSourceFile(source); - if (node.kind !== 287 /* NotEmittedStatement */ + if (node.kind !== 290 /* NotEmittedStatement */ && (emitFlags & 16 /* NoLeadingSourceMap */) === 0 && pos >= 0) { emitPos(skipSourceTrivia(pos)); @@ -65967,7 +66152,7 @@ var ts; } if (source) setSourceFile(source); - if (node.kind !== 287 /* NotEmittedStatement */ + if (node.kind !== 290 /* NotEmittedStatement */ && (emitFlags & 32 /* NoTrailingSourceMap */) === 0 && end >= 0) { emitPos(end); @@ -66144,7 +66329,7 @@ var ts; if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 287 /* NotEmittedStatement */; + var isEmittedNode = node.kind !== 290 /* NotEmittedStatement */; // We have to explicitly check that the node is JsxText because if the compilerOptions.jsx is "preserve" we will not do any transformation. // It is expensive to walk entire tree just to set one kind of node to have no comments. var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0 || node.kind === 10 /* JsxText */; @@ -66469,8 +66654,8 @@ var ts; } ts.getDeclarationDiagnostics = getDeclarationDiagnostics; function emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFileOrBundle, emitOnlyDtsFiles) { - var sourceFiles = sourceFileOrBundle.kind === 266 /* Bundle */ ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; - var isBundledEmit = sourceFileOrBundle.kind === 266 /* Bundle */; + var sourceFiles = sourceFileOrBundle.kind === 269 /* Bundle */ ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; + var isBundledEmit = sourceFileOrBundle.kind === 269 /* Bundle */; var newLine = host.getNewLine(); var compilerOptions = host.getCompilerOptions(); var write; @@ -67022,9 +67207,9 @@ var ts; writeModuleElement(node); } else if (node.kind === 237 /* ImportEqualsDeclaration */ || - (node.parent.kind === 265 /* SourceFile */ && isCurrentFileExternalModule)) { + (node.parent.kind === 268 /* SourceFile */ && isCurrentFileExternalModule)) { var isVisible = void 0; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 265 /* SourceFile */) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 268 /* SourceFile */) { // Import declaration of another module that is visited async so lets put it in right spot asynchronousSubModuleDeclarationEmitInfo.push({ node: node, @@ -67076,7 +67261,7 @@ var ts; } function emitModuleElementDeclarationFlags(node) { // If the node is parented in the current source file we need to emit export declare or just export - if (node.parent.kind === 265 /* SourceFile */) { + if (node.parent.kind === 268 /* SourceFile */) { var modifiers = ts.getModifierFlags(node); // If the node is exported if (modifiers & 1 /* Export */) { @@ -68098,11 +68283,11 @@ var ts; case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: return emitPropertyDeclaration(node); - case 264 /* EnumMember */: + case 267 /* EnumMember */: return emitEnumMemberDeclaration(node); case 243 /* ExportAssignment */: return emitExportAssignment(node); - case 265 /* SourceFile */: + case 268 /* SourceFile */: return emitSourceFile(node); } } @@ -68130,7 +68315,7 @@ var ts; return addedBundledEmitReference; function getDeclFileName(emitFileNames, sourceFileOrBundle) { // Dont add reference path to this file if it is a bundled emit and caller asked not emit bundled file path - var isBundledEmit = sourceFileOrBundle.kind === 266 /* Bundle */; + var isBundledEmit = sourceFileOrBundle.kind === 269 /* Bundle */; if (isBundledEmit && !addBundledFileReference) { return; } @@ -68145,7 +68330,7 @@ var ts; var emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFileOrBundle, emitOnlyDtsFiles); var emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath) || host.getCompilerOptions().noEmit; if (!emitSkipped) { - var sourceFiles = sourceFileOrBundle.kind === 266 /* Bundle */ ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; + var sourceFiles = sourceFileOrBundle.kind === 269 /* Bundle */ ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; var declarationOutput = emitDeclarationResult.referencesOutput + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo); ts.writeFile(host, emitterDiagnostics, declarationFilePath, declarationOutput, host.getCompilerOptions().emitBOM, sourceFiles); @@ -68230,7 +68415,7 @@ var ts; return ".js" /* Js */; } function getOriginalSourceFileOrBundle(sourceFileOrBundle) { - if (sourceFileOrBundle.kind === 266 /* Bundle */) { + if (sourceFileOrBundle.kind === 269 /* Bundle */) { return ts.updateBundle(sourceFileOrBundle, ts.sameMap(sourceFileOrBundle.sourceFiles, ts.getOriginalSourceFile)); } return ts.getOriginalSourceFile(sourceFileOrBundle); @@ -68307,8 +68492,8 @@ var ts; } } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle) { - var bundle = sourceFileOrBundle.kind === 266 /* Bundle */ ? sourceFileOrBundle : undefined; - var sourceFile = sourceFileOrBundle.kind === 265 /* SourceFile */ ? sourceFileOrBundle : undefined; + var bundle = sourceFileOrBundle.kind === 269 /* Bundle */ ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 268 /* SourceFile */ ? sourceFileOrBundle : undefined; var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFileOrBundle); if (bundle) { @@ -68348,7 +68533,7 @@ var ts; } function emitHelpers(node, writeLines) { var helpersEmitted = false; - var bundle = node.kind === 266 /* Bundle */ ? node : undefined; + var bundle = node.kind === 269 /* Bundle */ ? node : undefined; if (bundle && moduleKind === ts.ModuleKind.None) { return; } @@ -68429,8 +68614,8 @@ var ts; break; } switch (node.kind) { - case 265 /* SourceFile */: return printFile(node); - case 266 /* Bundle */: return printBundle(node); + case 268 /* SourceFile */: return printFile(node); + case 269 /* Bundle */: return printBundle(node); } writeNode(hint, node, sourceFile, beginPrint()); return endPrint(); @@ -68627,7 +68812,7 @@ var ts; return emitTypeReference(node); case 160 /* FunctionType */: return emitFunctionType(node); - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: return emitJSDocFunctionType(node); case 161 /* ConstructorType */: return emitConstructorType(node); @@ -68657,19 +68842,19 @@ var ts; return emitMappedType(node); case 173 /* LiteralType */: return emitLiteralType(node); - case 268 /* JSDocAllType */: + case 271 /* JSDocAllType */: write("*"); return; - case 269 /* JSDocUnknownType */: + case 272 /* JSDocUnknownType */: write("?"); return; - case 270 /* JSDocNullableType */: + case 273 /* JSDocNullableType */: return emitJSDocNullableType(node); - case 271 /* JSDocNonNullableType */: + case 274 /* JSDocNonNullableType */: return emitJSDocNonNullableType(node); - case 272 /* JSDocOptionalType */: + case 275 /* JSDocOptionalType */: return emitJSDocOptionalType(node); - case 274 /* JSDocVariadicType */: + case 277 /* JSDocVariadicType */: return emitJSDocVariadicType(node); // Binding patterns case 174 /* ObjectBindingPattern */: @@ -68774,35 +68959,37 @@ var ts; case 10 /* JsxText */: return emitJsxText(node); case 251 /* JsxOpeningElement */: - return emitJsxOpeningElement(node); + case 254 /* JsxOpeningFragment */: + return emitJsxOpeningElementOrFragment(node); case 252 /* JsxClosingElement */: - return emitJsxClosingElement(node); - case 253 /* JsxAttribute */: + case 255 /* JsxClosingFragment */: + return emitJsxClosingElementOrFragment(node); + case 256 /* JsxAttribute */: return emitJsxAttribute(node); - case 254 /* JsxAttributes */: + case 257 /* JsxAttributes */: return emitJsxAttributes(node); - case 255 /* JsxSpreadAttribute */: + case 258 /* JsxSpreadAttribute */: return emitJsxSpreadAttribute(node); - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: return emitJsxExpression(node); // Clauses - case 257 /* CaseClause */: + case 260 /* CaseClause */: return emitCaseClause(node); - case 258 /* DefaultClause */: + case 261 /* DefaultClause */: return emitDefaultClause(node); - case 259 /* HeritageClause */: + case 262 /* HeritageClause */: return emitHeritageClause(node); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return emitCatchClause(node); // Property assignments - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 262 /* ShorthandPropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 263 /* SpreadAssignment */: + case 266 /* SpreadAssignment */: return emitSpreadAssignment(node); // Enum - case 264 /* EnumMember */: + case 267 /* EnumMember */: return emitEnumMember(node); } // If the node is an expression, try to emit it as an expression with @@ -68897,10 +69084,12 @@ var ts; return emitJsxElement(node); case 250 /* JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); + case 253 /* JsxFragment */: + return emitJsxFragment(node); // Transformation nodes - case 288 /* PartiallyEmittedExpression */: + case 291 /* PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); - case 289 /* CommaListExpression */: + case 292 /* CommaListExpression */: return emitCommaList(node); } } @@ -68979,7 +69168,7 @@ var ts; emit(node.name); } emitIfPresent(node.questionToken); - if (node.parent && node.parent.kind === 273 /* JSDocFunctionType */ && !node.name) { + if (node.parent && node.parent.kind === 276 /* JSDocFunctionType */ && !node.name) { emit(node.type); } else { @@ -69941,7 +70130,7 @@ var ts; // function emitJsxElement(node) { emit(node.openingElement); - emitList(node, node.children, 131072 /* JsxElementChildren */); + emitList(node, node.children, 131072 /* JsxElementOrFragmentChildren */); emit(node.closingElement); } function emitJsxSelfClosingElement(node) { @@ -69954,22 +70143,31 @@ var ts; } write("/>"); } - function emitJsxOpeningElement(node) { + function emitJsxFragment(node) { + emit(node.openingFragment); + emitList(node, node.children, 131072 /* JsxElementOrFragmentChildren */); + emit(node.closingFragment); + } + function emitJsxOpeningElementOrFragment(node) { write("<"); - emitJsxTagName(node.tagName); - writeIfAny(node.attributes.properties, " "); - // We are checking here so we won't re-enter the emitting pipeline and emit extra sourcemap - if (node.attributes.properties && node.attributes.properties.length > 0) { - emit(node.attributes); + if (ts.isJsxOpeningElement(node)) { + emitJsxTagName(node.tagName); + // We are checking here so we won't re-enter the emitting pipeline and emit extra sourcemap + if (node.attributes.properties && node.attributes.properties.length > 0) { + write(" "); + emit(node.attributes); + } } write(">"); } function emitJsxText(node) { writer.writeLiteral(getTextOfNode(node, /*includeTrivia*/ true)); } - function emitJsxClosingElement(node) { + function emitJsxClosingElementOrFragment(node) { write(""); } function emitJsxAttributes(node) { @@ -70418,11 +70616,6 @@ var ts; function decreaseIndent() { writer.decreaseIndent(); } - function writeIfAny(nodes, text) { - if (ts.some(nodes)) { - write(text); - } - } function writeToken(token, pos, contextNode) { return onEmitSourceMapOfToken ? onEmitSourceMapOfToken(contextNode, token, pos, writeTokenText) @@ -70923,7 +71116,7 @@ var ts; ListFormat[ListFormat["EnumMembers"] = 81] = "EnumMembers"; ListFormat[ListFormat["CaseBlockClauses"] = 65] = "CaseBlockClauses"; ListFormat[ListFormat["NamedImportsOrExportsElements"] = 432] = "NamedImportsOrExportsElements"; - ListFormat[ListFormat["JsxElementChildren"] = 131072] = "JsxElementChildren"; + ListFormat[ListFormat["JsxElementOrFragmentChildren"] = 131072] = "JsxElementOrFragmentChildren"; ListFormat[ListFormat["JsxElementAttributes"] = 131328] = "JsxElementAttributes"; ListFormat[ListFormat["CaseOrDefaultClauseStatements"] = 81985] = "CaseOrDefaultClauseStatements"; ListFormat[ListFormat["HeritageClauseTypes"] = 272] = "HeritageClauseTypes"; @@ -72484,7 +72677,7 @@ var ts; return; } break; - case 259 /* HeritageClause */: + case 262 /* HeritageClause */: var heritageClause = node; if (heritageClause.token === 108 /* ImplementsKeyword */) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); @@ -74366,7 +74559,7 @@ var ts; var result = {}; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 261 /* PropertyAssignment */) { + if (element.kind !== 264 /* PropertyAssignment */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); continue; } @@ -75668,8 +75861,8 @@ var ts; case 176 /* BindingElement */: case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: - case 261 /* PropertyAssignment */: - case 262 /* ShorthandPropertyAssignment */: + case 264 /* PropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: case 151 /* MethodDeclaration */: case 150 /* MethodSignature */: case 152 /* Constructor */: @@ -75678,18 +75871,18 @@ var ts; case 228 /* FunctionDeclaration */: case 186 /* FunctionExpression */: case 187 /* ArrowFunction */: - case 260 /* CatchClause */: - case 253 /* JsxAttribute */: + case 263 /* CatchClause */: + case 256 /* JsxAttribute */: return 1 /* Value */; case 145 /* TypeParameter */: case 230 /* InterfaceDeclaration */: case 231 /* TypeAliasDeclaration */: case 163 /* TypeLiteral */: return 2 /* Type */; - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: // If it has no name node, it shares the name with the value declaration below it. return node.name === undefined ? 1 /* Value */ | 2 /* Type */ : 2 /* Type */; - case 264 /* EnumMember */: + case 267 /* EnumMember */: case 229 /* ClassDeclaration */: return 1 /* Value */ | 2 /* Type */; case 233 /* ModuleDeclaration */: @@ -75711,14 +75904,14 @@ var ts; case 244 /* ExportDeclaration */: return 7 /* All */; // An external module can be a Value - case 265 /* SourceFile */: + case 268 /* SourceFile */: return 4 /* Namespace */ | 1 /* Value */; } return 7 /* All */; } ts.getMeaningFromDeclaration = getMeaningFromDeclaration; function getMeaningFromLocation(node) { - if (node.kind === 265 /* SourceFile */) { + if (node.kind === 268 /* SourceFile */) { return 1 /* Value */; } else if (node.parent.kind === 243 /* ExportAssignment */) { @@ -75787,7 +75980,7 @@ var ts; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 201 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 259 /* HeritageClause */) { + if (!isLastClause && root.parent.kind === 201 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 262 /* HeritageClause */) { var decl = root.parent.parent.parent; return (decl.kind === 229 /* ClassDeclaration */ && root.parent.parent.token === 108 /* ImplementsKeyword */) || (decl.kind === 230 /* InterfaceDeclaration */ && root.parent.parent.token === 85 /* ExtendsKeyword */); @@ -75874,8 +76067,8 @@ var ts; switch (node.parent.kind) { case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: - case 261 /* PropertyAssignment */: - case 264 /* EnumMember */: + case 264 /* PropertyAssignment */: + case 267 /* EnumMember */: case 151 /* MethodDeclaration */: case 150 /* MethodSignature */: case 153 /* GetAccessor */: @@ -75897,7 +76090,7 @@ var ts; } ts.isExpressionOfExternalModuleImportEqualsDeclaration = isExpressionOfExternalModuleImportEqualsDeclaration; function getContainerNode(node) { - if (node.kind === 283 /* JSDocTypedefTag */) { + if (node.kind === 286 /* JSDocTypedefTag */) { // This doesn't just apply to the node immediately under the comment, but to everything in its parent's scope. // node.parent = the JSDoc comment, node.parent.parent = the node having the comment. // Then we get parent again in the loop. @@ -75909,7 +76102,7 @@ var ts; return undefined; } switch (node.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 151 /* MethodDeclaration */: case 150 /* MethodSignature */: case 228 /* FunctionDeclaration */: @@ -75927,7 +76120,7 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: return ts.isExternalModule(node) ? "module" /* moduleElement */ : "script" /* scriptElement */; case 233 /* ModuleDeclaration */: return "module" /* moduleElement */; @@ -75958,7 +76151,7 @@ var ts; case 155 /* CallSignature */: return "call" /* callSignatureElement */; case 152 /* Constructor */: return "constructor" /* constructorImplementationElement */; case 145 /* TypeParameter */: return "type parameter" /* typeParameterElement */; - case 264 /* EnumMember */: return "enum member" /* enumMemberElement */; + case 267 /* EnumMember */: return "enum member" /* enumMemberElement */; case 146 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? "property" /* memberVariableElement */ : "parameter" /* parameterElement */; case 237 /* ImportEqualsDeclaration */: case 242 /* ImportSpecifier */: @@ -75966,7 +76159,7 @@ var ts; case 246 /* ExportSpecifier */: case 240 /* NamespaceImport */: return "alias" /* alias */; - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return "type" /* typeElement */; case 194 /* BinaryExpression */: var kind = ts.getSpecialPropertyAssignmentKind(node); @@ -76069,7 +76262,7 @@ var ts; case 241 /* NamedImports */: case 245 /* NamedExports */: return nodeEndsWith(n, 18 /* CloseBraceToken */, sourceFile); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return isCompletedNode(n.block, sourceFile); case 182 /* NewExpression */: if (!n.arguments) { @@ -76123,8 +76316,8 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 22 /* CloseBracketToken */, sourceFile); - case 257 /* CaseClause */: - case 258 /* DefaultClause */: + case 260 /* CaseClause */: + case 261 /* DefaultClause */: // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed return false; case 214 /* ForStatement */: @@ -76314,8 +76507,8 @@ var ts; return n; } var children = n.getChildren(); - for (var _i = 0, children_2 = children; _i < children_2.length; _i++) { - var child = children_2[_i]; + for (var _i = 0, children_3 = children; _i < children_3.length; _i++) { + var child = children_3[_i]; var shouldDiveInChildNode = // previous token is enclosed somewhere in the child (child.pos <= previousToken.pos && child.end > previousToken.end) || @@ -76373,7 +76566,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 265 /* SourceFile */ || ts.isJSDocCommentContainingNode(n)); + ts.Debug.assert(startNode !== undefined || n.kind === 268 /* SourceFile */ || ts.isJSDocCommentContainingNode(n)); // Here we know that none of child token nodes embrace the position, // the only known case is when position is at the end of the file. // Try to find the rightmost token in the file without filtering. @@ -76434,13 +76627,13 @@ var ts; return true; } //
{ |
or
- if (token.kind === 27 /* LessThanToken */ && token.parent.kind === 256 /* JsxExpression */) { + if (token.kind === 27 /* LessThanToken */ && token.parent.kind === 259 /* JsxExpression */) { return true; } //
{ // | // } < /div> - if (token && token.kind === 18 /* CloseBraceToken */ && token.parent.kind === 256 /* JsxExpression */) { + if (token && token.kind === 18 /* CloseBraceToken */ && token.parent.kind === 259 /* JsxExpression */) { return true; } //
|
@@ -76580,7 +76773,7 @@ var ts; // [x, [a, b, c] ] = someExpression // or // {x, a: {a, b, c} } = someExpression - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 261 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 264 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { return true; } } @@ -77632,16 +77825,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); // e.g. "param" pos = tag.tagName.end; switch (tag.kind) { - case 279 /* JSDocParameterTag */: + case 282 /* JSDocParameterTag */: processJSDocParameterTag(tag); break; - case 282 /* JSDocTemplateTag */: + case 285 /* JSDocTemplateTag */: processJSDocTemplateTag(tag); break; - case 281 /* JSDocTypeTag */: + case 284 /* JSDocTypeTag */: processElement(tag.typeExpression); break; - case 280 /* JSDocReturnTag */: + case 283 /* JSDocReturnTag */: processElement(tag.typeExpression); break; } @@ -77743,7 +77936,7 @@ var ts; return 21 /* jsxSelfClosingTagName */; } break; - case 253 /* JsxAttribute */: + case 256 /* JsxAttribute */: if (token.parent.name === token) { return 22 /* jsxAttribute */; } @@ -77774,7 +77967,7 @@ var ts; if (token.parent.kind === 226 /* VariableDeclaration */ || token.parent.kind === 149 /* PropertyDeclaration */ || token.parent.kind === 146 /* Parameter */ || - token.parent.kind === 253 /* JsxAttribute */) { + token.parent.kind === 256 /* JsxAttribute */) { return 5 /* operator */; } } @@ -77791,7 +77984,7 @@ var ts; return 4 /* numericLiteral */; } else if (tokenKind === 9 /* StringLiteral */) { - return token.parent.kind === 253 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; + return token.parent.kind === 256 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; } else if (tokenKind === 12 /* RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. @@ -78349,7 +78542,7 @@ var ts; if (ts.isInString(sourceFile, position)) { return getStringLiteralCompletionEntries(sourceFile, position, typeChecker, compilerOptions, host, log); } - var completionData = getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, options); + var completionData = getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, options, compilerOptions.target); if (!completionData) { return undefined; } @@ -78426,7 +78619,7 @@ var ts; // Try to get a valid display name for this symbol, if we could not find one, then ignore it. // We would like to only show things that can be added after a dot, so for instance numeric properties can // not be accessed with a dot (a.1 <- invalid) - var displayName = getCompletionEntryDisplayNameForSymbol(symbol, target, performCharacterChecks, allowStringLiteral); + var displayName = getCompletionEntryDisplayNameForSymbol(symbol, target, performCharacterChecks, allowStringLiteral, origin); if (!displayName) { return undefined; } @@ -78483,7 +78676,7 @@ var ts; if (!node || node.kind !== 9 /* StringLiteral */) { return undefined; } - if (node.parent.kind === 261 /* PropertyAssignment */ && + if (node.parent.kind === 264 /* PropertyAssignment */ && node.parent.parent.kind === 178 /* ObjectLiteralExpression */ && node.parent.name === node) { // Get quoted name of properties of the object literal expression @@ -78615,7 +78808,7 @@ var ts; } function getSymbolCompletionFromEntryId(typeChecker, log, compilerOptions, sourceFile, position, _a, allSourceFiles) { var name = _a.name, source = _a.source; - var completionData = getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, { includeExternalModuleExports: true }); + var completionData = getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, { includeExternalModuleExports: true }, compilerOptions.target); if (!completionData) { return { type: "none" }; } @@ -78628,13 +78821,17 @@ var ts; // name against 'entryName' (which is known to be good), not building a new // completion entry. var symbol = ts.find(symbols, function (s) { - return getCompletionEntryDisplayNameForSymbol(s, compilerOptions.target, /*performCharacterChecks*/ false, allowStringLiteral) === name - && getSourceFromOrigin(symbolToOriginInfoMap[ts.getSymbolId(s)]) === source; + var origin = symbolToOriginInfoMap[ts.getSymbolId(s)]; + return getCompletionEntryDisplayNameForSymbol(s, compilerOptions.target, /*performCharacterChecks*/ false, allowStringLiteral, origin) === name + && getSourceFromOrigin(origin) === source; }); return symbol ? { type: "symbol", symbol: symbol, location: location, symbolToOriginInfoMap: symbolToOriginInfoMap } : { type: "none" }; } - function getCompletionEntryDetails(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles, host, rulesProvider) { - var name = entryId.name, source = entryId.source; + function getSymbolName(symbol, origin, target) { + return origin && origin.isDefaultExport && symbol.name === "default" ? ts.codefix.moduleSymbolToValidIdentifier(origin.moduleSymbol, target) : symbol.name; + } + function getCompletionEntryDetails(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles, host, rulesProvider, getCanonicalFileName) { + var name = entryId.name; // Compute all the completion symbols again. var symbolCompletion = getSymbolCompletionFromEntryId(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles); switch (symbolCompletion.type) { @@ -78653,10 +78850,10 @@ var ts; } case "symbol": { var symbol = symbolCompletion.symbol, location = symbolCompletion.location, symbolToOriginInfoMap = symbolCompletion.symbolToOriginInfoMap; - var codeActions = getCompletionEntryCodeActions(symbolToOriginInfoMap, symbol, typeChecker, host, compilerOptions, sourceFile, rulesProvider); + var _a = getCompletionEntryCodeActionsAndSourceDisplay(symbolToOriginInfoMap, symbol, typeChecker, host, compilerOptions, sourceFile, rulesProvider, getCanonicalFileName), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; var kindModifiers = ts.SymbolDisplay.getSymbolModifiers(symbol); - var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location, location, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind, tags = _a.tags; - return { name: name, kindModifiers: kindModifiers, kind: symbolKind, displayParts: displayParts, documentation: documentation, tags: tags, codeActions: codeActions, source: source === undefined ? undefined : [ts.textPart(source)] }; + var _b = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location, location, 7 /* All */), displayParts = _b.displayParts, documentation = _b.documentation, symbolKind = _b.symbolKind, tags = _b.tags; + return { name: name, kindModifiers: kindModifiers, kind: symbolKind, displayParts: displayParts, documentation: documentation, tags: tags, codeActions: codeActions, source: sourceDisplay }; } case "none": { // Didn't find a symbol with this name. See if we can find a keyword instead. @@ -78677,31 +78874,33 @@ var ts; } } Completions.getCompletionEntryDetails = getCompletionEntryDetails; - function getCompletionEntryCodeActions(symbolToOriginInfoMap, symbol, checker, host, compilerOptions, sourceFile, rulesProvider) { + function getCompletionEntryCodeActionsAndSourceDisplay(symbolToOriginInfoMap, symbol, checker, host, compilerOptions, sourceFile, rulesProvider, getCanonicalFileName) { var symbolOriginInfo = symbolToOriginInfoMap[ts.getSymbolId(symbol)]; if (!symbolOriginInfo) { - return undefined; + return { codeActions: undefined, sourceDisplay: undefined }; } var moduleSymbol = symbolOriginInfo.moduleSymbol, isDefaultExport = symbolOriginInfo.isDefaultExport; - return ts.codefix.getCodeActionForImport(moduleSymbol, { + var sourceDisplay = [ts.textPart(ts.codefix.getModuleSpecifierForNewImport(sourceFile, moduleSymbol, compilerOptions, getCanonicalFileName, host))]; + var codeActions = ts.codefix.getCodeActionForImport(moduleSymbol, { host: host, checker: checker, newLineCharacter: host.getNewLine(), compilerOptions: compilerOptions, sourceFile: sourceFile, rulesProvider: rulesProvider, - symbolName: symbol.name, - getCanonicalFileName: ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames ? host.useCaseSensitiveFileNames() : false), + symbolName: getSymbolName(symbol, symbolOriginInfo, compilerOptions.target), + getCanonicalFileName: getCanonicalFileName, symbolToken: undefined, kind: isDefaultExport ? 1 /* Default */ : 0 /* Named */, }); + return { sourceDisplay: sourceDisplay, codeActions: codeActions }; } function getCompletionEntrySymbol(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles) { var completion = getSymbolCompletionFromEntryId(typeChecker, log, compilerOptions, sourceFile, position, entryId, allSourceFiles); return completion.type === "symbol" ? completion.symbol : undefined; } Completions.getCompletionEntrySymbol = getCompletionEntrySymbol; - function getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, options) { + function getCompletionData(typeChecker, log, sourceFile, position, allSourceFiles, options, target) { var isJavaScriptFile = ts.isSourceFileJavaScript(sourceFile); var request; var start = ts.timestamp(); @@ -78751,11 +78950,11 @@ var ts; if (tag.tagName.pos <= position && position <= tag.tagName.end) { request = { kind: "JsDocTagName" }; } - if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 267 /* JSDocTypeExpression */) { + if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 270 /* JSDocTypeExpression */) { currentToken = ts.getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ true); if (!currentToken || (!ts.isDeclarationName(currentToken) && - (currentToken.parent.kind !== 284 /* JSDocPropertyTag */ || + (currentToken.parent.kind !== 287 /* JSDocPropertyTag */ || currentToken.parent.name !== currentToken))) { // Use as type location if inside tag's type expression insideJsDocTagTypeExpression = isCurrentlyEditingNode(tag.typeExpression); @@ -78904,11 +79103,11 @@ var ts; return { symbols: symbols, isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, allowStringLiteral: allowStringLiteral, isNewIdentifierLocation: isNewIdentifierLocation, location: location, isRightOfDot: (isRightOfDot || isRightOfOpenTag), request: request, keywordFilters: keywordFilters, symbolToOriginInfoMap: symbolToOriginInfoMap }; function isTagWithTypeExpression(tag) { switch (tag.kind) { - case 279 /* JSDocParameterTag */: - case 284 /* JSDocPropertyTag */: - case 280 /* JSDocReturnTag */: - case 281 /* JSDocTypeTag */: - case 283 /* JSDocTypedefTag */: + case 282 /* JSDocParameterTag */: + case 287 /* JSDocPropertyTag */: + case 283 /* JSDocReturnTag */: + case 284 /* JSDocTypeTag */: + case 286 /* JSDocTypedefTag */: return true; } } @@ -78940,7 +79139,7 @@ var ts; } } // If the module is merged with a value, we must get the type of the class and add its propertes (for inherited static methods). - if (!isTypeLocation && symbol.declarations.some(function (d) { return d.kind !== 265 /* SourceFile */ && d.kind !== 233 /* ModuleDeclaration */ && d.kind !== 232 /* EnumDeclaration */; })) { + if (!isTypeLocation && symbol.declarations.some(function (d) { return d.kind !== 268 /* SourceFile */ && d.kind !== 233 /* ModuleDeclaration */ && d.kind !== 232 /* EnumDeclaration */; })) { addTypeProperties(typeChecker.getTypeOfSymbolAtLocation(symbol, node)); } return; @@ -79049,15 +79248,15 @@ var ts; var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile; if (scopeNode) { isGlobalCompletion = - scopeNode.kind === 265 /* SourceFile */ || + scopeNode.kind === 268 /* SourceFile */ || scopeNode.kind === 196 /* TemplateExpression */ || - scopeNode.kind === 256 /* JsxExpression */ || + scopeNode.kind === 259 /* JsxExpression */ || ts.isStatement(scopeNode); } var symbolMeanings = 793064 /* Type */ | 107455 /* Value */ | 1920 /* Namespace */ | 2097152 /* Alias */; symbols = typeChecker.getSymbolsInScope(scopeNode, symbolMeanings); if (options.includeExternalModuleExports) { - getSymbolsFromOtherSourceFileExports(symbols, previousToken && ts.isIdentifier(previousToken) ? previousToken.text : ""); + getSymbolsFromOtherSourceFileExports(symbols, previousToken && ts.isIdentifier(previousToken) ? previousToken.text : "", target); } filterGlobalCompletion(symbols); return true; @@ -79124,7 +79323,7 @@ var ts; return ts.forEach(exportedSymbols, symbolCanBeReferencedAtTypeLocation); } } - function getSymbolsFromOtherSourceFileExports(symbols, tokenText) { + function getSymbolsFromOtherSourceFileExports(symbols, tokenText, target) { var tokenTextLowerCase = tokenText.toLowerCase(); ts.codefix.forEachExternalModule(typeChecker, allSourceFiles, function (moduleSymbol) { if (moduleSymbol === sourceFile.symbol) { @@ -79140,6 +79339,9 @@ var ts; symbol = localSymbol; name = localSymbol.name; } + else { + name = ts.codefix.moduleSymbolToValidIdentifier(moduleSymbol, target); + } } if (symbol.declarations && symbol.declarations.some(function (d) { return ts.isExportSpecifier(d) && !!d.parent.parent.moduleSpecifier; })) { // Don't add a completion for a re-export, only for the original. @@ -79504,7 +79706,7 @@ var ts; } } // class c { method() { } | method2() { } } - if (location && location.kind === 286 /* SyntaxList */ && ts.isClassLike(location.parent)) { + if (location && location.kind === 289 /* SyntaxList */ && ts.isClassLike(location.parent)) { return location.parent; } return undefined; @@ -79535,13 +79737,13 @@ var ts; case 41 /* SlashToken */: case 71 /* Identifier */: case 179 /* PropertyAccessExpression */: - case 254 /* JsxAttributes */: - case 253 /* JsxAttribute */: - case 255 /* JsxSpreadAttribute */: + case 257 /* JsxAttributes */: + case 256 /* JsxAttribute */: + case 258 /* JsxSpreadAttribute */: if (parent && (parent.kind === 250 /* JsxSelfClosingElement */ || parent.kind === 251 /* JsxOpeningElement */)) { return parent; } - else if (parent.kind === 253 /* JsxAttribute */) { + else if (parent.kind === 256 /* JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -79553,7 +79755,7 @@ var ts; // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 9 /* StringLiteral */: - if (parent && ((parent.kind === 253 /* JsxAttribute */) || (parent.kind === 255 /* JsxSpreadAttribute */))) { + if (parent && ((parent.kind === 256 /* JsxAttribute */) || (parent.kind === 258 /* JsxSpreadAttribute */))) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -79563,8 +79765,8 @@ var ts; break; case 18 /* CloseBraceToken */: if (parent && - parent.kind === 256 /* JsxExpression */ && - parent.parent && parent.parent.kind === 253 /* JsxAttribute */) { + parent.kind === 259 /* JsxExpression */ && + parent.parent && parent.parent.kind === 256 /* JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -79572,7 +79774,7 @@ var ts; // each JsxAttribute can have initializer as JsxExpression return parent.parent.parent.parent; } - if (parent && parent.kind === 255 /* JsxSpreadAttribute */) { + if (parent && parent.kind === 258 /* JsxSpreadAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -79611,7 +79813,7 @@ var ts; case 21 /* OpenBracketToken */: return containingNodeKind === 175 /* ArrayBindingPattern */; // var [x| case 19 /* OpenParenToken */: - return containingNodeKind === 260 /* CatchClause */ || + return containingNodeKind === 263 /* CatchClause */ || isFunctionLikeButNotConstructor(containingNodeKind); case 17 /* OpenBraceToken */: return containingNodeKind === 232 /* EnumDeclaration */ || // enum a { | @@ -79747,8 +79949,8 @@ var ts; for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 261 /* PropertyAssignment */ && - m.kind !== 262 /* ShorthandPropertyAssignment */ && + if (m.kind !== 264 /* PropertyAssignment */ && + m.kind !== 265 /* ShorthandPropertyAssignment */ && m.kind !== 176 /* BindingElement */ && m.kind !== 151 /* MethodDeclaration */ && m.kind !== 153 /* GetAccessor */ && @@ -79845,7 +80047,7 @@ var ts; if (isCurrentlyEditingNode(attr)) { continue; } - if (attr.kind === 253 /* JsxAttribute */) { + if (attr.kind === 256 /* JsxAttribute */) { seenNames.set(attr.name.escapedText, true); } } @@ -79860,8 +80062,8 @@ var ts; * * @return undefined if the name is of external module */ - function getCompletionEntryDisplayNameForSymbol(symbol, target, performCharacterChecks, allowStringLiteral) { - var name = symbol.name; + function getCompletionEntryDisplayNameForSymbol(symbol, target, performCharacterChecks, allowStringLiteral, origin) { + var name = getSymbolName(symbol, origin, target); if (!name) return undefined; // First check of the displayName is not external module; if it is an external module, it is not valid entry @@ -80194,7 +80396,7 @@ var ts; var child = throwStatement; while (child.parent) { var parent_2 = child.parent; - if (ts.isFunctionBlock(parent_2) || parent_2.kind === 265 /* SourceFile */) { + if (ts.isFunctionBlock(parent_2) || parent_2.kind === 268 /* SourceFile */) { return parent_2; } // A throw-statement is only owned by a try-statement if the try-statement has @@ -80271,10 +80473,10 @@ var ts; var container = declaration.parent; switch (container.kind) { case 234 /* ModuleBlock */: - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 207 /* Block */: - case 257 /* CaseClause */: - case 258 /* DefaultClause */: + case 260 /* CaseClause */: + case 261 /* DefaultClause */: // Container is either a class declaration or the declaration is a classDeclaration if (modifierFlag & 128 /* Abstract */) { return declaration.members.concat([declaration]); @@ -80322,7 +80524,7 @@ var ts; return container.kind === 229 /* ClassDeclaration */ || container.kind === 199 /* ClassExpression */; case 84 /* ExportKeyword */: case 124 /* DeclareKeyword */: - return container.kind === 234 /* ModuleBlock */ || container.kind === 265 /* SourceFile */; + return container.kind === 234 /* ModuleBlock */ || container.kind === 268 /* SourceFile */; case 117 /* AbstractKeyword */: return container.kind === 229 /* ClassDeclaration */ || declaration.kind === 229 /* ClassDeclaration */; default: @@ -80745,7 +80947,7 @@ var ts; } else if (!isAvailableThroughGlobal) { var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration); - ts.Debug.assert(sourceFileLike.kind === 265 /* SourceFile */ || sourceFileLike.kind === 233 /* ModuleDeclaration */); + ts.Debug.assert(sourceFileLike.kind === 268 /* SourceFile */ || sourceFileLike.kind === 233 /* ModuleDeclaration */); if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) { addIndirectUsers(sourceFileLike); } @@ -80910,7 +81112,7 @@ var ts; for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) { var referencingFile = sourceFiles_4[_i]; var searchSourceFile = searchModuleSymbol.valueDeclaration; - if (searchSourceFile.kind === 265 /* SourceFile */) { + if (searchSourceFile.kind === 268 /* SourceFile */) { for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) { var ref = _b[_a]; if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) { @@ -80957,7 +81159,7 @@ var ts; } /** Iterates over all statements at the top level or in module declarations. Returns the first truthy result. */ function forEachPossibleImportOrExportStatement(sourceFileLike, action) { - return ts.forEach(sourceFileLike.kind === 265 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { + return ts.forEach(sourceFileLike.kind === 268 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { return action(statement) || (isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action)); }); } @@ -81131,7 +81333,7 @@ var ts; if (parent.kind === 226 /* VariableDeclaration */) { var p = parent; return p.name !== node ? undefined : - p.parent.kind === 260 /* CatchClause */ ? undefined : p.parent.parent.kind === 208 /* VariableStatement */ ? p.parent.parent : undefined; + p.parent.kind === 263 /* CatchClause */ ? undefined : p.parent.parent.kind === 208 /* VariableStatement */ ? p.parent.parent : undefined; } else { return parent; @@ -81191,7 +81393,7 @@ var ts; return node.getSourceFile(); } var parent = node.parent; - if (parent.kind === 265 /* SourceFile */) { + if (parent.kind === 268 /* SourceFile */) { return parent; } ts.Debug.assert(parent.kind === 234 /* ModuleBlock */ && isAmbientModuleDeclaration(parent.parent)); @@ -81242,13 +81444,13 @@ var ts; } FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition; function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node) { - if (node.kind === 265 /* SourceFile */) { + if (node.kind === 268 /* SourceFile */) { return undefined; } var checker = program.getTypeChecker(); // If invoked directly on a shorthand property assignment, then return // the declaration of the symbol being assigned (not the symbol being assigned to). - if (node.parent.kind === 262 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 265 /* ShorthandPropertyAssignment */) { var result_5 = []; FindAllReferences.Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_5.push(nodeEntry(node)); }); return result_5; @@ -81285,29 +81487,29 @@ var ts; var info = (function () { switch (def.type) { case "symbol": { - var symbol = def.symbol, node_2 = def.node; - var _a = getDefinitionKindAndDisplayParts(symbol, node_2, checker), displayParts_1 = _a.displayParts, kind_1 = _a.kind; + var symbol = def.symbol, node_3 = def.node; + var _a = getDefinitionKindAndDisplayParts(symbol, node_3, checker), displayParts_1 = _a.displayParts, kind_1 = _a.kind; var name_4 = displayParts_1.map(function (p) { return p.text; }).join(""); - return { node: node_2, name: name_4, kind: kind_1, displayParts: displayParts_1 }; + return { node: node_3, name: name_4, kind: kind_1, displayParts: displayParts_1 }; } case "label": { - var node_3 = def.node; - return { node: node_3, name: node_3.text, kind: "label" /* label */, displayParts: [ts.displayPart(node_3.text, ts.SymbolDisplayPartKind.text)] }; + var node_4 = def.node; + return { node: node_4, name: node_4.text, kind: "label" /* label */, displayParts: [ts.displayPart(node_4.text, ts.SymbolDisplayPartKind.text)] }; } case "keyword": { - var node_4 = def.node; - var name_5 = ts.tokenToString(node_4.kind); - return { node: node_4, name: name_5, kind: "keyword" /* keyword */, displayParts: [{ text: name_5, kind: "keyword" /* keyword */ }] }; + var node_5 = def.node; + var name_5 = ts.tokenToString(node_5.kind); + return { node: node_5, name: name_5, kind: "keyword" /* keyword */, displayParts: [{ text: name_5, kind: "keyword" /* keyword */ }] }; } case "this": { - var node_5 = def.node; - var symbol = checker.getSymbolAtLocation(node_5); - var displayParts_2 = symbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node_5.getSourceFile(), ts.getContainerNode(node_5), node_5).displayParts; - return { node: node_5, name: "this", kind: "var" /* variableElement */, displayParts: displayParts_2 }; + var node_6 = def.node; + var symbol = checker.getSymbolAtLocation(node_6); + var displayParts_2 = symbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node_6.getSourceFile(), ts.getContainerNode(node_6), node_6).displayParts; + return { node: node_6, name: "this", kind: "var" /* variableElement */, displayParts: displayParts_2 }; } case "string": { - var node_6 = def.node; - return { node: node_6, name: node_6.text, kind: "var" /* variableElement */, displayParts: [ts.displayPart(ts.getTextOfNode(node_6), ts.SymbolDisplayPartKind.stringLiteral)] }; + var node_7 = def.node; + return { node: node_7, name: node_7.text, kind: "var" /* variableElement */, displayParts: [ts.displayPart(ts.getTextOfNode(node_7), ts.SymbolDisplayPartKind.stringLiteral)] }; } } })(); @@ -81417,7 +81619,7 @@ var ts; /** Core find-all-references algorithm. Handles special cases before delegating to `getReferencedSymbolsForSymbol`. */ function getReferencedSymbolsForNode(node, program, sourceFiles, cancellationToken, options) { if (options === void 0) { options = {}; } - if (node.kind === 265 /* SourceFile */) { + if (node.kind === 268 /* SourceFile */) { return undefined; } if (!options.implementations) { @@ -81476,7 +81678,7 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; switch (decl.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: // Don't include the source file itself. (This may not be ideal behavior, but awkward to include an entire file as a reference.) break; case 233 /* ModuleDeclaration */: @@ -81773,7 +81975,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (!container || container.kind === 265 /* SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { + if (!container || container.kind === 268 /* SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { // This is a global variable and not an external module, any declaration defined // within this scope is visible outside the file return undefined; @@ -82100,7 +82302,7 @@ var ts; if (refNode.kind !== 71 /* Identifier */) { return; } - if (refNode.parent.kind === 262 /* ShorthandPropertyAssignment */) { + if (refNode.parent.kind === 265 /* ShorthandPropertyAssignment */) { // Go ahead and dereference the shorthand assignment by going to its definition getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference); } @@ -82161,7 +82363,7 @@ var ts; function getContainingClassIfInHeritageClause(node) { if (node && node.parent) { if (node.kind === 201 /* ExpressionWithTypeArguments */ - && node.parent.kind === 259 /* HeritageClause */ + && node.parent.kind === 262 /* HeritageClause */ && ts.isClassLike(node.parent.parent)) { return node.parent.parent; } @@ -82315,7 +82517,7 @@ var ts; staticFlag &= ts.getModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 265 /* SourceFile */: + case 268 /* SourceFile */: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } @@ -82330,7 +82532,7 @@ var ts; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 265 /* SourceFile */) { + if (searchSpaceNode.kind === 268 /* SourceFile */) { ts.forEach(sourceFiles, function (sourceFile) { cancellationToken.throwIfCancellationRequested(); possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this"); @@ -82374,8 +82576,8 @@ var ts; result.push(FindAllReferences.nodeEntry(node)); } break; - case 265 /* SourceFile */: - if (container.kind === 265 /* SourceFile */ && !ts.isExternalModule(container)) { + case 268 /* SourceFile */: + if (container.kind === 268 /* SourceFile */ && !ts.isExternalModule(container)) { result.push(FindAllReferences.nodeEntry(node)); } break; @@ -82398,9 +82600,9 @@ var ts; function getReferencesForStringLiteralInFile(sourceFile, searchText, possiblePositions, references) { for (var _i = 0, possiblePositions_4 = possiblePositions; _i < possiblePositions_4.length; _i++) { var position = possiblePositions_4[_i]; - var node_7 = ts.getTouchingWord(sourceFile, position, /*includeJsDocComment*/ false); - if (node_7 && node_7.kind === 9 /* StringLiteral */ && node_7.text === searchText) { - references.push(FindAllReferences.nodeEntry(node_7, /*isInString*/ true)); + var node_8 = ts.getTouchingWord(sourceFile, position, /*includeJsDocComment*/ false); + if (node_8 && node_8.kind === 9 /* StringLiteral */ && node_8.text === searchText) { + references.push(FindAllReferences.nodeEntry(node_8, /*isInString*/ true)); } } } @@ -82415,7 +82617,7 @@ var ts; // If the location is name of property symbol from object literal destructuring pattern // Search the property symbol // for ( { property: p2 } of elems) { } - if (containingObjectLiteralElement.kind !== 262 /* ShorthandPropertyAssignment */) { + if (containingObjectLiteralElement.kind !== 265 /* ShorthandPropertyAssignment */) { var propertySymbol = getPropertySymbolOfDestructuringAssignment(location, checker); if (propertySymbol) { result.push(propertySymbol); @@ -82796,7 +82998,7 @@ var ts; // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. - if (node.parent.kind === 262 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 265 /* ShorthandPropertyAssignment */) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -83108,7 +83310,7 @@ var ts; forEachUnique(declarations, function (declaration) { for (var _i = 0, _a = ts.getJSDocTags(declaration); _i < _a.length; _i++) { var tag = _a[_i]; - if (tag.kind === 276 /* JSDocTag */) { + if (tag.kind === 279 /* JSDocTag */) { tags.push({ name: tag.tagName.text, text: tag.comment }); } } @@ -83299,7 +83501,7 @@ var ts; : undefined; return { commentOwner: commentOwner, parameters: parameters_1 }; } - case 265 /* SourceFile */: + case 268 /* SourceFile */: return undefined; case 233 /* ModuleDeclaration */: // If in walking up the tree, we hit a a nested namespace declaration, @@ -83484,7 +83686,7 @@ var ts; if (!ts.hasJavaScriptFileExtension(j)) return undefined; var inferredTypingName = ts.removeFileExtension(ts.getBaseFileName(j.toLowerCase())); - var cleanedTypingName = inferredTypingName.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); + var cleanedTypingName = ts.removeMinAndVersionNumbers(inferredTypingName); return safeList.get(cleanedTypingName); }); if (fromFileNames.length) { @@ -84028,7 +84230,7 @@ var ts; if (ts.hasJSDocNodes(node)) { ts.forEach(node.jsDoc, function (jsDoc) { ts.forEach(jsDoc.tags, function (tag) { - if (tag.kind === 283 /* JSDocTypedefTag */) { + if (tag.kind === 286 /* JSDocTypedefTag */) { addLeafNode(tag); } }); @@ -84140,7 +84342,7 @@ var ts; case 187 /* ArrowFunction */: case 199 /* ClassExpression */: return getFunctionOrClassName(node); - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return undefined; @@ -84158,7 +84360,7 @@ var ts; } } switch (node.kind) { - case 265 /* SourceFile */: + case 268 /* SourceFile */: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" @@ -84183,7 +84385,7 @@ var ts; return "()"; case 157 /* IndexSignature */: return "[]"; - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return ""; @@ -84229,9 +84431,9 @@ var ts; case 232 /* EnumDeclaration */: case 230 /* InterfaceDeclaration */: case 233 /* ModuleDeclaration */: - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 231 /* TypeAliasDeclaration */: - case 283 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return true; case 152 /* Constructor */: case 151 /* MethodDeclaration */: @@ -84252,7 +84454,7 @@ var ts; } switch (navigationBarNodeKind(item.parent)) { case 234 /* ModuleBlock */: - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 151 /* MethodDeclaration */: case 152 /* Constructor */: return true; @@ -84336,7 +84538,7 @@ var ts; return !member.name || member.name.kind === 144 /* ComputedPropertyName */; } function getNodeSpan(node) { - return node.kind === 265 /* SourceFile */ + return node.kind === 268 /* SourceFile */ ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromNode(node, curSourceFile); } @@ -84357,7 +84559,7 @@ var ts; node.parent.operatorToken.kind === 58 /* EqualsToken */) { return nodeText(node.parent.left).replace(whiteSpaceRegex, ""); } - else if (node.parent.kind === 261 /* PropertyAssignment */ && node.parent.name) { + else if (node.parent.kind === 264 /* PropertyAssignment */ && node.parent.name) { return nodeText(node.parent.name); } else if (ts.getModifierFlags(node) & 512 /* Default */) { @@ -84517,7 +84719,7 @@ var ts; parent.kind === 211 /* IfStatement */ || parent.kind === 213 /* WhileStatement */ || parent.kind === 220 /* WithStatement */ || - parent.kind === 260 /* CatchClause */) { + parent.kind === 263 /* CatchClause */) { addOutliningSpan(parent, openBrace_1, closeBrace_1, autoCollapse(n), /*useFullStart*/ true); break; } @@ -85871,7 +86073,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node, position, sourceFile) { - for (var n = node; n.kind !== 265 /* SourceFile */; n = n.parent) { + for (var n = node; n.kind !== 268 /* SourceFile */; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -86300,7 +86502,7 @@ var ts; symbolKind = "enum member" /* enumMemberElement */; addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 264 /* EnumMember */) { + if (declaration.kind === 267 /* EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -86406,7 +86608,7 @@ var ts; // For some special property access expressions like `exports.foo = foo` or `module.exports.foo = foo` // there documentation comments might be attached to the right hand side symbol of their declarations. // The pattern of such special property access is that the parent symbol is the symbol of the file. - if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 265 /* SourceFile */; })) { + if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 268 /* SourceFile */; })) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (!declaration.parent || declaration.parent.kind !== 194 /* BinaryExpression */) { @@ -86501,7 +86703,7 @@ var ts; // If the parent is not sourceFile or module block it is local variable for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { // Reached source file or module block - if (parent.kind === 265 /* SourceFile */ || parent.kind === 234 /* ModuleBlock */) { + if (parent.kind === 268 /* SourceFile */ || parent.kind === 234 /* ModuleBlock */) { return false; } } @@ -86721,7 +86923,7 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 253 /* JsxAttribute */: + case 256 /* JsxAttribute */: case 251 /* JsxOpeningElement */: case 252 /* JsxClosingElement */: case 250 /* JsxSelfClosingElement */: @@ -87434,7 +87636,7 @@ var ts; case 226 /* VariableDeclaration */: // equal in p = 0; case 146 /* Parameter */: - case 264 /* EnumMember */: + case 267 /* EnumMember */: case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: return context.currentTokenSpan.kind === 58 /* EqualsToken */ || context.nextTokenSpan.kind === 58 /* EqualsToken */; @@ -87540,7 +87742,7 @@ var ts; case 229 /* ClassDeclaration */: case 233 /* ModuleDeclaration */: case 232 /* EnumDeclaration */: - case 260 /* CatchClause */: + case 263 /* CatchClause */: case 234 /* ModuleBlock */: case 221 /* SwitchStatement */: return true; @@ -87567,7 +87769,7 @@ var ts; case 220 /* WithStatement */: // TODO // case SyntaxKind.ElseClause: - case 260 /* CatchClause */: + case 263 /* CatchClause */: return true; default: return false; @@ -87601,13 +87803,13 @@ var ts; return context.contextNode.kind !== 249 /* JsxElement */; }; Rules.IsJsxExpressionContext = function (context) { - return context.contextNode.kind === 256 /* JsxExpression */; + return context.contextNode.kind === 259 /* JsxExpression */; }; Rules.IsNextTokenParentJsxAttribute = function (context) { - return context.nextTokenParent.kind === 253 /* JsxAttribute */; + return context.nextTokenParent.kind === 256 /* JsxAttribute */; }; Rules.IsJsxAttributeContext = function (context) { - return context.contextNode.kind === 253 /* JsxAttribute */; + return context.contextNode.kind === 256 /* JsxAttribute */; }; Rules.IsJsxSelfClosingElementContext = function (context) { return context.contextNode.kind === 250 /* JsxSelfClosingElement */; @@ -88136,11 +88338,11 @@ var ts; case 233 /* ModuleDeclaration */: var body = parent.body; return body && body.kind === 234 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node); - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 207 /* Block */: case 234 /* ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -89237,7 +89439,7 @@ var ts; // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually // - parent and child are not on the same line var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && - (parent.kind === 265 /* SourceFile */ || !parentAndChildShareLine); + (parent.kind === 268 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Unknown */; } @@ -89449,8 +89651,8 @@ var ts; case 172 /* MappedType */: case 165 /* TupleType */: case 235 /* CaseBlock */: - case 258 /* DefaultClause */: - case 257 /* CaseClause */: + case 261 /* DefaultClause */: + case 260 /* CaseClause */: case 185 /* ParenthesizedExpression */: case 179 /* PropertyAccessExpression */: case 181 /* CallExpression */: @@ -89464,7 +89666,7 @@ var ts; case 174 /* ObjectBindingPattern */: case 251 /* JsxOpeningElement */: case 250 /* JsxSelfClosingElement */: - case 256 /* JsxExpression */: + case 259 /* JsxExpression */: case 150 /* MethodSignature */: case 155 /* CallSignature */: case 156 /* ConstructSignature */: @@ -89478,7 +89680,7 @@ var ts; case 241 /* NamedImports */: case 246 /* ExportSpecifier */: case 242 /* ImportSpecifier */: - case 261 /* PropertyAssignment */: + case 264 /* PropertyAssignment */: case 149 /* PropertyDeclaration */: return true; } @@ -90565,11 +90767,11 @@ var ts; if (!ts.isStringLiteral(token)) { throw ts.Debug.fail(); // These errors should only happen on the module name. } - var action = tryGetCodeActionForInstallPackageTypes(context.host, token.text); + var action = tryGetCodeActionForInstallPackageTypes(context.host, sourceFile.fileName, token.text); return action && [action]; }, }); - function tryGetCodeActionForInstallPackageTypes(host, moduleName) { + function tryGetCodeActionForInstallPackageTypes(host, fileName, moduleName) { var packageName = ts.getPackageName(moduleName).packageName; if (!host.isKnownTypesPackageName(packageName)) { // If !registry, registry not available yet, can't do anything. @@ -90579,7 +90781,7 @@ var ts; return { description: "Install '" + typesPackageName + "'", changes: [], - commands: [{ type: "install package", packageName: typesPackageName }], + commands: [{ type: "install package", file: fileName, packageName: typesPackageName }], }; } codefix.tryGetCodeActionForInstallPackageTypes = tryGetCodeActionForInstallPackageTypes; @@ -90991,7 +91193,7 @@ var ts; var original = ts.getTextOfNode(jsdocType); var type = checker.getTypeFromTypeNode(jsdocType); var actions = [createAction(jsdocType, sourceFile.fileName, original, checker.typeToString(type, /*enclosingDeclaration*/ undefined, 8 /* NoTruncation */))]; - if (jsdocType.kind === 270 /* JSDocNullableType */) { + if (jsdocType.kind === 273 /* JSDocNullableType */) { // for nullable types, suggest the flow-compatible `T | null | undefined` // in addition to the jsdoc/closure-compatible `T | null` var replacementWithUndefined = checker.typeToString(checker.getNullableType(type, 2048 /* Undefined */), /*enclosingDeclaration*/ undefined, 8 /* NoTruncation */); @@ -91210,10 +91412,12 @@ var ts; return parent; case 248 /* ExternalModuleReference */: return parent.parent; - default: - ts.Debug.assert(parent.kind === 244 /* ExportDeclaration */); + case 244 /* ExportDeclaration */: + case 181 /* CallExpression */:// For "require()" calls // Ignore these, can't add imports to them. return undefined; + default: + ts.Debug.fail(); } } function getCodeActionForNewImport(context, moduleSpecifier) { @@ -91265,6 +91469,7 @@ var ts; options.rootDirs && tryGetModuleNameFromRootDirs(options.rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName) || ts.removeFileExtension(getRelativePath(moduleFileName, sourceDirectory, getCanonicalFileName)); } + codefix.getModuleSpecifierForNewImport = getModuleSpecifierForNewImport; function tryGetModuleNameFromAmbientModule(moduleSymbol) { var decl = moduleSymbol.valueDeclaration; if (ts.isModuleDeclaration(decl) && ts.isStringLiteral(decl.name)) { @@ -91557,9 +91762,10 @@ var ts; var defaultExport = checker.tryGetMemberInModuleExports("default", moduleSymbol); if (defaultExport) { var localSymbol = ts.getLocalSymbolForExportDefault(defaultExport); - if (localSymbol && localSymbol.escapedName === symbolName && checkSymbolHasMeaning(localSymbol, currentTokenMeaning)) { + if ((localSymbol && localSymbol.escapedName === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, context.compilerOptions.target) === symbolName) + && checkSymbolHasMeaning(localSymbol || defaultExport, currentTokenMeaning)) { // check if this symbol is already used - var symbolId = ts.getUniqueSymbolId(localSymbol, checker); + var symbolId = ts.getUniqueSymbolId(localSymbol || defaultExport, checker); symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol, __assign({}, context, { kind: 1 /* Default */ }))); } } @@ -91589,6 +91795,36 @@ var ts; } } codefix.forEachExternalModule = forEachExternalModule; + function moduleSymbolToValidIdentifier(moduleSymbol, target) { + return moduleSpecifierToValidIdentifier(ts.removeFileExtension(ts.getBaseFileName(moduleSymbol.name)), target); + } + codefix.moduleSymbolToValidIdentifier = moduleSymbolToValidIdentifier; + function moduleSpecifierToValidIdentifier(moduleSpecifier, target) { + var res = ""; + var lastCharWasValid = true; + var firstCharCode = moduleSpecifier.charCodeAt(0); + if (ts.isIdentifierStart(firstCharCode, target)) { + res += String.fromCharCode(firstCharCode); + } + else { + lastCharWasValid = false; + } + for (var i = 1; i < moduleSpecifier.length; i++) { + var ch = moduleSpecifier.charCodeAt(i); + var isValid = ts.isIdentifierPart(ch, target); + if (isValid) { + var char = String.fromCharCode(ch); + if (!lastCharWasValid) { + char = char.toUpperCase(); + } + res += char; + } + lastCharWasValid = isValid; + } + // Need `|| "_"` to ensure result isn't empty. + var token = ts.stringToToken(res); + return token === undefined || !ts.isNonContextualKeyword(token) ? res || "_" : "_" + res; + } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); /* @internal */ @@ -92170,8 +92406,8 @@ var ts; case 194 /* BinaryExpression */: inferTypeFromBinaryExpressionContext(node, node.parent, checker, usageContext); break; - case 257 /* CaseClause */: - case 258 /* DefaultClause */: + case 260 /* CaseClause */: + case 261 /* DefaultClause */: inferTypeFromSwitchStatementLabelContext(node.parent, checker, usageContext); break; case 181 /* CallExpression */: @@ -92606,18 +92842,18 @@ var ts; return undefined; } switch (node.kind) { - case 268 /* JSDocAllType */: - case 269 /* JSDocUnknownType */: + case 271 /* JSDocAllType */: + case 272 /* JSDocUnknownType */: return ts.createTypeReferenceNode("any", ts.emptyArray); - case 272 /* JSDocOptionalType */: + case 275 /* JSDocOptionalType */: return transformJSDocOptionalType(node); - case 271 /* JSDocNonNullableType */: + case 274 /* JSDocNonNullableType */: return transformJSDocType(node.type); - case 270 /* JSDocNullableType */: + case 273 /* JSDocNullableType */: return transformJSDocNullableType(node); - case 274 /* JSDocVariadicType */: + case 277 /* JSDocVariadicType */: return transformJSDocVariadicType(node); - case 273 /* JSDocFunctionType */: + case 276 /* JSDocFunctionType */: return transformJSDocFunctionType(node); case 146 /* Parameter */: return transformJSDocParameter(node); @@ -92644,7 +92880,7 @@ var ts; } function transformJSDocParameter(node) { var index = node.parent.parameters.indexOf(node); - var isRest = node.type.kind === 274 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; + var isRest = node.type.kind === 277 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; var name = node.name || (isRest ? "rest" : "arg" + index); var dotdotdot = isRest ? ts.createToken(24 /* DotDotDotToken */) : node.dotDotDotToken; return ts.createParameter(node.decorators, node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer); @@ -93235,7 +93471,7 @@ var ts; switch (node.kind) { case 228 /* FunctionDeclaration */: case 229 /* ClassDeclaration */: - if (node.parent.kind === 265 /* SourceFile */ && node.parent.externalModuleIndicator === undefined) { + if (node.parent.kind === 268 /* SourceFile */ && node.parent.externalModuleIndicator === undefined) { // You cannot extract global declarations (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.FunctionWillNotBeVisibleInTheNewScope)); } @@ -93259,7 +93495,7 @@ var ts; permittedJumps = 4 /* Return */; } break; - case 257 /* CaseClause */: + case 260 /* CaseClause */: // allow unlabeled break inside case clauses permittedJumps |= 1 /* Break */; break; @@ -93372,7 +93608,7 @@ var ts; // * Module/namespace or source file if (isScope(current)) { scopes.push(current); - if (current.kind === 265 /* SourceFile */) { + if (current.kind === 268 /* SourceFile */) { return scopes; } } @@ -94448,7 +94684,7 @@ var ts; */ function isExtractableExpression(node) { switch (node.parent.kind) { - case 264 /* EnumMember */: + case 267 /* EnumMember */: return false; } switch (node.kind) { @@ -94469,9 +94705,9 @@ var ts; function isBlockLike(node) { switch (node.kind) { case 207 /* Block */: - case 265 /* SourceFile */: + case 268 /* SourceFile */: case 234 /* ModuleBlock */: - case 257 /* CaseClause */: + case 260 /* CaseClause */: return true; default: return false; @@ -94530,7 +94766,7 @@ var ts; var file = context.file, startPosition = context.startPosition; var node = ts.getTokenAtPosition(file, startPosition, /*includeJsDocComment*/ false); if (ts.isStringLiteral(node) && isModuleIdentifier(node) && ts.getResolvedModule(file, node.text) === undefined) { - return ts.codefix.tryGetCodeActionForInstallPackageTypes(context.host, node.text); + return ts.codefix.tryGetCodeActionForInstallPackageTypes(context.host, file.fileName, node.text); } } function isModuleIdentifier(node) { @@ -94646,7 +94882,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(286 /* SyntaxList */, nodes.pos, nodes.end, this); + var list = createNode(289 /* SyntaxList */, nodes.pos, nodes.end, this); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_9 = nodes; _i < nodes_9.length; _i++) { @@ -94670,9 +94906,9 @@ var ts; } if (ts.isJSDocCommentContainingNode(this)) { /** Don't add trivia for "tokens" since this is in a comment. */ - var children_3 = []; - this.forEachChild(function (child) { children_3.push(child); }); - this._children = children_3; + var children_4 = []; + this.forEachChild(function (child) { children_4.push(child); }); + this._children = children_4; return; } var children = []; @@ -94728,7 +94964,7 @@ var ts; if (!children.length) { return undefined; } - var child = ts.find(children, function (kid) { return kid.kind < 267 /* FirstJSDocNode */ || kid.kind > 285 /* LastJSDocNode */; }); + var child = ts.find(children, function (kid) { return kid.kind < 270 /* FirstJSDocNode */ || kid.kind > 288 /* LastJSDocNode */; }); return child.kind < 143 /* FirstNode */ ? child : child.getFirstToken(sourceFile); @@ -95066,7 +95302,7 @@ var ts; } } // falls through - case 264 /* EnumMember */: + case 267 /* EnumMember */: case 149 /* PropertyDeclaration */: case 148 /* PropertySignature */: addDeclaration(node); @@ -95608,7 +95844,7 @@ var ts; function getCompletionEntryDetails(fileName, position, name, formattingOptions, source) { synchronizeHostData(); var ruleProvider = formattingOptions ? getRuleProvider(formattingOptions) : undefined; - return ts.Completions.getCompletionEntryDetails(program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position, { name: name, source: source }, program.getSourceFiles(), host, ruleProvider); + return ts.Completions.getCompletionEntryDetails(program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position, { name: name, source: source }, program.getSourceFiles(), host, ruleProvider, getCanonicalFileName); } function getCompletionEntrySymbol(fileName, position, name, source) { synchronizeHostData(); @@ -95969,12 +96205,15 @@ var ts; return ts.codefix.getFixes({ errorCode: errorCode, sourceFile: sourceFile, span: span, program: program, newLineCharacter: newLineCharacter, host: host, cancellationToken: cancellationToken, rulesProvider: rulesProvider }); }); } - function applyCodeActionCommand(fileName, action) { - fileName = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + function applyCodeActionCommand(fileName, actionOrUndefined) { + var action = typeof fileName === "string" ? actionOrUndefined : fileName; + return ts.isArray(action) ? Promise.all(action.map(applySingleCodeActionCommand)) : applySingleCodeActionCommand(action); + } + function applySingleCodeActionCommand(action) { switch (action.type) { case "install package": return host.installPackage - ? host.installPackage({ fileName: fileName, packageName: action.packageName }) + ? host.installPackage({ fileName: ts.toPath(action.file, currentDirectory, getCanonicalFileName), packageName: action.packageName }) : Promise.reject("Host does not implement `installPackage`"); default: ts.Debug.fail(); @@ -96258,10 +96497,10 @@ var ts; } function isObjectLiteralElement(node) { switch (node.kind) { - case 253 /* JsxAttribute */: - case 255 /* JsxSpreadAttribute */: - case 261 /* PropertyAssignment */: - case 262 /* ShorthandPropertyAssignment */: + case 256 /* JsxAttribute */: + case 258 /* JsxSpreadAttribute */: + case 264 /* PropertyAssignment */: + case 265 /* ShorthandPropertyAssignment */: case 151 /* MethodDeclaration */: case 153 /* GetAccessor */: case 154 /* SetAccessor */: @@ -96283,7 +96522,7 @@ var ts; // falls through case 71 /* Identifier */: return isObjectLiteralElement(node.parent) && - (node.parent.parent.kind === 178 /* ObjectLiteralExpression */ || node.parent.parent.kind === 254 /* JsxAttributes */) && + (node.parent.parent.kind === 178 /* ObjectLiteralExpression */ || node.parent.parent.kind === 257 /* JsxAttributes */) && node.parent.name === node ? node.parent : undefined; } return undefined; @@ -96428,7 +96667,7 @@ var ts; // falls through case 234 /* ModuleBlock */: return spanInBlock(node); - case 260 /* CatchClause */: + case 263 /* CatchClause */: return spanInBlock(node.block); case 210 /* ExpressionStatement */: // span on the expression @@ -96466,8 +96705,8 @@ var ts; case 221 /* SwitchStatement */: // span on switch(...) return textSpanEndingAtNextToken(node, node.expression); - case 257 /* CaseClause */: - case 258 /* DefaultClause */: + case 260 /* CaseClause */: + case 261 /* DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); case 224 /* TryStatement */: @@ -96496,7 +96735,7 @@ var ts; // falls through case 229 /* ClassDeclaration */: case 232 /* EnumDeclaration */: - case 264 /* EnumMember */: + case 267 /* EnumMember */: case 176 /* BindingElement */: // span on complete node return textSpan(node); @@ -96554,8 +96793,8 @@ var ts; // [a, b, ...c] or { a, b } or { d: x } from destructuring pattern if ((node.kind === 71 /* Identifier */ || node.kind === 198 /* SpreadElement */ || - node.kind === 261 /* PropertyAssignment */ || - node.kind === 262 /* ShorthandPropertyAssignment */) && + node.kind === 264 /* PropertyAssignment */ || + node.kind === 265 /* ShorthandPropertyAssignment */) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { return textSpan(node); } @@ -96606,7 +96845,7 @@ var ts; } } // If this is name of property assignment, set breakpoint in the initializer - if (node.parent.kind === 261 /* PropertyAssignment */ && + if (node.parent.kind === 264 /* PropertyAssignment */ && node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); @@ -96832,7 +97071,7 @@ var ts; return textSpan(node); } // falls through - case 260 /* CatchClause */: + case 263 /* CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); case 235 /* CaseBlock */: // breakpoint in last statement of the last clause @@ -96911,7 +97150,7 @@ var ts; function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration if (ts.isFunctionLike(node.parent) || - node.parent.kind === 261 /* PropertyAssignment */ || + node.parent.kind === 264 /* PropertyAssignment */ || node.parent.kind === 146 /* Parameter */) { return spanInPreviousNode(node); } diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index 184cd7d33e0..62b632b773b 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -1168,6 +1168,10 @@ var ts; return Array.isArray ? Array.isArray(value) : value instanceof Array; } ts.isArray = isArray; + function toArray(value) { + return isArray(value) ? value : [value]; + } + ts.toArray = toArray; function isString(text) { return typeof text === "string"; } @@ -2076,6 +2080,11 @@ var ts; return (removeFileExtension(path) + newExtension); } ts.changeExtension = changeExtension; + function removeMinAndVersionNumbers(fileName) { + var trailingMinOrVersion = /[.-]((min)|(\d+(\.\d+)*))$/; + return fileName.replace(trailingMinOrVersion, "").replace(trailingMinOrVersion, ""); + } + ts.removeMinAndVersionNumbers = removeMinAndVersionNumbers; function Symbol(flags, name) { this.flags = flags; this.escapedName = name; @@ -2444,9 +2453,7 @@ var ts; function addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath) { var existingResult = getCachedFileSystemEntries(fileOrDirectoryPath); if (existingResult) { - if (!host.directoryExists(fileOrDirectory)) { - cachedReadDirectoryResult.delete(fileOrDirectoryPath); - } + clearCache(); } else { var parentResult = getCachedFileSystemEntriesForBaseDir(fileOrDirectoryPath); @@ -2457,8 +2464,12 @@ var ts; fileExists: host.fileExists(fileOrDirectoryPath), directoryExists: host.directoryExists(fileOrDirectoryPath) }; - updateFilesOfFileSystemEntry(parentResult, baseName, fsQueryResult.fileExists); - updateFileSystemEntry(parentResult.directories, baseName, fsQueryResult.directoryExists); + if (fsQueryResult.directoryExists || hasEntry(parentResult.directories, baseName)) { + clearCache(); + } + else { + updateFilesOfFileSystemEntry(parentResult, baseName, fsQueryResult.fileExists); + } return fsQueryResult; } } @@ -3813,6 +3824,9 @@ var ts; super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: diag(17011, ts.DiagnosticCategory.Error, "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", "'super' must be called before accessing a property of 'super' in the constructor of a derived class."), _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2: diag(17012, ts.DiagnosticCategory.Error, "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012", "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'?"), Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: diag(17013, ts.DiagnosticCategory.Error, "Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013", "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor."), + JSX_fragment_has_no_corresponding_closing_tag: diag(17014, ts.DiagnosticCategory.Error, "JSX_fragment_has_no_corresponding_closing_tag_17014", "JSX fragment has no corresponding closing tag."), + Expected_corresponding_closing_tag_for_JSX_fragment: diag(17015, ts.DiagnosticCategory.Error, "Expected_corresponding_closing_tag_for_JSX_fragment_17015", "Expected corresponding closing tag for JSX fragment."), + JSX_fragment_is_not_supported_when_using_jsxFactory: diag(17016, ts.DiagnosticCategory.Error, "JSX_fragment_is_not_supported_when_using_jsxFactory_17016", "JSX fragment is not supported when using --jsxFactory"), Circularity_detected_while_resolving_configuration_Colon_0: diag(18000, ts.DiagnosticCategory.Error, "Circularity_detected_while_resolving_configuration_Colon_0_18000", "Circularity detected while resolving configuration: {0}"), A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: diag(18001, ts.DiagnosticCategory.Error, "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", "A path in an 'extends' option must be relative or rooted, but '{0}' is not."), The_files_list_in_config_file_0_is_empty: diag(18002, ts.DiagnosticCategory.Error, "The_files_list_in_config_file_0_is_empty_18002", "The 'files' list in config file '{0}' is empty."), @@ -3976,7 +3990,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 265) { + while (node && node.kind !== 268) { node = node.parent; } return node; @@ -4064,7 +4078,7 @@ var ts; if (includeJsDoc && ts.hasJSDocNodes(node)) { return getTokenPosOfNode(node.jsDoc[0]); } - if (node.kind === 286 && node._children.length > 0) { + if (node.kind === 289 && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); @@ -4163,7 +4177,7 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 226 && node.parent.kind === 260; + return node.kind === 226 && node.parent.kind === 263; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { @@ -4187,7 +4201,7 @@ var ts; return node && node.kind === 233 && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 265 || + return node.kind === 268 || node.kind === 233 || ts.isFunctionLike(node); } @@ -4201,7 +4215,7 @@ var ts; return false; } switch (node.parent.kind) { - case 265: + case 268: return ts.isExternalModule(node.parent); case 234: return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); @@ -4215,9 +4229,9 @@ var ts; ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { - case 265: + case 268: case 235: - case 260: + case 263: case 233: case 214: case 215: @@ -4244,12 +4258,12 @@ var ts; case 157: case 160: case 161: - case 273: + case 276: case 229: case 199: case 230: case 231: - case 282: + case 285: case 228: case 151: case 152: @@ -4362,7 +4376,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 265: + case 268: var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); if (pos_1 === sourceFile.text.length) { return ts.createTextSpan(0, 0); @@ -4375,7 +4389,7 @@ var ts; case 230: case 233: case 232: - case 264: + case 267: case 228: case 186: case 151: @@ -4545,11 +4559,11 @@ var ts; case 216: case 220: case 221: - case 257: - case 258: + case 260: + case 261: case 222: case 224: - case 260: + case 263: return ts.forEachChild(node, traverse); } } @@ -4604,12 +4618,12 @@ var ts; if (node) { switch (node.kind) { case 176: - case 264: + case 267: case 146: - case 261: + case 264: case 149: case 148: - case 262: + case 265: case 226: return true; } @@ -4667,7 +4681,7 @@ var ts; ts.isThisTypePredicate = isThisTypePredicate; function getPropertyAssignment(objectLiteral, key, key2) { return ts.filter(objectLiteral.properties, function (property) { - if (property.kind === 261) { + if (property.kind === 264) { var propName = getTextOfPropertyName(property.name); return key === propName || (key2 && key2 === propName); } @@ -4721,7 +4735,7 @@ var ts; case 156: case 157: case 232: - case 265: + case 268: return node; } } @@ -4905,6 +4919,7 @@ var ts; case 200: case 249: case 250: + case 253: case 197: case 191: case 204: @@ -4934,8 +4949,8 @@ var ts; case 146: case 149: case 148: + case 267: case 264: - case 261: case 176: return parent.initializer === node; case 210: @@ -4945,7 +4960,7 @@ var ts; case 219: case 220: case 221: - case 257: + case 260: case 223: return parent.expression === node; case 214: @@ -4966,9 +4981,9 @@ var ts; case 144: return node === parent.expression; case 147: - case 256: - case 255: - case 263: + case 259: + case 258: + case 266: return true; case 201: return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent); @@ -5134,8 +5149,8 @@ var ts; case 146: case 151: case 150: - case 262: - case 261: + case 265: + case 264: case 149: case 148: return node.questionToken !== undefined; @@ -5145,7 +5160,7 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 273 && + return node.kind === 276 && node.parameters.length > 0 && node.parameters[0].name && node.parameters[0].name.escapedText === "new"; @@ -5192,7 +5207,7 @@ var ts; return result || ts.emptyArray; function getJSDocCommentsAndTagsWorker(node) { var parent = node.parent; - if (parent && (parent.kind === 261 || getNestedModuleDeclaration(parent))) { + if (parent && (parent.kind === 264 || getNestedModuleDeclaration(parent))) { getJSDocCommentsAndTagsWorker(parent); } if (parent && parent.parent && @@ -5235,7 +5250,7 @@ var ts; } ts.getParameterSymbolFromJSDoc = getParameterSymbolFromJSDoc; function getJSDocHost(node) { - ts.Debug.assert(node.parent.kind === 275); + ts.Debug.assert(node.parent.kind === 278); return node.parent.parent; } ts.getJSDocHost = getJSDocHost; @@ -5275,13 +5290,13 @@ var ts; case 198: node = parent; break; - case 262: + case 265: if (parent.name !== node) { return 0; } node = parent.parent; break; - case 261: + case 264: if (parent.name === node) { return 0; } @@ -5320,7 +5335,7 @@ var ts; ts.isNodeDescendantOf = isNodeDescendantOf; function isInAmbientContext(node) { while (node) { - if (hasModifier(node, 2) || (node.kind === 265 && node.isDeclarationFile)) { + if (hasModifier(node, 2) || (node.kind === 268 && node.isDeclarationFile)) { return true; } node = node.parent; @@ -5369,8 +5384,8 @@ var ts; case 150: case 153: case 154: + case 267: case 264: - case 261: case 179: return parent.name === node; case 143: @@ -5385,7 +5400,7 @@ var ts; case 242: return parent.propertyName === node; case 246: - case 253: + case 256: return true; } return false; @@ -5485,6 +5500,14 @@ var ts; return 72 <= token && token <= 142; } ts.isKeyword = isKeyword; + function isContextualKeyword(token) { + return 117 <= token && token <= 142; + } + ts.isContextualKeyword = isContextualKeyword; + function isNonContextualKeyword(token) { + return isKeyword(token) && !isContextualKeyword(token); + } + ts.isNonContextualKeyword = isNonContextualKeyword; function isTrivia(token) { return 2 <= token && token <= 7; } @@ -5626,7 +5649,7 @@ var ts; || kind === 153 || kind === 154 || kind === 233 - || kind === 265; + || kind === 268; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(range) { @@ -5713,6 +5736,7 @@ var ts; case 199: case 249: case 250: + case 253: case 12: case 13: case 196: @@ -5799,7 +5823,7 @@ var ts; return 2; case 198: return 1; - case 289: + case 292: return 0; default: return -1; @@ -7181,8 +7205,8 @@ var ts; return undefined; } switch (declaration.kind) { - case 284: - case 279: { + case 287: + case 282: { var name = declaration.name; if (name.kind === 143) { return name.right; @@ -7201,7 +7225,7 @@ var ts; return undefined; } } - case 283: + case 286: return getNameOfJSDocTypedef(declaration); case 243: { var expression = declaration.expression; @@ -7220,27 +7244,27 @@ var ts; } ts.getJSDocParameterTags = getJSDocParameterTags; function hasJSDocParameterTags(node) { - return !!getFirstJSDocTag(node, 279); + return !!getFirstJSDocTag(node, 282); } ts.hasJSDocParameterTags = hasJSDocParameterTags; function getJSDocAugmentsTag(node) { - return getFirstJSDocTag(node, 277); + return getFirstJSDocTag(node, 280); } ts.getJSDocAugmentsTag = getJSDocAugmentsTag; function getJSDocClassTag(node) { - return getFirstJSDocTag(node, 278); + return getFirstJSDocTag(node, 281); } ts.getJSDocClassTag = getJSDocClassTag; function getJSDocReturnTag(node) { - return getFirstJSDocTag(node, 280); + return getFirstJSDocTag(node, 283); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getFirstJSDocTag(node, 282); + return getFirstJSDocTag(node, 285); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function getJSDocTypeTag(node) { - var tag = getFirstJSDocTag(node, 281); + var tag = getFirstJSDocTag(node, 284); if (tag && tag.typeExpression && tag.typeExpression.type) { return tag; } @@ -7248,7 +7272,7 @@ var ts; } ts.getJSDocTypeTag = getJSDocTypeTag; function getJSDocType(node) { - var tag = getFirstJSDocTag(node, 281); + var tag = getFirstJSDocTag(node, 284); if (!tag && node.kind === 146) { var paramTags = getJSDocParameterTags(node); if (paramTags) { @@ -7491,7 +7515,7 @@ var ts; } ts.isParenthesizedExpression = isParenthesizedExpression; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 288) { + while (node.kind === 291) { node = node.expression; } return node; @@ -7765,138 +7789,150 @@ var ts; return node.kind === 252; } ts.isJsxClosingElement = isJsxClosingElement; - function isJsxAttribute(node) { + function isJsxFragment(node) { return node.kind === 253; } + ts.isJsxFragment = isJsxFragment; + function isJsxOpeningFragment(node) { + return node.kind === 254; + } + ts.isJsxOpeningFragment = isJsxOpeningFragment; + function isJsxClosingFragment(node) { + return node.kind === 255; + } + ts.isJsxClosingFragment = isJsxClosingFragment; + function isJsxAttribute(node) { + return node.kind === 256; + } ts.isJsxAttribute = isJsxAttribute; function isJsxAttributes(node) { - return node.kind === 254; + return node.kind === 257; } ts.isJsxAttributes = isJsxAttributes; function isJsxSpreadAttribute(node) { - return node.kind === 255; + return node.kind === 258; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxExpression(node) { - return node.kind === 256; + return node.kind === 259; } ts.isJsxExpression = isJsxExpression; function isCaseClause(node) { - return node.kind === 257; + return node.kind === 260; } ts.isCaseClause = isCaseClause; function isDefaultClause(node) { - return node.kind === 258; + return node.kind === 261; } ts.isDefaultClause = isDefaultClause; function isHeritageClause(node) { - return node.kind === 259; + return node.kind === 262; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 260; + return node.kind === 263; } ts.isCatchClause = isCatchClause; function isPropertyAssignment(node) { - return node.kind === 261; + return node.kind === 264; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 262; + return node.kind === 265; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isSpreadAssignment(node) { - return node.kind === 263; + return node.kind === 266; } ts.isSpreadAssignment = isSpreadAssignment; function isEnumMember(node) { - return node.kind === 264; + return node.kind === 267; } ts.isEnumMember = isEnumMember; function isSourceFile(node) { - return node.kind === 265; + return node.kind === 268; } ts.isSourceFile = isSourceFile; function isBundle(node) { - return node.kind === 266; + return node.kind === 269; } ts.isBundle = isBundle; function isJSDocTypeExpression(node) { - return node.kind === 267; + return node.kind === 270; } ts.isJSDocTypeExpression = isJSDocTypeExpression; function isJSDocAllType(node) { - return node.kind === 268; + return node.kind === 271; } ts.isJSDocAllType = isJSDocAllType; function isJSDocUnknownType(node) { - return node.kind === 269; + return node.kind === 272; } ts.isJSDocUnknownType = isJSDocUnknownType; function isJSDocNullableType(node) { - return node.kind === 270; + return node.kind === 273; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 271; + return node.kind === 274; } ts.isJSDocNonNullableType = isJSDocNonNullableType; function isJSDocOptionalType(node) { - return node.kind === 272; + return node.kind === 275; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 273; + return node.kind === 276; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 274; + return node.kind === 277; } ts.isJSDocVariadicType = isJSDocVariadicType; function isJSDoc(node) { - return node.kind === 275; + return node.kind === 278; } ts.isJSDoc = isJSDoc; function isJSDocAugmentsTag(node) { - return node.kind === 277; + return node.kind === 280; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocParameterTag(node) { - return node.kind === 279; + return node.kind === 282; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 280; + return node.kind === 283; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocTypeTag(node) { - return node.kind === 281; + return node.kind === 284; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 282; + return node.kind === 285; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 283; + return node.kind === 286; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocPropertyTag(node) { - return node.kind === 284; + return node.kind === 287; } ts.isJSDocPropertyTag = isJSDocPropertyTag; function isJSDocPropertyLikeTag(node) { - return node.kind === 284 || node.kind === 279; + return node.kind === 287 || node.kind === 282; } ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; function isJSDocTypeLiteral(node) { - return node.kind === 285; + return node.kind === 288; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; })(ts || (ts = {})); (function (ts) { function isSyntaxList(n) { - return n.kind === 286; + return n.kind === 289; } ts.isSyntaxList = isSyntaxList; function isNode(node) { @@ -8022,7 +8058,7 @@ var ts; case 156: case 157: case 160: - case 273: + case 276: case 161: return true; default: @@ -8066,9 +8102,9 @@ var ts; ts.isTypeElement = isTypeElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 261 - || kind === 262 - || kind === 263 + return kind === 264 + || kind === 265 + || kind === 266 || kind === 151 || kind === 153 || kind === 154 @@ -8089,13 +8125,13 @@ var ts; || kind === 95 || kind === 130 || kind === 201 - || kind === 268 - || kind === 269 - || kind === 270 || kind === 271 || kind === 272 || kind === 273 - || kind === 274; + || kind === 274 + || kind === 275 + || kind === 276 + || kind === 277; } function isTypeNode(node) { return isTypeNodeKind(node.kind); @@ -8206,6 +8242,7 @@ var ts; case 181: case 249: case 250: + case 253: case 183: case 177: case 185: @@ -8274,8 +8311,8 @@ var ts; case 198: case 202: case 200: - case 289: - case 288: + case 292: + case 291: return true; default: return isUnaryExpressionKind(kind); @@ -8288,11 +8325,11 @@ var ts; } ts.isAssertionExpression = isAssertionExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 288; + return node.kind === 291; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isNotEmittedStatement(node) { - return node.kind === 287; + return node.kind === 290; } ts.isNotEmittedStatement = isNotEmittedStatement; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -8368,7 +8405,7 @@ var ts; || kind === 199 || kind === 152 || kind === 232 - || kind === 264 + || kind === 267 || kind === 246 || kind === 228 || kind === 186 @@ -8377,22 +8414,22 @@ var ts; || kind === 237 || kind === 242 || kind === 230 - || kind === 253 + || kind === 256 || kind === 151 || kind === 150 || kind === 233 || kind === 236 || kind === 240 || kind === 146 - || kind === 261 + || kind === 264 || kind === 149 || kind === 148 || kind === 154 - || kind === 262 + || kind === 265 || kind === 231 || kind === 145 || kind === 226 - || kind === 283; + || kind === 286; } function isDeclarationStatementKind(kind) { return kind === 228 @@ -8427,13 +8464,13 @@ var ts; || kind === 208 || kind === 213 || kind === 220 - || kind === 287 - || kind === 291 - || kind === 290; + || kind === 290 + || kind === 294 + || kind === 293; } function isDeclaration(node) { if (node.kind === 145) { - return node.parent.kind !== 282 || ts.isInJavaScriptFile(node); + return node.parent.kind !== 285 || ts.isInJavaScriptFile(node); } return isDeclarationKind(node.kind); } @@ -8457,7 +8494,7 @@ var ts; if (node.kind !== 207) return false; if (node.parent !== undefined) { - if (node.parent.kind === 224 || node.parent.kind === 260) { + if (node.parent.kind === 224 || node.parent.kind === 263) { return false; } } @@ -8480,21 +8517,22 @@ var ts; function isJsxChild(node) { var kind = node.kind; return kind === 249 - || kind === 256 + || kind === 259 || kind === 250 - || kind === 10; + || kind === 10 + || kind === 253; } ts.isJsxChild = isJsxChild; function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 253 - || kind === 255; + return kind === 256 + || kind === 258; } ts.isJsxAttributeLike = isJsxAttributeLike; function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 9 - || kind === 256; + || kind === 259; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isJsxOpeningLikeElement(node) { @@ -8505,20 +8543,20 @@ var ts; ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 257 - || kind === 258; + return kind === 260 + || kind === 261; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; function isJSDocNode(node) { - return node.kind >= 267 && node.kind <= 285; + return node.kind >= 270 && node.kind <= 288; } ts.isJSDocNode = isJSDocNode; function isJSDocCommentContainingNode(node) { - return node.kind === 275 || isJSDocTag(node); + return node.kind === 278 || isJSDocTag(node); } ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode; function isJSDocTag(node) { - return node.kind >= 276 && node.kind <= 285; + return node.kind >= 279 && node.kind <= 288; } ts.isJSDocTag = isJSDocTag; function isSetAccessor(node) { @@ -8540,6 +8578,10 @@ var ts; return token >= 71; } ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; + function tokenIsIdentifierOrKeywordOrGreaterThan(token) { + return token === 29 || tokenIsIdentifierOrKeyword(token); + } + ts.tokenIsIdentifierOrKeywordOrGreaterThan = tokenIsIdentifierOrKeywordOrGreaterThan; var textToToken = ts.createMapFromTemplate({ "abstract": 117, "any": 119, @@ -10143,7 +10185,7 @@ var ts; var IdentifierConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 265) { + if (kind === 268) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 71) { @@ -10187,19 +10229,19 @@ var ts; visitNode(cbNode, node.constraint) || visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); - case 262: + case 265: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 263: + case 266: return visitNode(cbNode, node.expression); case 146: case 149: case 148: - case 261: + case 264: case 226: case 176: return visitNodes(cbNode, cbNodes, node.decorators) || @@ -10331,7 +10373,7 @@ var ts; case 207: case 234: return visitNodes(cbNode, cbNodes, node.statements); - case 265: + case 268: return visitNodes(cbNode, cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); case 208: @@ -10379,10 +10421,10 @@ var ts; visitNode(cbNode, node.caseBlock); case 235: return visitNodes(cbNode, cbNodes, node.clauses); - case 257: + case 260: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.statements); - case 258: + case 261: return visitNodes(cbNode, cbNodes, node.statements); case 222: return visitNode(cbNode, node.label) || @@ -10393,7 +10435,7 @@ var ts; return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 260: + case 263: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 147: @@ -10424,7 +10466,7 @@ var ts; visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.members); - case 264: + case 267: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 233: @@ -10471,7 +10513,7 @@ var ts; return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 144: return visitNode(cbNode, node.expression); - case 259: + case 262: return visitNodes(cbNode, cbNodes, node.types); case 201: return visitNode(cbNode, node.expression) || @@ -10480,45 +10522,49 @@ var ts; return visitNode(cbNode, node.expression); case 247: return visitNodes(cbNode, cbNodes, node.decorators); - case 289: + case 292: return visitNodes(cbNode, cbNodes, node.elements); case 249: return visitNode(cbNode, node.openingElement) || visitNodes(cbNode, cbNodes, node.children) || visitNode(cbNode, node.closingElement); + case 253: + return visitNode(cbNode, node.openingFragment) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingFragment); case 250: case 251: return visitNode(cbNode, node.tagName) || visitNode(cbNode, node.attributes); - case 254: + case 257: return visitNodes(cbNode, cbNodes, node.properties); - case 253: + case 256: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 255: + case 258: return visitNode(cbNode, node.expression); - case 256: + case 259: return visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.expression); case 252: return visitNode(cbNode, node.tagName); - case 267: - return visitNode(cbNode, node.type); - case 271: - return visitNode(cbNode, node.type); case 270: return visitNode(cbNode, node.type); - case 272: - return visitNode(cbNode, node.type); - case 273: - return visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); case 274: return visitNode(cbNode, node.type); + case 273: + return visitNode(cbNode, node.type); case 275: + return visitNode(cbNode, node.type); + case 276: + return visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + case 277: + return visitNode(cbNode, node.type); + case 278: return visitNodes(cbNode, cbNodes, node.tags); - case 279: - case 284: + case 282: + case 287: if (node.isNameFirst) { return visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression); @@ -10527,17 +10573,17 @@ var ts; return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); } - case 280: - return visitNode(cbNode, node.typeExpression); - case 281: - return visitNode(cbNode, node.typeExpression); - case 277: - return visitNode(cbNode, node.class); - case 282: - return visitNodes(cbNode, cbNodes, node.typeParameters); case 283: + return visitNode(cbNode, node.typeExpression); + case 284: + return visitNode(cbNode, node.typeExpression); + case 280: + return visitNode(cbNode, node.class); + case 285: + return visitNodes(cbNode, cbNodes, node.typeParameters); + case 286: if (node.typeExpression && - node.typeExpression.kind === 267) { + node.typeExpression.kind === 270) { return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName); } @@ -10545,7 +10591,7 @@ var ts; return visitNode(cbNode, node.fullName) || visitNode(cbNode, node.typeExpression); } - case 285: + case 288: if (node.jsDocPropertyTags) { for (var _i = 0, _a = node.jsDocPropertyTags; _i < _a.length; _i++) { var tag = _a[_i]; @@ -10553,7 +10599,7 @@ var ts; } } return; - case 288: + case 291: return visitNode(cbNode, node.expression); } } @@ -10744,7 +10790,7 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion, scriptKind) { - var sourceFile = new SourceFileConstructor(265, 0, sourceText.length); + var sourceFile = new SourceFileConstructor(268, 0, sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -11181,6 +11227,10 @@ var ts; nextToken(); return ts.tokenIsIdentifierOrKeyword(token()); } + function nextTokenIsIdentifierOrKeywordOrGreaterThan() { + nextToken(); + return ts.tokenIsIdentifierOrKeywordOrGreaterThan(token()); + } function isHeritageClauseExtendsOrImplementsKeyword() { if (token() === 108 || token() === 85) { @@ -11365,8 +11415,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 257: - case 258: + case 260: + case 261: return true; } } @@ -11410,7 +11460,7 @@ var ts; return false; } function isReusableEnumMember(node) { - return node.kind === 264; + return node.kind === 267; } function isReusableTypeMember(node) { if (node) { @@ -11631,7 +11681,7 @@ var ts; return finishNode(node); } function parseJSDocAllType() { - var result = createNode(268); + var result = createNode(271); nextToken(); return finishNode(result); } @@ -11644,18 +11694,18 @@ var ts; token() === 29 || token() === 58 || token() === 49) { - var result = createNode(269, pos); + var result = createNode(272, pos); return finishNode(result); } else { - var result = createNode(270, pos); + var result = createNode(273, pos); result.type = parseType(); return finishNode(result); } } function parseJSDocFunctionType() { if (lookAhead(nextTokenIsOpenParen)) { - var result = createNode(273); + var result = createNode(276); nextToken(); fillSignature(56, 4 | 32, result); return addJSDocComment(finishNode(result)); @@ -12011,9 +12061,9 @@ var ts; case 89: return parseJSDocFunctionType(); case 24: - return parseJSDocNodeWithType(274); + return parseJSDocNodeWithType(277); case 51: - return parseJSDocNodeWithType(271); + return parseJSDocNodeWithType(274); case 13: case 9: case 8: @@ -12095,13 +12145,13 @@ var ts; if (!(contextFlags & 1048576)) { return type; } - type = createJSDocPostfixType(272, type); + type = createJSDocPostfixType(275, type); break; case 51: - type = createJSDocPostfixType(271, type); + type = createJSDocPostfixType(274, type); break; case 55: - type = createJSDocPostfixType(270, type); + type = createJSDocPostfixType(273, type); break; case 21: parseExpected(21); @@ -12759,8 +12809,8 @@ var ts; node.operand = parseLeftHandSideExpressionOrHigher(); return finishNode(node); } - else if (sourceFile.languageVariant === 1 && token() === 27 && lookAhead(nextTokenIsIdentifierOrKeyword)) { - return parseJsxElementOrSelfClosingElement(true); + else if (sourceFile.languageVariant === 1 && token() === 27 && lookAhead(nextTokenIsIdentifierOrKeywordOrGreaterThan)) { + return parseJsxElementOrSelfClosingElementOrFragment(true); } var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); @@ -12812,25 +12862,32 @@ var ts; return lhs.name.escapedText === rhs.name.escapedText && tagNamesAreEquivalent(lhs.expression, rhs.expression); } - function parseJsxElementOrSelfClosingElement(inExpressionContext) { - var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); + function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext) { + var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); var result; if (opening.kind === 251) { var node = createNode(249, opening.pos); node.openingElement = opening; - node.children = parseJsxChildren(node.openingElement.tagName); + node.children = parseJsxChildren(node.openingElement); node.closingElement = parseJsxClosingElement(inExpressionContext); if (!tagNamesAreEquivalent(node.openingElement.tagName, node.closingElement.tagName)) { parseErrorAtPosition(node.closingElement.pos, node.closingElement.end - node.closingElement.pos, ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNodeFromSourceText(sourceText, node.openingElement.tagName)); } result = finishNode(node); } + else if (opening.kind === 254) { + var node = createNode(253, opening.pos); + node.openingFragment = opening; + node.children = parseJsxChildren(node.openingFragment); + node.closingFragment = parseJsxClosingFragment(inExpressionContext); + result = finishNode(node); + } else { ts.Debug.assert(opening.kind === 250); result = opening; } if (inExpressionContext && token() === 27) { - var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(true); }); + var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElementOrFragment(true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); var badNode = createNode(194, result.pos); @@ -12858,11 +12915,11 @@ var ts; case 17: return parseJsxExpression(false); case 27: - return parseJsxElementOrSelfClosingElement(false); + return parseJsxElementOrSelfClosingElementOrFragment(false); } ts.Debug.fail("Unknown JSX child kind " + token()); } - function parseJsxChildren(openingTagName) { + function parseJsxChildren(openingTag) { var list = []; var listPos = getNodePos(); var saveParsingContext = parsingContext; @@ -12873,7 +12930,13 @@ var ts; break; } else if (token() === 1) { - parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTagName)); + if (ts.isJsxOpeningFragment(openingTag)) { + parseErrorAtPosition(openingTag.pos, openingTag.end - openingTag.pos, ts.Diagnostics.JSX_fragment_has_no_corresponding_closing_tag); + } + else { + var openingTagName = openingTag.tagName; + parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTagName)); + } break; } else if (token() === 7) { @@ -12888,13 +12951,18 @@ var ts; return createNodeArray(list, listPos); } function parseJsxAttributes() { - var jsxAttributes = createNode(254); + var jsxAttributes = createNode(257); jsxAttributes.properties = parseList(13, parseJsxAttribute); return finishNode(jsxAttributes); } - function parseJsxOpeningOrSelfClosingElement(inExpressionContext) { + function parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext) { var fullStart = scanner.getStartPos(); parseExpected(27); + if (token() === 29) { + parseExpected(29); + var node_1 = createNode(254, fullStart); + return finishNode(node_1); + } var tagName = parseJsxElementName(); var attributes = parseJsxAttributes(); var node; @@ -12930,7 +12998,7 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(256); + var node = createNode(259); parseExpected(17); if (token() !== 18) { node.dotDotDotToken = parseOptionalToken(24); @@ -12950,7 +13018,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(253); + var node = createNode(256); node.name = parseIdentifierName(); if (token() === 58) { switch (scanJsxAttributeValue()) { @@ -12965,7 +13033,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(255); + var node = createNode(258); parseExpected(17); parseExpected(24); node.expression = parseExpression(); @@ -12985,6 +13053,22 @@ var ts; } return finishNode(node); } + function parseJsxClosingFragment(inExpressionContext) { + var node = createNode(255); + parseExpected(28); + if (ts.tokenIsIdentifierOrKeyword(token())) { + var unexpectedTagName = parseJsxElementName(); + parseErrorAtPosition(unexpectedTagName.pos, unexpectedTagName.end - unexpectedTagName.pos, ts.Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment); + } + if (inExpressionContext) { + parseExpected(29); + } + else { + parseExpected(29, undefined, false); + scanJsxText(); + } + return finishNode(node); + } function parseTypeAssertion() { var node = createNode(184); parseExpected(27); @@ -13190,7 +13274,7 @@ var ts; var fullStart = scanner.getStartPos(); var dotDotDotToken = parseOptionalToken(24); if (dotDotDotToken) { - var spreadElement = createNode(263, fullStart); + var spreadElement = createNode(266, fullStart); spreadElement.expression = parseAssignmentExpressionOrHigher(); return addJSDocComment(finishNode(spreadElement)); } @@ -13209,7 +13293,7 @@ var ts; } var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 26 || token() === 18 || token() === 58); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(262, fullStart); + var shorthandDeclaration = createNode(265, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(58); @@ -13220,7 +13304,7 @@ var ts; return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(261, fullStart); + var propertyAssignment = createNode(264, fullStart); propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; @@ -13269,10 +13353,10 @@ var ts; var fullStart = scanner.getStartPos(); parseExpected(94); if (parseOptional(23)) { - var node_1 = createNode(204, fullStart); - node_1.keywordToken = 94; - node_1.name = parseIdentifierName(); - return finishNode(node_1); + var node_2 = createNode(204, fullStart); + node_2.keywordToken = 94; + node_2.name = parseIdentifierName(); + return finishNode(node_2); } var node = createNode(182, fullStart); node.expression = parseMemberExpressionOrHigher(); @@ -13423,7 +13507,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(257); + var node = createNode(260); parseExpected(73); node.expression = allowInAnd(parseExpression); parseExpected(56); @@ -13431,7 +13515,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(258); + var node = createNode(261); parseExpected(79); parseExpected(56); node.statements = parseList(3, parseStatement); @@ -13472,7 +13556,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(260); + var result = createNode(263); parseExpected(74); if (parseOptional(19)) { result.variableDeclaration = parseVariableDeclaration(); @@ -14096,7 +14180,7 @@ var ts; function parseHeritageClause() { var tok = token(); if (tok === 85 || tok === 108) { - var node = createNode(259); + var node = createNode(262); node.token = tok; nextToken(); node.types = parseDelimitedList(7, parseExpressionWithTypeArguments); @@ -14145,7 +14229,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseEnumMember() { - var node = createNode(264, scanner.getStartPos()); + var node = createNode(267, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return addJSDocComment(finishNode(node)); @@ -14486,7 +14570,7 @@ var ts; } JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; function parseJSDocTypeExpression(requireBraces) { - var result = createNode(267, scanner.getTokenPos()); + var result = createNode(270, scanner.getTokenPos()); if (!parseExpected(17) && requireBraces) { return undefined; } @@ -14644,7 +14728,7 @@ var ts; content.charCodeAt(start + 3) !== 42; } function createJSDocComment() { - var result = createNode(275, start); + var result = createNode(278, start); result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd); result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -14761,7 +14845,7 @@ var ts; return comments; } function parseUnknownTag(atToken, tagName) { - var result = createNode(276, atToken.pos); + var result = createNode(279, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -14813,8 +14897,8 @@ var ts; typeExpression = tryParseTypeExpression(); } var result = target === 1 ? - createNode(279, atToken.pos) : - createNode(284, atToken.pos); + createNode(282, atToken.pos) : + createNode(287, atToken.pos); var nestedTypeLiteral = parseNestedTypeLiteral(typeExpression, name); if (nestedTypeLiteral) { typeExpression = nestedTypeLiteral; @@ -14830,7 +14914,7 @@ var ts; } function parseNestedTypeLiteral(typeExpression, name) { if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) { - var typeLiteralExpression = createNode(267, scanner.getTokenPos()); + var typeLiteralExpression = createNode(270, scanner.getTokenPos()); var child = void 0; var jsdocTypeLiteral = void 0; var start_2 = scanner.getStartPos(); @@ -14842,7 +14926,7 @@ var ts; children.push(child); } if (children) { - jsdocTypeLiteral = createNode(285, start_2); + jsdocTypeLiteral = createNode(288, start_2); jsdocTypeLiteral.jsDocPropertyTags = children; if (typeExpression.type.kind === 164) { jsdocTypeLiteral.isArrayType = true; @@ -14853,27 +14937,27 @@ var ts; } } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 280; })) { + if (ts.forEach(tags, function (t) { return t.kind === 283; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } - var result = createNode(280, atToken.pos); + var result = createNode(283, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 281; })) { + if (ts.forEach(tags, function (t) { return t.kind === 284; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } - var result = createNode(281, atToken.pos); + var result = createNode(284, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = parseJSDocTypeExpression(true); return finishNode(result); } function parseAugmentsTag(atToken, tagName) { - var result = createNode(277, atToken.pos); + var result = createNode(280, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.class = parseExpressionWithTypeArgumentsForAugments(); @@ -14901,7 +14985,7 @@ var ts; return node; } function parseClassTag(atToken, tagName) { - var tag = createNode(278, atToken.pos); + var tag = createNode(281, atToken.pos); tag.atToken = atToken; tag.tagName = tagName; return finishNode(tag); @@ -14909,7 +14993,7 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(283, atToken.pos); + var typedefTag = createNode(286, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(0); @@ -14932,9 +15016,9 @@ var ts; var start_3 = scanner.getStartPos(); while (child = tryParse(function () { return parseChildParameterOrPropertyTag(0); })) { if (!jsdocTypeLiteral) { - jsdocTypeLiteral = createNode(285, start_3); + jsdocTypeLiteral = createNode(288, start_3); } - if (child.kind === 281) { + if (child.kind === 284) { if (childTypeTag) { break; } @@ -14996,7 +15080,7 @@ var ts; case 57: if (canParseTag) { var child = tryParseChildTag(target); - if (child && child.kind === 279 && + if (child && child.kind === 282 && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; } @@ -15046,7 +15130,7 @@ var ts; return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 282; })) { + if (ts.forEach(tags, function (t) { return t.kind === 285; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } var typeParameters = []; @@ -15070,7 +15154,7 @@ var ts; break; } } - var result = createNode(282, atToken.pos); + var result = createNode(285, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = createNodeArray(typeParameters, typeParametersPos); @@ -16327,7 +16411,7 @@ var ts; var result = {}; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 261) { + if (element.kind !== 264) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); continue; } @@ -17256,7 +17340,7 @@ var ts; if (!ts.hasJavaScriptFileExtension(j)) return undefined; var inferredTypingName = ts.removeFileExtension(ts.getBaseFileName(j.toLowerCase())); - var cleanedTypingName = inferredTypingName.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); + var cleanedTypingName = ts.removeMinAndVersionNumbers(inferredTypingName); return safeList.get(cleanedTypingName); }); if (fromFileNames.length) { @@ -18300,12 +18384,12 @@ var ts; if (this.log.isEnabled()) { this.log.writeLine("Finished typings discovery: " + JSON.stringify(discoverTypingsResult)); } - this.sendResponse(this.createSetTypings(req, discoverTypingsResult.cachedTypingPaths)); this.watchFiles(req.projectName, discoverTypingsResult.filesToWatch); if (discoverTypingsResult.newTypingNames.length) { this.installTypings(req, req.cachePath || this.globalCachePath, discoverTypingsResult.cachedTypingPaths, discoverTypingsResult.newTypingNames); } else { + this.sendResponse(this.createSetTypings(req, discoverTypingsResult.cachedTypingPaths)); if (this.log.isEnabled()) { this.log.writeLine("No new typings were requested as a result of typings discovery"); }