- 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("");
- emitJsxTagName(node.tagName);
+ if (ts.isJsxClosingElement(node)) {
+ emitJsxTagName(node.tagName);
+ }
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("");
- emitJsxTagName(node.tagName);
+ if (ts.isJsxClosingElement(node)) {
+ emitJsxTagName(node.tagName);
+ }
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");
}