From aca1aa68975904e8d184df3a3f7efe4a606bca33 Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Mon, 22 Aug 2022 04:39:32 +0000 Subject: [PATCH] Update LKG --- lib/tsc.js | 188 +++++++++++++++------------------ lib/tsserver.js | 200 ++++++++++++++++-------------------- lib/tsserverlibrary.d.ts | 176 +++++++++++-------------------- lib/tsserverlibrary.js | 200 ++++++++++++++++-------------------- lib/typescript.d.ts | 176 +++++++++++-------------------- lib/typescript.js | 200 ++++++++++++++++-------------------- lib/typescriptServices.d.ts | 176 +++++++++++-------------------- lib/typescriptServices.js | 200 ++++++++++++++++-------------------- lib/typingsInstaller.js | 190 ++++++++++++++++------------------ 9 files changed, 711 insertions(+), 995 deletions(-) diff --git a/lib/tsc.js b/lib/tsc.js index ae1a92412f2c7..50fb6d2ac41db 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -2071,6 +2071,7 @@ var ts; var currentAssertionLevel = 0; Debug.currentLogLevel = LogLevel.Warning; Debug.isDebugging = false; + Debug.enableDeprecationWarnings = true; function getTypeScriptVersion() { return typeScriptVersion !== null && typeScriptVersion !== void 0 ? typeScriptVersion : (typeScriptVersion = new ts.Version(ts.version)); } @@ -2655,7 +2656,7 @@ var ts; function createWarningDeprecation(name, errorAfter, since, message) { var hasWrittenDeprecation = false; return function () { - if (!hasWrittenDeprecation) { + if (Debug.enableDeprecationWarnings && !hasWrittenDeprecation) { log.warn(formatDeprecationMessage(name, false, errorAfter, since, message)); hasWrittenDeprecation = true; } @@ -4424,7 +4425,6 @@ var ts; ts.sys = (function () { var byteOrderMarkIndicator = "\uFEFF"; function getNodeSystem() { - var _a; var nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[a-zA-Z0-9_\s]+(\.js)?$)/; var _fs = require("fs"); var _path = require("path"); @@ -4433,7 +4433,7 @@ var ts; try { _crypto = require("crypto"); } - catch (_b) { + catch (_a) { _crypto = undefined; } var activeSession; @@ -4444,10 +4444,10 @@ var ts; var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin"; var platform = _os.platform(); var useCaseSensitiveFileNames = isFileSystemCaseSensitive(); - var realpathSync = (_a = _fs.realpathSync.native) !== null && _a !== void 0 ? _a : _fs.realpathSync; + var fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync; var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin"); var getCurrentDirectory = ts.memoize(function () { return process.cwd(); }); - var _c = createSystemWatchFunctions({ + var _b = createSystemWatchFunctions({ pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames), getModifiedTime: getModifiedTime, setTimeout: setTimeout, @@ -4465,7 +4465,7 @@ var ts; defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); }, inodeWatching: isLinuxOrMacOs, sysLog: sysLog, - }), watchFile = _c.watchFile, watchDirectory = _c.watchDirectory; + }), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory; var nodeSystem = { args: process.argv.slice(2), newLine: _os.EOL, @@ -4815,9 +4815,12 @@ var ts; function getDirectories(path) { return getAccessibleFileSystemEntries(path).directories.slice(); } + function fsRealPathHandlingLongPath(path) { + return path.length < 260 ? _fs.realpathSync.native(path) : _fs.realpathSync(path); + } function realpath(path) { try { - return realpathSync(path); + return fsRealpath(path); } catch (_a) { return path; @@ -17025,7 +17028,7 @@ var ts; case 165: { var parent_2 = node.parent; return ts.canHaveDecorators(parent_2) ? parent_2.modifiers : - ts.canHaveIllegalDecorators(parent_2) ? parent_2.decorators : + ts.canHaveIllegalDecorators(parent_2) ? parent_2.illegalDecorators : undefined; } case 291: @@ -18726,7 +18729,7 @@ var ts; var node = createBaseGenericNamedDeclaration(170, undefined, undefined, undefined); node.body = body; node.transformFlags = propagateChildFlags(body) | 16777216; - node.decorators = undefined; + node.illegalDecorators = undefined; node.modifiers = undefined; return node; } @@ -18737,7 +18740,7 @@ var ts; } function finishUpdateClassStaticBlockDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.modifiers = original.modifiers; } return update(updated, original); @@ -18745,7 +18748,7 @@ var ts; function createConstructorDeclaration(modifiers, parameters, body) { var node = createBaseFunctionLikeDeclaration(171, modifiers, undefined, undefined, parameters, undefined, body); node.transformFlags |= 1024; - node.decorators = undefined; + node.illegalDecorators = undefined; node.typeParameters = undefined; node.type = undefined; return node; @@ -18759,7 +18762,7 @@ var ts; } function finishUpdateConstructorDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.typeParameters = original.typeParameters; updated.type = original.type; } @@ -20274,7 +20277,7 @@ var ts; node.transformFlags |= 2048; } } - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } function updateFunctionDeclaration(node, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { @@ -20290,7 +20293,7 @@ var ts; } function finishUpdateFunctionDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return finishUpdateBaseSignatureDeclaration(updated, original); } @@ -20320,7 +20323,7 @@ var ts; var node = createBaseInterfaceOrClassLikeDeclaration(258, modifiers, name, typeParameters, heritageClauses); node.members = createNodeArray(members); node.transformFlags = 1; - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } function updateInterfaceDeclaration(node, modifiers, name, typeParameters, heritageClauses, members) { @@ -20334,7 +20337,7 @@ var ts; } function finishUpdateInterfaceDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -20342,7 +20345,7 @@ var ts; var node = createBaseGenericNamedDeclaration(259, modifiers, name, typeParameters); node.type = type; node.transformFlags = 1; - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } function updateTypeAliasDeclaration(node, modifiers, name, typeParameters, type) { @@ -20355,7 +20358,7 @@ var ts; } function finishUpdateTypeAliasDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -20366,7 +20369,7 @@ var ts; propagateChildrenFlags(node.members) | 1; node.transformFlags &= ~67108864; - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } function updateEnumDeclaration(node, modifiers, name, members) { @@ -20378,7 +20381,7 @@ var ts; } function finishUpdateEnumDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -20400,7 +20403,7 @@ var ts; 1; } node.transformFlags &= ~67108864; - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } function updateModuleDeclaration(node, modifiers, name, body) { @@ -20412,7 +20415,7 @@ var ts; } function finishUpdateModuleDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -20441,7 +20444,7 @@ var ts; function createNamespaceExportDeclaration(name) { var node = createBaseNamedDeclaration(264, undefined, name); node.transformFlags = 1; - node.decorators = undefined; + node.illegalDecorators = undefined; node.modifiers = undefined; return node; } @@ -20452,7 +20455,7 @@ var ts; } function finishUpdateNamespaceExportDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.modifiers = original.modifiers; } return update(updated, original); @@ -20465,7 +20468,7 @@ var ts; if (!ts.isExternalModuleReference(node.moduleReference)) node.transformFlags |= 1; node.transformFlags &= ~67108864; - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } function updateImportEqualsDeclaration(node, modifiers, isTypeOnly, name, moduleReference) { @@ -20478,7 +20481,7 @@ var ts; } function finishUpdateImportEqualsDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -20492,7 +20495,7 @@ var ts; propagateChildFlags(node.importClause) | propagateChildFlags(node.moduleSpecifier); node.transformFlags &= ~67108864; - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } function updateImportDeclaration(node, modifiers, importClause, moduleSpecifier, assertClause) { @@ -20505,7 +20508,7 @@ var ts; } function finishUpdateImportDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -20633,7 +20636,7 @@ var ts; : parenthesizerRules().parenthesizeExpressionOfExportDefault(expression); node.transformFlags |= propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.expression); node.transformFlags &= ~67108864; - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } function updateExportAssignment(node, modifiers, expression) { @@ -20644,7 +20647,7 @@ var ts; } function finishUpdateExportAssignment(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -20660,7 +20663,7 @@ var ts; propagateChildFlags(node.exportClause) | propagateChildFlags(node.moduleSpecifier); node.transformFlags &= ~67108864; - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } function updateExportDeclaration(node, modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause) { @@ -20674,7 +20677,7 @@ var ts; } function finishUpdateExportDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -21293,7 +21296,7 @@ var ts; node.transformFlags |= propagateChildFlags(node.name) | propagateChildFlags(node.initializer); - node.decorators = undefined; + node.illegalDecorators = undefined; node.modifiers = undefined; node.questionToken = undefined; node.exclamationToken = undefined; @@ -21307,7 +21310,7 @@ var ts; } function finishUpdatePropertyAssignment(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.modifiers = original.modifiers; updated.questionToken = original.questionToken; updated.exclamationToken = original.exclamationToken; @@ -21321,7 +21324,7 @@ var ts; propagateChildFlags(node.objectAssignmentInitializer) | 1024; node.equalsToken = undefined; - node.decorators = undefined; + node.illegalDecorators = undefined; node.modifiers = undefined; node.questionToken = undefined; node.exclamationToken = undefined; @@ -21336,7 +21339,7 @@ var ts; function finishUpdateShorthandPropertyAssignment(updated, original) { if (updated !== original) { updated.equalsToken = original.equalsToken; - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.modifiers = original.modifiers; updated.questionToken = original.questionToken; updated.exclamationToken = original.exclamationToken; @@ -24917,7 +24920,7 @@ var ts; visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); case 297: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || @@ -24947,7 +24950,7 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); case 296: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || @@ -24964,7 +24967,7 @@ var ts; visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 176: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || @@ -25002,7 +25005,7 @@ var ts; visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); case 171: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || @@ -25024,7 +25027,7 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.body); case 256: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || @@ -25048,7 +25051,7 @@ var ts; visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); case 170: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.body); case 178: @@ -25176,7 +25179,7 @@ var ts; return visitNodes(cbNode, cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); case 237: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); case 255: @@ -25247,20 +25250,20 @@ var ts; visitNodes(cbNode, cbNodes, node.heritageClauses) || visitNodes(cbNode, cbNodes, node.members); case 258: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.heritageClauses) || visitNodes(cbNode, cbNodes, node.members); case 259: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNode(cbNode, node.type); case 260: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.members); @@ -25268,17 +25271,17 @@ var ts; return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 261: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); case 265: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); case 266: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier) || @@ -25292,7 +25295,7 @@ var ts; return visitNode(cbNode, node.name) || visitNode(cbNode, node.value); case 264: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNode(cbNode, node.name); case 268: return visitNode(cbNode, node.name); @@ -25302,7 +25305,7 @@ var ts; case 273: return visitNodes(cbNode, cbNodes, node.elements); case 272: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier) || @@ -25312,7 +25315,7 @@ var ts; return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); case 271: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.expression); case 223: @@ -25337,7 +25340,7 @@ var ts; case 277: return visitNode(cbNode, node.expression); case 276: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers); case 351: return visitNodes(cbNode, cbNodes, node.elements); @@ -27361,7 +27364,7 @@ var ts; var type = parseTypeAnnotation(); parseTypeMemberSemicolon(); var node = factory.createIndexSignature(modifiers, parameters, type); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parsePropertyOrMethodSignature(pos, hasJSDoc, modifiers) { @@ -29046,7 +29049,7 @@ var ts; var initializer = allowInAnd(function () { return parseAssignmentExpressionOrHigher(true); }); node = factory.createPropertyAssignment(name, initializer); } - node.decorators = decorators; + node.illegalDecorators = decorators; node.modifiers = modifiers; node.questionToken = questionToken; node.exclamationToken = exclamationToken; @@ -29629,7 +29632,7 @@ var ts; if (decorators || modifiers) { var missing = createMissingNode(276, true, ts.Diagnostics.Declaration_expected); ts.setTextRangePos(missing, pos); - missing.decorators = decorators; + missing.illegalDecorators = decorators; missing.modifiers = modifiers; return missing; } @@ -29761,7 +29764,7 @@ var ts; var declarationList = parseVariableDeclarationList(false); parseSemicolon(); var node = factory.createVariableStatement(modifiers, declarationList); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseFunctionDeclaration(pos, hasJSDoc, decorators, modifiers) { @@ -29780,7 +29783,7 @@ var ts; var body = parseFunctionBlockOrSemicolon(isGenerator | isAsync, ts.Diagnostics.or_expected); setAwaitContext(savedAwaitContext); var node = factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseConstructorName() { @@ -29802,7 +29805,7 @@ var ts; var type = parseReturnType(58, false); var body = parseFunctionBlockOrSemicolon(0, ts.Diagnostics.or_expected); var node = factory.createConstructorDeclaration(modifiers, parameters, body); - node.decorators = decorators; + node.illegalDecorators = decorators; node.typeParameters = typeParameters; node.type = type; return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -29895,7 +29898,7 @@ var ts; parseExpectedToken(124); var body = parseClassStaticBlockBody(); var node = withJSDoc(finishNode(factory.createClassStaticBlockDeclaration(body), pos), hasJSDoc); - node.decorators = decorators; + node.illegalDecorators = decorators; node.modifiers = modifiers; return node; } @@ -30111,7 +30114,7 @@ var ts; var heritageClauses = parseHeritageClauses(); var members = parseObjectTypeMembers(); var node = factory.createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers) { @@ -30122,7 +30125,7 @@ var ts; var type = token() === 138 && tryParse(parseKeywordAndNoDot) || parseType(); parseSemicolon(); var node = factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseEnumMember() { @@ -30144,7 +30147,7 @@ var ts; members = createMissingList(); } var node = factory.createEnumDeclaration(modifiers, name, members); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseModuleBlock() { @@ -30166,7 +30169,7 @@ var ts; ? parseModuleOrNamespaceDeclaration(getNodePos(), false, undefined, undefined, 4 | namespaceFlag) : parseModuleBlock(); var node = factory.createModuleDeclaration(modifiers, name, body, flags); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { @@ -30188,7 +30191,7 @@ var ts; parseSemicolon(); } var node = factory.createModuleDeclaration(modifiers, name, body, flags); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { @@ -30226,7 +30229,7 @@ var ts; var name = parseIdentifier(); parseSemicolon(); var node = factory.createNamespaceExportDeclaration(name); - node.decorators = decorators; + node.illegalDecorators = decorators; node.modifiers = modifiers; return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -30261,7 +30264,7 @@ var ts; } parseSemicolon(); var node = factory.createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseAssertEntry() { @@ -30304,7 +30307,7 @@ var ts; var moduleReference = parseModuleReference(); parseSemicolon(); var node = factory.createImportEqualsDeclaration(modifiers, isTypeOnly, identifier, moduleReference); - node.decorators = decorators; + node.illegalDecorators = decorators; var finished = withJSDoc(finishNode(node, pos), hasJSDoc); return finished; } @@ -30451,7 +30454,7 @@ var ts; parseSemicolon(); setAwaitContext(savedAwaitContext); var node = factory.createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseExportAssignment(pos, hasJSDoc, decorators, modifiers) { @@ -30468,7 +30471,7 @@ var ts; parseSemicolon(); setAwaitContext(savedAwaitContext); var node = factory.createExportAssignment(modifiers, isExportEquals, expression); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } var JSDocParser; @@ -35187,10 +35190,11 @@ var ts; if (resolved) { var fileName = resolved.fileName, packageId = resolved.packageId; var resolvedFileName = options.preserveSymlinks ? fileName : realPath(fileName, host, traceEnabled); + var pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host); resolvedTypeReferenceDirective = { primary: primary, - resolvedFileName: resolvedFileName, - originalPath: arePathsEqual(fileName, resolvedFileName, host) ? undefined : fileName, + resolvedFileName: pathsAreEqual ? fileName : resolvedFileName, + originalPath: pathsAreEqual ? undefined : fileName, packageId: packageId, isExternalLibraryImport: pathContainsNodeModules(fileName), }; @@ -35846,8 +35850,9 @@ var ts; var resolvedValue = resolved_1.value; if (!compilerOptions.preserveSymlinks && resolvedValue && !resolvedValue.originalPath) { var path = realPath(resolvedValue.path, host, traceEnabled); - var originalPath = arePathsEqual(path, resolvedValue.path, host) ? undefined : resolvedValue.path; - resolvedValue = __assign(__assign({}, resolvedValue), { path: path, originalPath: originalPath }); + var pathsAreEqual = arePathsEqual(path, resolvedValue.path, host); + var originalPath = pathsAreEqual ? undefined : resolvedValue.path; + resolvedValue = __assign(__assign({}, resolvedValue), { path: pathsAreEqual ? resolvedValue.path : path, originalPath: originalPath }); } return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } }; } @@ -61464,25 +61469,7 @@ var ts; } function getTypeOfPropertyOfContextualType(type, name, nameType) { return mapType(type, function (t) { - if (t.flags & 2097152) { - var intersection = t; - var newTypes = ts.mapDefined(intersection.types, getTypeOfConcretePropertyOfContextualType); - if (newTypes.length > 0) { - return getIntersectionType(newTypes); - } - newTypes = ts.mapDefined(intersection.types, getTypeOfApplicableIndexInfoOfContextualType); - if (newTypes.length > 0) { - return getIntersectionType(newTypes); - } - return undefined; - } - var concretePropertyType = getTypeOfConcretePropertyOfContextualType(t); - if (concretePropertyType) { - return concretePropertyType; - } - return getTypeOfApplicableIndexInfoOfContextualType(t); - }, true); - function getTypeOfConcretePropertyOfContextualType(t) { + var _a; if (isGenericMappedType(t) && !t.declaration.nameType) { var constraint = getConstraintTypeFromMappedType(t); var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint; @@ -61490,9 +61477,8 @@ var ts; if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) { return substituteIndexedMappedType(t, propertyNameType); } - return undefined; } - if (t.flags & 3670016) { + else if (t.flags & 3670016) { var prop = getPropertyOfType(t, name); if (prop) { return isCircularMappedProperty(prop) ? undefined : getTypeOfSymbol(prop); @@ -61503,16 +61489,10 @@ var ts; return restType; } } + return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type; } return undefined; - } - function getTypeOfApplicableIndexInfoOfContextualType(t) { - var _a; - if (!(t.flags & 3670016)) { - return undefined; - } - return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type; - } + }, true); } function getContextualTypeForObjectLiteralMethod(node, contextFlags) { ts.Debug.assert(ts.isObjectLiteralMethod(node)); @@ -74568,7 +74548,7 @@ var ts; return checkGrammarDecorators(node) || checkGrammarModifiers(node); } function checkGrammarDecorators(node) { - if (ts.canHaveIllegalDecorators(node) && ts.some(node.decorators)) { + if (ts.canHaveIllegalDecorators(node) && ts.some(node.illegalDecorators)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } if (!ts.canHaveDecorators(node) || !ts.hasDecorators(node)) { diff --git a/lib/tsserver.js b/lib/tsserver.js index 21accd494a376..6df43fc822e72 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -2489,6 +2489,7 @@ var ts; var currentAssertionLevel = 0 /* AssertionLevel.None */; Debug.currentLogLevel = LogLevel.Warning; Debug.isDebugging = false; + Debug.enableDeprecationWarnings = true; function getTypeScriptVersion() { return typeScriptVersion !== null && typeScriptVersion !== void 0 ? typeScriptVersion : (typeScriptVersion = new ts.Version(ts.version)); } @@ -3112,7 +3113,7 @@ var ts; function createWarningDeprecation(name, errorAfter, since, message) { var hasWrittenDeprecation = false; return function () { - if (!hasWrittenDeprecation) { + if (Debug.enableDeprecationWarnings && !hasWrittenDeprecation) { log.warn(formatDeprecationMessage(name, /*error*/ false, errorAfter, since, message)); hasWrittenDeprecation = true; } @@ -7000,7 +7001,6 @@ var ts; // not actually work. var byteOrderMarkIndicator = "\uFEFF"; function getNodeSystem() { - var _a; var nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[a-zA-Z0-9_\s]+(\.js)?$)/; var _fs = require("fs"); var _path = require("path"); @@ -7010,7 +7010,7 @@ var ts; try { _crypto = require("crypto"); } - catch (_b) { + catch (_a) { _crypto = undefined; } var activeSession; @@ -7021,10 +7021,10 @@ var ts; var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin"; var platform = _os.platform(); var useCaseSensitiveFileNames = isFileSystemCaseSensitive(); - var realpathSync = (_a = _fs.realpathSync.native) !== null && _a !== void 0 ? _a : _fs.realpathSync; + var fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync; var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin"); var getCurrentDirectory = ts.memoize(function () { return process.cwd(); }); - var _c = createSystemWatchFunctions({ + var _b = createSystemWatchFunctions({ pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames), getModifiedTime: getModifiedTime, setTimeout: setTimeout, @@ -7044,7 +7044,7 @@ var ts; defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); }, inodeWatching: isLinuxOrMacOs, sysLog: sysLog, - }), watchFile = _c.watchFile, watchDirectory = _c.watchDirectory; + }), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory; var nodeSystem = { args: process.argv.slice(2), newLine: _os.EOL, @@ -7437,9 +7437,12 @@ var ts; function getDirectories(path) { return getAccessibleFileSystemEntries(path).directories.slice(); } + function fsRealPathHandlingLongPath(path) { + return path.length < 260 ? _fs.realpathSync.native(path) : _fs.realpathSync(path); + } function realpath(path) { try { - return realpathSync(path); + return fsRealpath(path); } catch (_a) { return path; @@ -21367,7 +21370,7 @@ var ts; case 165 /* SyntaxKind.Decorator */: { var parent_2 = node.parent; return ts.canHaveDecorators(parent_2) ? parent_2.modifiers : - ts.canHaveIllegalDecorators(parent_2) ? parent_2.decorators : + ts.canHaveIllegalDecorators(parent_2) ? parent_2.illegalDecorators : undefined; } case 291 /* SyntaxKind.HeritageClause */: @@ -23444,7 +23447,7 @@ var ts; node.body = body; node.transformFlags = propagateChildFlags(body) | 16777216 /* TransformFlags.ContainsClassFields */; // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; node.modifiers = undefined; return node; } @@ -23456,7 +23459,7 @@ var ts; } function finishUpdateClassStaticBlockDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.modifiers = original.modifiers; } return update(updated, original); @@ -23469,7 +23472,7 @@ var ts; /*type*/ undefined, body); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; node.typeParameters = undefined; node.type = undefined; return node; @@ -23484,7 +23487,7 @@ var ts; } function finishUpdateConstructorDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.typeParameters = original.typeParameters; updated.type = original.type; } @@ -25232,7 +25235,7 @@ var ts; } } // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25250,7 +25253,7 @@ var ts; function finishUpdateFunctionDeclaration(updated, original) { if (updated !== original) { // copy children used only for error reporting - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return finishUpdateBaseSignatureDeclaration(updated, original); } @@ -25284,7 +25287,7 @@ var ts; node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25299,7 +25302,7 @@ var ts; } function finishUpdateInterfaceDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25309,7 +25312,7 @@ var ts; node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25323,7 +25326,7 @@ var ts; } function finishUpdateTypeAliasDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25336,7 +25339,7 @@ var ts; 1 /* TransformFlags.ContainsTypeScript */; node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // Enum declarations cannot contain `await` // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25349,7 +25352,7 @@ var ts; } function finishUpdateEnumDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25373,7 +25376,7 @@ var ts; } node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // Module declarations cannot contain `await`. // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25386,7 +25389,7 @@ var ts; } function finishUpdateModuleDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25422,7 +25425,7 @@ var ts; /*modifiers*/ undefined, name); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; node.modifiers = undefined; return node; } @@ -25434,7 +25437,7 @@ var ts; } function finishUpdateNamespaceExportDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.modifiers = original.modifiers; } return update(updated, original); @@ -25449,7 +25452,7 @@ var ts; node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // Import= declaration is always parsed in an Await context // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25463,7 +25466,7 @@ var ts; } function finishUpdateImportEqualsDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25479,7 +25482,7 @@ var ts; propagateChildFlags(node.moduleSpecifier); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25493,7 +25496,7 @@ var ts; } function finishUpdateImportDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25639,7 +25642,7 @@ var ts; node.transformFlags |= propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.expression); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25651,7 +25654,7 @@ var ts; } function finishUpdateExportAssignment(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25669,7 +25672,7 @@ var ts; propagateChildFlags(node.moduleSpecifier); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25684,7 +25687,7 @@ var ts; } function finishUpdateExportDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -26448,7 +26451,7 @@ var ts; propagateChildFlags(node.name) | propagateChildFlags(node.initializer); // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; node.modifiers = undefined; node.questionToken = undefined; node.exclamationToken = undefined; @@ -26464,7 +26467,7 @@ var ts; function finishUpdatePropertyAssignment(updated, original) { // copy children used only for error reporting if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.modifiers = original.modifiers; updated.questionToken = original.questionToken; updated.exclamationToken = original.exclamationToken; @@ -26481,7 +26484,7 @@ var ts; 1024 /* TransformFlags.ContainsES2015 */; // The following properties are used only to report grammar errors node.equalsToken = undefined; - node.decorators = undefined; + node.illegalDecorators = undefined; node.modifiers = undefined; node.questionToken = undefined; node.exclamationToken = undefined; @@ -26498,7 +26501,7 @@ var ts; if (updated !== original) { // copy children used only for error reporting updated.equalsToken = original.equalsToken; - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.modifiers = original.modifiers; updated.questionToken = original.questionToken; updated.exclamationToken = original.exclamationToken; @@ -30976,7 +30979,7 @@ var ts; visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || @@ -31006,7 +31009,7 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); case 296 /* SyntaxKind.PropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || @@ -31023,7 +31026,7 @@ var ts; visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 176 /* SyntaxKind.IndexSignature */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || @@ -31061,7 +31064,7 @@ var ts; visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); case 171 /* SyntaxKind.Constructor */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || @@ -31083,7 +31086,7 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.body); case 256 /* SyntaxKind.FunctionDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || @@ -31107,7 +31110,7 @@ var ts; visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.body); case 178 /* SyntaxKind.TypeReference */: @@ -31235,7 +31238,7 @@ var ts; return visitNodes(cbNode, cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); case 237 /* SyntaxKind.VariableStatement */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); case 255 /* SyntaxKind.VariableDeclarationList */: @@ -31306,20 +31309,20 @@ var ts; visitNodes(cbNode, cbNodes, node.heritageClauses) || visitNodes(cbNode, cbNodes, node.members); case 258 /* SyntaxKind.InterfaceDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.heritageClauses) || visitNodes(cbNode, cbNodes, node.members); case 259 /* SyntaxKind.TypeAliasDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNode(cbNode, node.type); case 260 /* SyntaxKind.EnumDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.members); @@ -31327,17 +31330,17 @@ var ts; return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 261 /* SyntaxKind.ModuleDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); case 266 /* SyntaxKind.ImportDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier) || @@ -31351,7 +31354,7 @@ var ts; return visitNode(cbNode, node.name) || visitNode(cbNode, node.value); case 264 /* SyntaxKind.NamespaceExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNode(cbNode, node.name); case 268 /* SyntaxKind.NamespaceImport */: return visitNode(cbNode, node.name); @@ -31361,7 +31364,7 @@ var ts; case 273 /* SyntaxKind.NamedExports */: return visitNodes(cbNode, cbNodes, node.elements); case 272 /* SyntaxKind.ExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier) || @@ -31371,7 +31374,7 @@ var ts; return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); case 271 /* SyntaxKind.ExportAssignment */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.expression); case 223 /* SyntaxKind.TemplateExpression */: @@ -31396,7 +31399,7 @@ var ts; case 277 /* SyntaxKind.ExternalModuleReference */: return visitNode(cbNode, node.expression); case 276 /* SyntaxKind.MissingDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers); case 351 /* SyntaxKind.CommaListExpression */: return visitNodes(cbNode, cbNodes, node.elements); @@ -33947,7 +33950,7 @@ var ts; var type = parseTypeAnnotation(); parseTypeMemberSemicolon(); var node = factory.createIndexSignature(modifiers, parameters, type); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parsePropertyOrMethodSignature(pos, hasJSDoc, modifiers) { @@ -36107,7 +36110,7 @@ var ts; node = factory.createPropertyAssignment(name, initializer); } // Decorators, Modifiers, questionToken, and exclamationToken are not supported by property assignments and are reported in the grammar checker - node.decorators = decorators; + node.illegalDecorators = decorators; node.modifiers = modifiers; node.questionToken = questionToken; node.exclamationToken = exclamationToken; @@ -36755,7 +36758,7 @@ var ts; // would follow. For recovery and error reporting purposes, return an incomplete declaration. var missing = createMissingNode(276 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); ts.setTextRangePos(missing, pos); - missing.decorators = decorators; + missing.illegalDecorators = decorators; missing.modifiers = modifiers; return missing; } @@ -36898,7 +36901,7 @@ var ts; parseSemicolon(); var node = factory.createVariableStatement(modifiers, declarationList); // Decorators are not allowed on a variable statement, so we keep track of them to report them in the grammar checker. - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseFunctionDeclaration(pos, hasJSDoc, decorators, modifiers) { @@ -36918,7 +36921,7 @@ var ts; var body = parseFunctionBlockOrSemicolon(isGenerator | isAsync, ts.Diagnostics.or_expected); setAwaitContext(savedAwaitContext); var node = factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseConstructorName() { @@ -36941,7 +36944,7 @@ var ts; var body = parseFunctionBlockOrSemicolon(0 /* SignatureFlags.None */, ts.Diagnostics.or_expected); var node = factory.createConstructorDeclaration(modifiers, parameters, body); // Attach invalid nodes if they exist so that we can report them in the grammar checker. - node.decorators = decorators; + node.illegalDecorators = decorators; node.typeParameters = typeParameters; node.type = type; return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -37057,7 +37060,7 @@ var ts; parseExpectedToken(124 /* SyntaxKind.StaticKeyword */); var body = parseClassStaticBlockBody(); var node = withJSDoc(finishNode(factory.createClassStaticBlockDeclaration(body), pos), hasJSDoc); - node.decorators = decorators; + node.illegalDecorators = decorators; node.modifiers = modifiers; return node; } @@ -37298,7 +37301,7 @@ var ts; var heritageClauses = parseHeritageClauses(); var members = parseObjectTypeMembers(); var node = factory.createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers) { @@ -37309,7 +37312,7 @@ var ts; var type = token() === 138 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); parseSemicolon(); var node = factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } // In an ambient declaration, the grammar only allows integer literals as initializers. @@ -37335,7 +37338,7 @@ var ts; members = createMissingList(); } var node = factory.createEnumDeclaration(modifiers, name, members); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseModuleBlock() { @@ -37359,7 +37362,7 @@ var ts; ? parseModuleOrNamespaceDeclaration(getNodePos(), /*hasJSDoc*/ false, /*decorators*/ undefined, /*modifiers*/ undefined, 4 /* NodeFlags.NestedNamespace */ | namespaceFlag) : parseModuleBlock(); var node = factory.createModuleDeclaration(modifiers, name, body, flags); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { @@ -37382,7 +37385,7 @@ var ts; parseSemicolon(); } var node = factory.createModuleDeclaration(modifiers, name, body, flags); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { @@ -37422,7 +37425,7 @@ var ts; parseSemicolon(); var node = factory.createNamespaceExportDeclaration(name); // NamespaceExportDeclaration nodes cannot have decorators or modifiers, so we attach them here so we can report them in the grammar checker - node.decorators = decorators; + node.illegalDecorators = decorators; node.modifiers = modifiers; return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -37462,7 +37465,7 @@ var ts; } parseSemicolon(); var node = factory.createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseAssertEntry() { @@ -37507,7 +37510,7 @@ var ts; var moduleReference = parseModuleReference(); parseSemicolon(); var node = factory.createImportEqualsDeclaration(modifiers, isTypeOnly, identifier, moduleReference); - node.decorators = decorators; + node.illegalDecorators = decorators; var finished = withJSDoc(finishNode(node, pos), hasJSDoc); return finished; } @@ -37697,7 +37700,7 @@ var ts; parseSemicolon(); setAwaitContext(savedAwaitContext); var node = factory.createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseExportAssignment(pos, hasJSDoc, decorators, modifiers) { @@ -37714,7 +37717,7 @@ var ts; parseSemicolon(); setAwaitContext(savedAwaitContext); var node = factory.createExportAssignment(modifiers, isExportEquals, expression); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } var ParsingContext; @@ -43078,10 +43081,12 @@ var ts; if (resolved) { var fileName = resolved.fileName, packageId = resolved.packageId; var resolvedFileName = options.preserveSymlinks ? fileName : realPath(fileName, host, traceEnabled); + var pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host); resolvedTypeReferenceDirective = { primary: primary, - resolvedFileName: resolvedFileName, - originalPath: arePathsEqual(fileName, resolvedFileName, host) ? undefined : fileName, + // If the fileName and realpath are differing only in casing prefer fileName so that we can issue correct errors for casing under forceConsistentCasingInFileNames + resolvedFileName: pathsAreEqual ? fileName : resolvedFileName, + originalPath: pathsAreEqual ? undefined : fileName, packageId: packageId, isExternalLibraryImport: pathContainsNodeModules(fileName), }; @@ -43866,8 +43871,10 @@ var ts; var resolvedValue = resolved_1.value; if (!compilerOptions.preserveSymlinks && resolvedValue && !resolvedValue.originalPath) { var path = realPath(resolvedValue.path, host, traceEnabled); - var originalPath = arePathsEqual(path, resolvedValue.path, host) ? undefined : resolvedValue.path; - resolvedValue = __assign(__assign({}, resolvedValue), { path: path, originalPath: originalPath }); + var pathsAreEqual = arePathsEqual(path, resolvedValue.path, host); + var originalPath = pathsAreEqual ? undefined : resolvedValue.path; + // If the path and realpath are differing only in casing prefer path so that we can issue correct errors for casing under forceConsistentCasingInFileNames + resolvedValue = __assign(__assign({}, resolvedValue), { path: pathsAreEqual ? resolvedValue.path : path, originalPath: originalPath }); } // For node_modules lookups, get the real path so that multiple accesses to an `npm link`-ed module do not create duplicate files. return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } }; @@ -73520,25 +73527,7 @@ var ts; } function getTypeOfPropertyOfContextualType(type, name, nameType) { return mapType(type, function (t) { - if (t.flags & 2097152 /* TypeFlags.Intersection */) { - var intersection = t; - var newTypes = ts.mapDefined(intersection.types, getTypeOfConcretePropertyOfContextualType); - if (newTypes.length > 0) { - return getIntersectionType(newTypes); - } - newTypes = ts.mapDefined(intersection.types, getTypeOfApplicableIndexInfoOfContextualType); - if (newTypes.length > 0) { - return getIntersectionType(newTypes); - } - return undefined; - } - var concretePropertyType = getTypeOfConcretePropertyOfContextualType(t); - if (concretePropertyType) { - return concretePropertyType; - } - return getTypeOfApplicableIndexInfoOfContextualType(t); - }, /*noReductions*/ true); - function getTypeOfConcretePropertyOfContextualType(t) { + var _a; if (isGenericMappedType(t) && !t.declaration.nameType) { var constraint = getConstraintTypeFromMappedType(t); var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint; @@ -73546,9 +73535,8 @@ var ts; if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) { return substituteIndexedMappedType(t, propertyNameType); } - return undefined; } - if (t.flags & 3670016 /* TypeFlags.StructuredType */) { + else if (t.flags & 3670016 /* TypeFlags.StructuredType */) { var prop = getPropertyOfType(t, name); if (prop) { return isCircularMappedProperty(prop) ? undefined : getTypeOfSymbol(prop); @@ -73559,16 +73547,10 @@ var ts; return restType; } } + return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type; } return undefined; - } - function getTypeOfApplicableIndexInfoOfContextualType(t) { - var _a; - if (!(t.flags & 3670016 /* TypeFlags.StructuredType */)) { - return undefined; - } - return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type; - } + }, /*noReductions*/ true); } // In an object literal contextually typed by a type T, the contextual type of a property assignment is the type of // the matching property in T, if one exists. Otherwise, it is the type of the numeric index signature in T, if one @@ -88698,7 +88680,7 @@ var ts; return checkGrammarDecorators(node) || checkGrammarModifiers(node); } function checkGrammarDecorators(node) { - if (ts.canHaveIllegalDecorators(node) && ts.some(node.decorators)) { + if (ts.canHaveIllegalDecorators(node) && ts.some(node.illegalDecorators)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } if (!ts.canHaveDecorators(node) || !ts.hasDecorators(node)) { @@ -182513,9 +182495,9 @@ var ts; // - error: 5.0 var ts; (function (ts) { - var MUST_MERGE = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators have been combined with modifiers. Callers should switch to an overload without a 'decorators' parameter." }; - var DISALLOW_DECORATORS = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators are no longer supported for this function. Callers should switch to an overload without a 'decorators' parameter." }; - var DISALLOW_DECORATORS_AND_MODIFIERS = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators and modifiers are no longer supported for this function. Callers should switch to an overload without the 'decorators' or 'modifiers' parameters." }; + var MUST_MERGE = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators have been combined with modifiers. Callers should switch to an overload that does not accept a 'decorators' parameter." }; + var DISALLOW_DECORATORS = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators are no longer supported for this function. Callers should switch to an overload that does not accept a 'decorators' parameter." }; + var DISALLOW_DECORATORS_AND_MODIFIERS = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators and modifiers are no longer supported for this function. Callers should switch to an overload that does not accept the 'decorators' and 'modifiers' parameters." }; function patchNodeFactory(factory) { var createParameterDeclaration = factory.createParameterDeclaration, updateParameterDeclaration = factory.updateParameterDeclaration, createPropertyDeclaration = factory.createPropertyDeclaration, updatePropertyDeclaration = factory.updatePropertyDeclaration, createMethodDeclaration = factory.createMethodDeclaration, updateMethodDeclaration = factory.updateMethodDeclaration, createConstructorDeclaration = factory.createConstructorDeclaration, updateConstructorDeclaration = factory.updateConstructorDeclaration, createGetAccessorDeclaration = factory.createGetAccessorDeclaration, updateGetAccessorDeclaration = factory.updateGetAccessorDeclaration, createSetAccessorDeclaration = factory.createSetAccessorDeclaration, updateSetAccessorDeclaration = factory.updateSetAccessorDeclaration, createIndexSignature = factory.createIndexSignature, updateIndexSignature = factory.updateIndexSignature, createClassStaticBlockDeclaration = factory.createClassStaticBlockDeclaration, updateClassStaticBlockDeclaration = factory.updateClassStaticBlockDeclaration, createClassExpression = factory.createClassExpression, updateClassExpression = factory.updateClassExpression, createFunctionDeclaration = factory.createFunctionDeclaration, updateFunctionDeclaration = factory.updateFunctionDeclaration, createClassDeclaration = factory.createClassDeclaration, updateClassDeclaration = factory.updateClassDeclaration, createInterfaceDeclaration = factory.createInterfaceDeclaration, updateInterfaceDeclaration = factory.updateInterfaceDeclaration, createTypeAliasDeclaration = factory.createTypeAliasDeclaration, updateTypeAliasDeclaration = factory.updateTypeAliasDeclaration, createEnumDeclaration = factory.createEnumDeclaration, updateEnumDeclaration = factory.updateEnumDeclaration, createModuleDeclaration = factory.createModuleDeclaration, updateModuleDeclaration = factory.updateModuleDeclaration, createImportEqualsDeclaration = factory.createImportEqualsDeclaration, updateImportEqualsDeclaration = factory.updateImportEqualsDeclaration, createImportDeclaration = factory.createImportDeclaration, updateImportDeclaration = factory.updateImportDeclaration, createExportAssignment = factory.createExportAssignment, updateExportAssignment = factory.updateExportAssignment, createExportDeclaration = factory.createExportDeclaration, updateExportDeclaration = factory.updateExportDeclaration; factory.createParameterDeclaration = ts.buildOverload("createParameterDeclaration") @@ -182742,7 +182724,7 @@ var ts; return (decorators === undefined || !ts.some(decorators, ts.isModifier)) && (modifiers === undefined || !ts.some(modifiers, ts.isParameter)) && (parameters === undefined || ts.isArray(parameters)) && - (body === undefined || !ts.isBlock(body)); + (body === undefined || ts.isBlock(body)); }, }) .deprecate({ @@ -182771,7 +182753,7 @@ var ts; return (decorators === undefined || !ts.some(decorators, ts.isModifier)) && (modifiers === undefined || !ts.some(modifiers, ts.isParameter)) && (parameters === undefined || ts.isArray(parameters)) && - (body === undefined || !ts.isBlock(body)); + (body === undefined || ts.isBlock(body)); }, }) .deprecate({ diff --git a/lib/tsserverlibrary.d.ts b/lib/tsserverlibrary.d.ts index 103b3664e8b14..8575d0c7122a9 100644 --- a/lib/tsserverlibrary.d.ts +++ b/lib/tsserverlibrary.d.ts @@ -11780,9 +11780,27 @@ declare namespace ts { } declare namespace ts { interface Node { - /** @deprecated `decorators` has been merged with `modifiers` on the declarations that support decorators. */ - readonly decorators?: NodeArray | undefined; - /** @deprecated `modifiers` has been removed from `Node` and moved to the specific `Node` subtypes that support them. */ + /** + * @deprecated `decorators` has been removed from `Node` and merged with `modifiers` on the `Node` subtypes that support them. + * Use `ts.canHaveDecorators()` to test whether a `Node` can have decorators. + * Use `ts.getDecorators()` to get the decorators of a `Node`. + * + * For example: + * ```ts + * const decorators = ts.canHaveDecorators(node) ? ts.getDecorators(node) : undefined; + * ``` + */ + readonly decorators?: undefined; + /** + * @deprecated `modifiers` has been removed from `Node` and moved to the `Node` subtypes that support them. + * Use `ts.canHaveModifiers()` to test whether a `Node` can have modifiers. + * Use `ts.getModifiers()` to get the modifiers of a `Node`. + * + * For example: + * ```ts + * const modifiers = ts.canHaveModifiers(node) ? ts.getModifiers(node) : undefined; + * ``` + */ readonly modifiers?: NodeArray | undefined; } interface PropertySignature { @@ -11809,231 +11827,155 @@ declare namespace ts { } interface NodeFactory { /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ createParameterDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, dotDotDotToken: DotDotDotToken | undefined, name: string | BindingName, questionToken?: QuestionToken, type?: TypeNode, initializer?: Expression): ParameterDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ updateParameterDeclaration(node: ParameterDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, dotDotDotToken: DotDotDotToken | undefined, name: string | BindingName, questionToken: QuestionToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): ParameterDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ createPropertyDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | PropertyName, questionOrExclamationToken: QuestionToken | ExclamationToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): PropertyDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ updatePropertyDeclaration(node: PropertyDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | PropertyName, questionOrExclamationToken: QuestionToken | ExclamationToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): PropertyDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ createMethodDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): MethodDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ updateMethodDeclaration(node: MethodDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: PropertyName, questionToken: QuestionToken | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): MethodDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated This node does not support Decorators. Callers should use an overload that does not accept a `decorators` parameter. */ createConstructorDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated This node does not support Decorators. Callers should use an overload that does not accept a `decorators` parameter. */ updateConstructorDeclaration(node: ConstructorDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ createGetAccessorDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | PropertyName, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ updateGetAccessorDeclaration(node: GetAccessorDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: PropertyName, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ createSetAccessorDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | PropertyName, parameters: readonly ParameterDeclaration[], body: Block | undefined): SetAccessorDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ updateSetAccessorDeclaration(node: SetAccessorDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: PropertyName, parameters: readonly ParameterDeclaration[], body: Block | undefined): SetAccessorDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createIndexSignature(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators and modifiers are no longer supported for this function. Callers should use an overload that does not accept the `decorators` and `modifiers` parameters. */ updateIndexSignature(node: IndexSignatureDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators and modifiers are no longer supported for this function. Callers should use an overload that does not accept the `decorators` and `modifiers` parameters. */ createClassStaticBlockDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, body: Block): ClassStaticBlockDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateClassStaticBlockDeclaration(node: ClassStaticBlockDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, body: Block): ClassStaticBlockDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ createClassExpression(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): ClassExpression; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ updateClassExpression(node: ClassExpression, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): ClassExpression; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createFunctionDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): FunctionDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateFunctionDeclaration(node: FunctionDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): FunctionDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ createClassDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): ClassDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ updateClassDeclaration(node: ClassDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): ClassDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createInterfaceDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]): InterfaceDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateInterfaceDeclaration(node: InterfaceDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]): InterfaceDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createTypeAliasDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode): TypeAliasDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateTypeAliasDeclaration(node: TypeAliasDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode): TypeAliasDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createEnumDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | Identifier, members: readonly EnumMember[]): EnumDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateEnumDeclaration(node: EnumDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: Identifier, members: readonly EnumMember[]): EnumDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createModuleDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined, flags?: NodeFlags): ModuleDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateModuleDeclaration(node: ModuleDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined): ModuleDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createImportEqualsDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateImportEqualsDeclaration(node: ImportEqualsDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createImportDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause?: AssertClause): ImportDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateImportDeclaration(node: ImportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined): ImportDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createExportAssignment(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isExportEquals: boolean | undefined, expression: Expression): ExportAssignment; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateExportAssignment(node: ExportAssignment, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, expression: Expression): ExportAssignment; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createExportDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, assertClause?: AssertClause): ExportDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateExportDeclaration(node: ExportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, assertClause: AssertClause | undefined): ExportDeclaration; } diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index 83540854d4366..b8a65d5ea9972 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -2683,6 +2683,7 @@ var ts; var currentAssertionLevel = 0 /* AssertionLevel.None */; Debug.currentLogLevel = LogLevel.Warning; Debug.isDebugging = false; + Debug.enableDeprecationWarnings = true; function getTypeScriptVersion() { return typeScriptVersion !== null && typeScriptVersion !== void 0 ? typeScriptVersion : (typeScriptVersion = new ts.Version(ts.version)); } @@ -3306,7 +3307,7 @@ var ts; function createWarningDeprecation(name, errorAfter, since, message) { var hasWrittenDeprecation = false; return function () { - if (!hasWrittenDeprecation) { + if (Debug.enableDeprecationWarnings && !hasWrittenDeprecation) { log.warn(formatDeprecationMessage(name, /*error*/ false, errorAfter, since, message)); hasWrittenDeprecation = true; } @@ -7194,7 +7195,6 @@ var ts; // not actually work. var byteOrderMarkIndicator = "\uFEFF"; function getNodeSystem() { - var _a; var nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[a-zA-Z0-9_\s]+(\.js)?$)/; var _fs = require("fs"); var _path = require("path"); @@ -7204,7 +7204,7 @@ var ts; try { _crypto = require("crypto"); } - catch (_b) { + catch (_a) { _crypto = undefined; } var activeSession; @@ -7215,10 +7215,10 @@ var ts; var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin"; var platform = _os.platform(); var useCaseSensitiveFileNames = isFileSystemCaseSensitive(); - var realpathSync = (_a = _fs.realpathSync.native) !== null && _a !== void 0 ? _a : _fs.realpathSync; + var fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync; var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin"); var getCurrentDirectory = ts.memoize(function () { return process.cwd(); }); - var _c = createSystemWatchFunctions({ + var _b = createSystemWatchFunctions({ pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames), getModifiedTime: getModifiedTime, setTimeout: setTimeout, @@ -7238,7 +7238,7 @@ var ts; defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); }, inodeWatching: isLinuxOrMacOs, sysLog: sysLog, - }), watchFile = _c.watchFile, watchDirectory = _c.watchDirectory; + }), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory; var nodeSystem = { args: process.argv.slice(2), newLine: _os.EOL, @@ -7631,9 +7631,12 @@ var ts; function getDirectories(path) { return getAccessibleFileSystemEntries(path).directories.slice(); } + function fsRealPathHandlingLongPath(path) { + return path.length < 260 ? _fs.realpathSync.native(path) : _fs.realpathSync(path); + } function realpath(path) { try { - return realpathSync(path); + return fsRealpath(path); } catch (_a) { return path; @@ -21561,7 +21564,7 @@ var ts; case 165 /* SyntaxKind.Decorator */: { var parent_2 = node.parent; return ts.canHaveDecorators(parent_2) ? parent_2.modifiers : - ts.canHaveIllegalDecorators(parent_2) ? parent_2.decorators : + ts.canHaveIllegalDecorators(parent_2) ? parent_2.illegalDecorators : undefined; } case 291 /* SyntaxKind.HeritageClause */: @@ -23638,7 +23641,7 @@ var ts; node.body = body; node.transformFlags = propagateChildFlags(body) | 16777216 /* TransformFlags.ContainsClassFields */; // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; node.modifiers = undefined; return node; } @@ -23650,7 +23653,7 @@ var ts; } function finishUpdateClassStaticBlockDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.modifiers = original.modifiers; } return update(updated, original); @@ -23663,7 +23666,7 @@ var ts; /*type*/ undefined, body); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; node.typeParameters = undefined; node.type = undefined; return node; @@ -23678,7 +23681,7 @@ var ts; } function finishUpdateConstructorDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.typeParameters = original.typeParameters; updated.type = original.type; } @@ -25426,7 +25429,7 @@ var ts; } } // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25444,7 +25447,7 @@ var ts; function finishUpdateFunctionDeclaration(updated, original) { if (updated !== original) { // copy children used only for error reporting - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return finishUpdateBaseSignatureDeclaration(updated, original); } @@ -25478,7 +25481,7 @@ var ts; node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25493,7 +25496,7 @@ var ts; } function finishUpdateInterfaceDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25503,7 +25506,7 @@ var ts; node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25517,7 +25520,7 @@ var ts; } function finishUpdateTypeAliasDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25530,7 +25533,7 @@ var ts; 1 /* TransformFlags.ContainsTypeScript */; node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // Enum declarations cannot contain `await` // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25543,7 +25546,7 @@ var ts; } function finishUpdateEnumDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25567,7 +25570,7 @@ var ts; } node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // Module declarations cannot contain `await`. // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25580,7 +25583,7 @@ var ts; } function finishUpdateModuleDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25616,7 +25619,7 @@ var ts; /*modifiers*/ undefined, name); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; node.modifiers = undefined; return node; } @@ -25628,7 +25631,7 @@ var ts; } function finishUpdateNamespaceExportDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.modifiers = original.modifiers; } return update(updated, original); @@ -25643,7 +25646,7 @@ var ts; node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // Import= declaration is always parsed in an Await context // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25657,7 +25660,7 @@ var ts; } function finishUpdateImportEqualsDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25673,7 +25676,7 @@ var ts; propagateChildFlags(node.moduleSpecifier); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25687,7 +25690,7 @@ var ts; } function finishUpdateImportDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25833,7 +25836,7 @@ var ts; node.transformFlags |= propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.expression); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25845,7 +25848,7 @@ var ts; } function finishUpdateExportAssignment(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25863,7 +25866,7 @@ var ts; propagateChildFlags(node.moduleSpecifier); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25878,7 +25881,7 @@ var ts; } function finishUpdateExportDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -26642,7 +26645,7 @@ var ts; propagateChildFlags(node.name) | propagateChildFlags(node.initializer); // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; node.modifiers = undefined; node.questionToken = undefined; node.exclamationToken = undefined; @@ -26658,7 +26661,7 @@ var ts; function finishUpdatePropertyAssignment(updated, original) { // copy children used only for error reporting if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.modifiers = original.modifiers; updated.questionToken = original.questionToken; updated.exclamationToken = original.exclamationToken; @@ -26675,7 +26678,7 @@ var ts; 1024 /* TransformFlags.ContainsES2015 */; // The following properties are used only to report grammar errors node.equalsToken = undefined; - node.decorators = undefined; + node.illegalDecorators = undefined; node.modifiers = undefined; node.questionToken = undefined; node.exclamationToken = undefined; @@ -26692,7 +26695,7 @@ var ts; if (updated !== original) { // copy children used only for error reporting updated.equalsToken = original.equalsToken; - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.modifiers = original.modifiers; updated.questionToken = original.questionToken; updated.exclamationToken = original.exclamationToken; @@ -31170,7 +31173,7 @@ var ts; visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || @@ -31200,7 +31203,7 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); case 296 /* SyntaxKind.PropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || @@ -31217,7 +31220,7 @@ var ts; visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 176 /* SyntaxKind.IndexSignature */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || @@ -31255,7 +31258,7 @@ var ts; visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); case 171 /* SyntaxKind.Constructor */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || @@ -31277,7 +31280,7 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.body); case 256 /* SyntaxKind.FunctionDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || @@ -31301,7 +31304,7 @@ var ts; visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.body); case 178 /* SyntaxKind.TypeReference */: @@ -31429,7 +31432,7 @@ var ts; return visitNodes(cbNode, cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); case 237 /* SyntaxKind.VariableStatement */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); case 255 /* SyntaxKind.VariableDeclarationList */: @@ -31500,20 +31503,20 @@ var ts; visitNodes(cbNode, cbNodes, node.heritageClauses) || visitNodes(cbNode, cbNodes, node.members); case 258 /* SyntaxKind.InterfaceDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.heritageClauses) || visitNodes(cbNode, cbNodes, node.members); case 259 /* SyntaxKind.TypeAliasDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNode(cbNode, node.type); case 260 /* SyntaxKind.EnumDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.members); @@ -31521,17 +31524,17 @@ var ts; return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 261 /* SyntaxKind.ModuleDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); case 266 /* SyntaxKind.ImportDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier) || @@ -31545,7 +31548,7 @@ var ts; return visitNode(cbNode, node.name) || visitNode(cbNode, node.value); case 264 /* SyntaxKind.NamespaceExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNode(cbNode, node.name); case 268 /* SyntaxKind.NamespaceImport */: return visitNode(cbNode, node.name); @@ -31555,7 +31558,7 @@ var ts; case 273 /* SyntaxKind.NamedExports */: return visitNodes(cbNode, cbNodes, node.elements); case 272 /* SyntaxKind.ExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier) || @@ -31565,7 +31568,7 @@ var ts; return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); case 271 /* SyntaxKind.ExportAssignment */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.expression); case 223 /* SyntaxKind.TemplateExpression */: @@ -31590,7 +31593,7 @@ var ts; case 277 /* SyntaxKind.ExternalModuleReference */: return visitNode(cbNode, node.expression); case 276 /* SyntaxKind.MissingDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers); case 351 /* SyntaxKind.CommaListExpression */: return visitNodes(cbNode, cbNodes, node.elements); @@ -34141,7 +34144,7 @@ var ts; var type = parseTypeAnnotation(); parseTypeMemberSemicolon(); var node = factory.createIndexSignature(modifiers, parameters, type); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parsePropertyOrMethodSignature(pos, hasJSDoc, modifiers) { @@ -36301,7 +36304,7 @@ var ts; node = factory.createPropertyAssignment(name, initializer); } // Decorators, Modifiers, questionToken, and exclamationToken are not supported by property assignments and are reported in the grammar checker - node.decorators = decorators; + node.illegalDecorators = decorators; node.modifiers = modifiers; node.questionToken = questionToken; node.exclamationToken = exclamationToken; @@ -36949,7 +36952,7 @@ var ts; // would follow. For recovery and error reporting purposes, return an incomplete declaration. var missing = createMissingNode(276 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); ts.setTextRangePos(missing, pos); - missing.decorators = decorators; + missing.illegalDecorators = decorators; missing.modifiers = modifiers; return missing; } @@ -37092,7 +37095,7 @@ var ts; parseSemicolon(); var node = factory.createVariableStatement(modifiers, declarationList); // Decorators are not allowed on a variable statement, so we keep track of them to report them in the grammar checker. - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseFunctionDeclaration(pos, hasJSDoc, decorators, modifiers) { @@ -37112,7 +37115,7 @@ var ts; var body = parseFunctionBlockOrSemicolon(isGenerator | isAsync, ts.Diagnostics.or_expected); setAwaitContext(savedAwaitContext); var node = factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseConstructorName() { @@ -37135,7 +37138,7 @@ var ts; var body = parseFunctionBlockOrSemicolon(0 /* SignatureFlags.None */, ts.Diagnostics.or_expected); var node = factory.createConstructorDeclaration(modifiers, parameters, body); // Attach invalid nodes if they exist so that we can report them in the grammar checker. - node.decorators = decorators; + node.illegalDecorators = decorators; node.typeParameters = typeParameters; node.type = type; return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -37251,7 +37254,7 @@ var ts; parseExpectedToken(124 /* SyntaxKind.StaticKeyword */); var body = parseClassStaticBlockBody(); var node = withJSDoc(finishNode(factory.createClassStaticBlockDeclaration(body), pos), hasJSDoc); - node.decorators = decorators; + node.illegalDecorators = decorators; node.modifiers = modifiers; return node; } @@ -37492,7 +37495,7 @@ var ts; var heritageClauses = parseHeritageClauses(); var members = parseObjectTypeMembers(); var node = factory.createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers) { @@ -37503,7 +37506,7 @@ var ts; var type = token() === 138 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); parseSemicolon(); var node = factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } // In an ambient declaration, the grammar only allows integer literals as initializers. @@ -37529,7 +37532,7 @@ var ts; members = createMissingList(); } var node = factory.createEnumDeclaration(modifiers, name, members); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseModuleBlock() { @@ -37553,7 +37556,7 @@ var ts; ? parseModuleOrNamespaceDeclaration(getNodePos(), /*hasJSDoc*/ false, /*decorators*/ undefined, /*modifiers*/ undefined, 4 /* NodeFlags.NestedNamespace */ | namespaceFlag) : parseModuleBlock(); var node = factory.createModuleDeclaration(modifiers, name, body, flags); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { @@ -37576,7 +37579,7 @@ var ts; parseSemicolon(); } var node = factory.createModuleDeclaration(modifiers, name, body, flags); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { @@ -37616,7 +37619,7 @@ var ts; parseSemicolon(); var node = factory.createNamespaceExportDeclaration(name); // NamespaceExportDeclaration nodes cannot have decorators or modifiers, so we attach them here so we can report them in the grammar checker - node.decorators = decorators; + node.illegalDecorators = decorators; node.modifiers = modifiers; return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -37656,7 +37659,7 @@ var ts; } parseSemicolon(); var node = factory.createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseAssertEntry() { @@ -37701,7 +37704,7 @@ var ts; var moduleReference = parseModuleReference(); parseSemicolon(); var node = factory.createImportEqualsDeclaration(modifiers, isTypeOnly, identifier, moduleReference); - node.decorators = decorators; + node.illegalDecorators = decorators; var finished = withJSDoc(finishNode(node, pos), hasJSDoc); return finished; } @@ -37891,7 +37894,7 @@ var ts; parseSemicolon(); setAwaitContext(savedAwaitContext); var node = factory.createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseExportAssignment(pos, hasJSDoc, decorators, modifiers) { @@ -37908,7 +37911,7 @@ var ts; parseSemicolon(); setAwaitContext(savedAwaitContext); var node = factory.createExportAssignment(modifiers, isExportEquals, expression); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } var ParsingContext; @@ -43272,10 +43275,12 @@ var ts; if (resolved) { var fileName = resolved.fileName, packageId = resolved.packageId; var resolvedFileName = options.preserveSymlinks ? fileName : realPath(fileName, host, traceEnabled); + var pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host); resolvedTypeReferenceDirective = { primary: primary, - resolvedFileName: resolvedFileName, - originalPath: arePathsEqual(fileName, resolvedFileName, host) ? undefined : fileName, + // If the fileName and realpath are differing only in casing prefer fileName so that we can issue correct errors for casing under forceConsistentCasingInFileNames + resolvedFileName: pathsAreEqual ? fileName : resolvedFileName, + originalPath: pathsAreEqual ? undefined : fileName, packageId: packageId, isExternalLibraryImport: pathContainsNodeModules(fileName), }; @@ -44060,8 +44065,10 @@ var ts; var resolvedValue = resolved_1.value; if (!compilerOptions.preserveSymlinks && resolvedValue && !resolvedValue.originalPath) { var path = realPath(resolvedValue.path, host, traceEnabled); - var originalPath = arePathsEqual(path, resolvedValue.path, host) ? undefined : resolvedValue.path; - resolvedValue = __assign(__assign({}, resolvedValue), { path: path, originalPath: originalPath }); + var pathsAreEqual = arePathsEqual(path, resolvedValue.path, host); + var originalPath = pathsAreEqual ? undefined : resolvedValue.path; + // If the path and realpath are differing only in casing prefer path so that we can issue correct errors for casing under forceConsistentCasingInFileNames + resolvedValue = __assign(__assign({}, resolvedValue), { path: pathsAreEqual ? resolvedValue.path : path, originalPath: originalPath }); } // For node_modules lookups, get the real path so that multiple accesses to an `npm link`-ed module do not create duplicate files. return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } }; @@ -73714,25 +73721,7 @@ var ts; } function getTypeOfPropertyOfContextualType(type, name, nameType) { return mapType(type, function (t) { - if (t.flags & 2097152 /* TypeFlags.Intersection */) { - var intersection = t; - var newTypes = ts.mapDefined(intersection.types, getTypeOfConcretePropertyOfContextualType); - if (newTypes.length > 0) { - return getIntersectionType(newTypes); - } - newTypes = ts.mapDefined(intersection.types, getTypeOfApplicableIndexInfoOfContextualType); - if (newTypes.length > 0) { - return getIntersectionType(newTypes); - } - return undefined; - } - var concretePropertyType = getTypeOfConcretePropertyOfContextualType(t); - if (concretePropertyType) { - return concretePropertyType; - } - return getTypeOfApplicableIndexInfoOfContextualType(t); - }, /*noReductions*/ true); - function getTypeOfConcretePropertyOfContextualType(t) { + var _a; if (isGenericMappedType(t) && !t.declaration.nameType) { var constraint = getConstraintTypeFromMappedType(t); var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint; @@ -73740,9 +73729,8 @@ var ts; if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) { return substituteIndexedMappedType(t, propertyNameType); } - return undefined; } - if (t.flags & 3670016 /* TypeFlags.StructuredType */) { + else if (t.flags & 3670016 /* TypeFlags.StructuredType */) { var prop = getPropertyOfType(t, name); if (prop) { return isCircularMappedProperty(prop) ? undefined : getTypeOfSymbol(prop); @@ -73753,16 +73741,10 @@ var ts; return restType; } } + return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type; } return undefined; - } - function getTypeOfApplicableIndexInfoOfContextualType(t) { - var _a; - if (!(t.flags & 3670016 /* TypeFlags.StructuredType */)) { - return undefined; - } - return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type; - } + }, /*noReductions*/ true); } // In an object literal contextually typed by a type T, the contextual type of a property assignment is the type of // the matching property in T, if one exists. Otherwise, it is the type of the numeric index signature in T, if one @@ -88892,7 +88874,7 @@ var ts; return checkGrammarDecorators(node) || checkGrammarModifiers(node); } function checkGrammarDecorators(node) { - if (ts.canHaveIllegalDecorators(node) && ts.some(node.decorators)) { + if (ts.canHaveIllegalDecorators(node) && ts.some(node.illegalDecorators)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } if (!ts.canHaveDecorators(node) || !ts.hasDecorators(node)) { @@ -182453,9 +182435,9 @@ var ts; // - error: 5.0 var ts; (function (ts) { - var MUST_MERGE = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators have been combined with modifiers. Callers should switch to an overload without a 'decorators' parameter." }; - var DISALLOW_DECORATORS = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators are no longer supported for this function. Callers should switch to an overload without a 'decorators' parameter." }; - var DISALLOW_DECORATORS_AND_MODIFIERS = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators and modifiers are no longer supported for this function. Callers should switch to an overload without the 'decorators' or 'modifiers' parameters." }; + var MUST_MERGE = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators have been combined with modifiers. Callers should switch to an overload that does not accept a 'decorators' parameter." }; + var DISALLOW_DECORATORS = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators are no longer supported for this function. Callers should switch to an overload that does not accept a 'decorators' parameter." }; + var DISALLOW_DECORATORS_AND_MODIFIERS = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators and modifiers are no longer supported for this function. Callers should switch to an overload that does not accept the 'decorators' and 'modifiers' parameters." }; function patchNodeFactory(factory) { var createParameterDeclaration = factory.createParameterDeclaration, updateParameterDeclaration = factory.updateParameterDeclaration, createPropertyDeclaration = factory.createPropertyDeclaration, updatePropertyDeclaration = factory.updatePropertyDeclaration, createMethodDeclaration = factory.createMethodDeclaration, updateMethodDeclaration = factory.updateMethodDeclaration, createConstructorDeclaration = factory.createConstructorDeclaration, updateConstructorDeclaration = factory.updateConstructorDeclaration, createGetAccessorDeclaration = factory.createGetAccessorDeclaration, updateGetAccessorDeclaration = factory.updateGetAccessorDeclaration, createSetAccessorDeclaration = factory.createSetAccessorDeclaration, updateSetAccessorDeclaration = factory.updateSetAccessorDeclaration, createIndexSignature = factory.createIndexSignature, updateIndexSignature = factory.updateIndexSignature, createClassStaticBlockDeclaration = factory.createClassStaticBlockDeclaration, updateClassStaticBlockDeclaration = factory.updateClassStaticBlockDeclaration, createClassExpression = factory.createClassExpression, updateClassExpression = factory.updateClassExpression, createFunctionDeclaration = factory.createFunctionDeclaration, updateFunctionDeclaration = factory.updateFunctionDeclaration, createClassDeclaration = factory.createClassDeclaration, updateClassDeclaration = factory.updateClassDeclaration, createInterfaceDeclaration = factory.createInterfaceDeclaration, updateInterfaceDeclaration = factory.updateInterfaceDeclaration, createTypeAliasDeclaration = factory.createTypeAliasDeclaration, updateTypeAliasDeclaration = factory.updateTypeAliasDeclaration, createEnumDeclaration = factory.createEnumDeclaration, updateEnumDeclaration = factory.updateEnumDeclaration, createModuleDeclaration = factory.createModuleDeclaration, updateModuleDeclaration = factory.updateModuleDeclaration, createImportEqualsDeclaration = factory.createImportEqualsDeclaration, updateImportEqualsDeclaration = factory.updateImportEqualsDeclaration, createImportDeclaration = factory.createImportDeclaration, updateImportDeclaration = factory.updateImportDeclaration, createExportAssignment = factory.createExportAssignment, updateExportAssignment = factory.updateExportAssignment, createExportDeclaration = factory.createExportDeclaration, updateExportDeclaration = factory.updateExportDeclaration; factory.createParameterDeclaration = ts.buildOverload("createParameterDeclaration") @@ -182682,7 +182664,7 @@ var ts; return (decorators === undefined || !ts.some(decorators, ts.isModifier)) && (modifiers === undefined || !ts.some(modifiers, ts.isParameter)) && (parameters === undefined || ts.isArray(parameters)) && - (body === undefined || !ts.isBlock(body)); + (body === undefined || ts.isBlock(body)); }, }) .deprecate({ @@ -182711,7 +182693,7 @@ var ts; return (decorators === undefined || !ts.some(decorators, ts.isModifier)) && (modifiers === undefined || !ts.some(modifiers, ts.isParameter)) && (parameters === undefined || ts.isArray(parameters)) && - (body === undefined || !ts.isBlock(body)); + (body === undefined || ts.isBlock(body)); }, }) .deprecate({ diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index 3ea4fe3130e4b..93619e9bb17a6 100644 --- a/lib/typescript.d.ts +++ b/lib/typescript.d.ts @@ -7912,9 +7912,27 @@ declare namespace ts { } declare namespace ts { interface Node { - /** @deprecated `decorators` has been merged with `modifiers` on the declarations that support decorators. */ - readonly decorators?: NodeArray | undefined; - /** @deprecated `modifiers` has been removed from `Node` and moved to the specific `Node` subtypes that support them. */ + /** + * @deprecated `decorators` has been removed from `Node` and merged with `modifiers` on the `Node` subtypes that support them. + * Use `ts.canHaveDecorators()` to test whether a `Node` can have decorators. + * Use `ts.getDecorators()` to get the decorators of a `Node`. + * + * For example: + * ```ts + * const decorators = ts.canHaveDecorators(node) ? ts.getDecorators(node) : undefined; + * ``` + */ + readonly decorators?: undefined; + /** + * @deprecated `modifiers` has been removed from `Node` and moved to the `Node` subtypes that support them. + * Use `ts.canHaveModifiers()` to test whether a `Node` can have modifiers. + * Use `ts.getModifiers()` to get the modifiers of a `Node`. + * + * For example: + * ```ts + * const modifiers = ts.canHaveModifiers(node) ? ts.getModifiers(node) : undefined; + * ``` + */ readonly modifiers?: NodeArray | undefined; } interface PropertySignature { @@ -7941,231 +7959,155 @@ declare namespace ts { } interface NodeFactory { /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ createParameterDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, dotDotDotToken: DotDotDotToken | undefined, name: string | BindingName, questionToken?: QuestionToken, type?: TypeNode, initializer?: Expression): ParameterDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ updateParameterDeclaration(node: ParameterDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, dotDotDotToken: DotDotDotToken | undefined, name: string | BindingName, questionToken: QuestionToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): ParameterDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ createPropertyDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | PropertyName, questionOrExclamationToken: QuestionToken | ExclamationToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): PropertyDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ updatePropertyDeclaration(node: PropertyDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | PropertyName, questionOrExclamationToken: QuestionToken | ExclamationToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): PropertyDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ createMethodDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): MethodDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ updateMethodDeclaration(node: MethodDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: PropertyName, questionToken: QuestionToken | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): MethodDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated This node does not support Decorators. Callers should use an overload that does not accept a `decorators` parameter. */ createConstructorDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated This node does not support Decorators. Callers should use an overload that does not accept a `decorators` parameter. */ updateConstructorDeclaration(node: ConstructorDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ createGetAccessorDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | PropertyName, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ updateGetAccessorDeclaration(node: GetAccessorDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: PropertyName, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ createSetAccessorDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | PropertyName, parameters: readonly ParameterDeclaration[], body: Block | undefined): SetAccessorDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ updateSetAccessorDeclaration(node: SetAccessorDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: PropertyName, parameters: readonly ParameterDeclaration[], body: Block | undefined): SetAccessorDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createIndexSignature(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators and modifiers are no longer supported for this function. Callers should use an overload that does not accept the `decorators` and `modifiers` parameters. */ updateIndexSignature(node: IndexSignatureDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators and modifiers are no longer supported for this function. Callers should use an overload that does not accept the `decorators` and `modifiers` parameters. */ createClassStaticBlockDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, body: Block): ClassStaticBlockDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateClassStaticBlockDeclaration(node: ClassStaticBlockDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, body: Block): ClassStaticBlockDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ createClassExpression(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): ClassExpression; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ updateClassExpression(node: ClassExpression, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): ClassExpression; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createFunctionDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): FunctionDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateFunctionDeclaration(node: FunctionDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): FunctionDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ createClassDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): ClassDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ updateClassDeclaration(node: ClassDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): ClassDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createInterfaceDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]): InterfaceDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateInterfaceDeclaration(node: InterfaceDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]): InterfaceDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createTypeAliasDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode): TypeAliasDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateTypeAliasDeclaration(node: TypeAliasDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode): TypeAliasDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createEnumDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | Identifier, members: readonly EnumMember[]): EnumDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateEnumDeclaration(node: EnumDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: Identifier, members: readonly EnumMember[]): EnumDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createModuleDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined, flags?: NodeFlags): ModuleDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateModuleDeclaration(node: ModuleDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined): ModuleDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createImportEqualsDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateImportEqualsDeclaration(node: ImportEqualsDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createImportDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause?: AssertClause): ImportDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateImportDeclaration(node: ImportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined): ImportDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createExportAssignment(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isExportEquals: boolean | undefined, expression: Expression): ExportAssignment; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateExportAssignment(node: ExportAssignment, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, expression: Expression): ExportAssignment; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createExportDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, assertClause?: AssertClause): ExportDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateExportDeclaration(node: ExportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, assertClause: AssertClause | undefined): ExportDeclaration; } diff --git a/lib/typescript.js b/lib/typescript.js index d5dc098131b97..46c3d306f71f0 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -2674,6 +2674,7 @@ var ts; var currentAssertionLevel = 0 /* AssertionLevel.None */; Debug.currentLogLevel = LogLevel.Warning; Debug.isDebugging = false; + Debug.enableDeprecationWarnings = true; function getTypeScriptVersion() { return typeScriptVersion !== null && typeScriptVersion !== void 0 ? typeScriptVersion : (typeScriptVersion = new ts.Version(ts.version)); } @@ -3297,7 +3298,7 @@ var ts; function createWarningDeprecation(name, errorAfter, since, message) { var hasWrittenDeprecation = false; return function () { - if (!hasWrittenDeprecation) { + if (Debug.enableDeprecationWarnings && !hasWrittenDeprecation) { log.warn(formatDeprecationMessage(name, /*error*/ false, errorAfter, since, message)); hasWrittenDeprecation = true; } @@ -7185,7 +7186,6 @@ var ts; // not actually work. var byteOrderMarkIndicator = "\uFEFF"; function getNodeSystem() { - var _a; var nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[a-zA-Z0-9_\s]+(\.js)?$)/; var _fs = require("fs"); var _path = require("path"); @@ -7195,7 +7195,7 @@ var ts; try { _crypto = require("crypto"); } - catch (_b) { + catch (_a) { _crypto = undefined; } var activeSession; @@ -7206,10 +7206,10 @@ var ts; var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin"; var platform = _os.platform(); var useCaseSensitiveFileNames = isFileSystemCaseSensitive(); - var realpathSync = (_a = _fs.realpathSync.native) !== null && _a !== void 0 ? _a : _fs.realpathSync; + var fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync; var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin"); var getCurrentDirectory = ts.memoize(function () { return process.cwd(); }); - var _c = createSystemWatchFunctions({ + var _b = createSystemWatchFunctions({ pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames), getModifiedTime: getModifiedTime, setTimeout: setTimeout, @@ -7229,7 +7229,7 @@ var ts; defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); }, inodeWatching: isLinuxOrMacOs, sysLog: sysLog, - }), watchFile = _c.watchFile, watchDirectory = _c.watchDirectory; + }), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory; var nodeSystem = { args: process.argv.slice(2), newLine: _os.EOL, @@ -7622,9 +7622,12 @@ var ts; function getDirectories(path) { return getAccessibleFileSystemEntries(path).directories.slice(); } + function fsRealPathHandlingLongPath(path) { + return path.length < 260 ? _fs.realpathSync.native(path) : _fs.realpathSync(path); + } function realpath(path) { try { - return realpathSync(path); + return fsRealpath(path); } catch (_a) { return path; @@ -21552,7 +21555,7 @@ var ts; case 165 /* SyntaxKind.Decorator */: { var parent_2 = node.parent; return ts.canHaveDecorators(parent_2) ? parent_2.modifiers : - ts.canHaveIllegalDecorators(parent_2) ? parent_2.decorators : + ts.canHaveIllegalDecorators(parent_2) ? parent_2.illegalDecorators : undefined; } case 291 /* SyntaxKind.HeritageClause */: @@ -23629,7 +23632,7 @@ var ts; node.body = body; node.transformFlags = propagateChildFlags(body) | 16777216 /* TransformFlags.ContainsClassFields */; // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; node.modifiers = undefined; return node; } @@ -23641,7 +23644,7 @@ var ts; } function finishUpdateClassStaticBlockDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.modifiers = original.modifiers; } return update(updated, original); @@ -23654,7 +23657,7 @@ var ts; /*type*/ undefined, body); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; node.typeParameters = undefined; node.type = undefined; return node; @@ -23669,7 +23672,7 @@ var ts; } function finishUpdateConstructorDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.typeParameters = original.typeParameters; updated.type = original.type; } @@ -25417,7 +25420,7 @@ var ts; } } // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25435,7 +25438,7 @@ var ts; function finishUpdateFunctionDeclaration(updated, original) { if (updated !== original) { // copy children used only for error reporting - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return finishUpdateBaseSignatureDeclaration(updated, original); } @@ -25469,7 +25472,7 @@ var ts; node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25484,7 +25487,7 @@ var ts; } function finishUpdateInterfaceDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25494,7 +25497,7 @@ var ts; node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25508,7 +25511,7 @@ var ts; } function finishUpdateTypeAliasDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25521,7 +25524,7 @@ var ts; 1 /* TransformFlags.ContainsTypeScript */; node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // Enum declarations cannot contain `await` // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25534,7 +25537,7 @@ var ts; } function finishUpdateEnumDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25558,7 +25561,7 @@ var ts; } node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // Module declarations cannot contain `await`. // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25571,7 +25574,7 @@ var ts; } function finishUpdateModuleDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25607,7 +25610,7 @@ var ts; /*modifiers*/ undefined, name); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; node.modifiers = undefined; return node; } @@ -25619,7 +25622,7 @@ var ts; } function finishUpdateNamespaceExportDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.modifiers = original.modifiers; } return update(updated, original); @@ -25634,7 +25637,7 @@ var ts; node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // Import= declaration is always parsed in an Await context // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25648,7 +25651,7 @@ var ts; } function finishUpdateImportEqualsDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25664,7 +25667,7 @@ var ts; propagateChildFlags(node.moduleSpecifier); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25678,7 +25681,7 @@ var ts; } function finishUpdateImportDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25824,7 +25827,7 @@ var ts; node.transformFlags |= propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.expression); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25836,7 +25839,7 @@ var ts; } function finishUpdateExportAssignment(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25854,7 +25857,7 @@ var ts; propagateChildFlags(node.moduleSpecifier); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25869,7 +25872,7 @@ var ts; } function finishUpdateExportDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -26633,7 +26636,7 @@ var ts; propagateChildFlags(node.name) | propagateChildFlags(node.initializer); // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; node.modifiers = undefined; node.questionToken = undefined; node.exclamationToken = undefined; @@ -26649,7 +26652,7 @@ var ts; function finishUpdatePropertyAssignment(updated, original) { // copy children used only for error reporting if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.modifiers = original.modifiers; updated.questionToken = original.questionToken; updated.exclamationToken = original.exclamationToken; @@ -26666,7 +26669,7 @@ var ts; 1024 /* TransformFlags.ContainsES2015 */; // The following properties are used only to report grammar errors node.equalsToken = undefined; - node.decorators = undefined; + node.illegalDecorators = undefined; node.modifiers = undefined; node.questionToken = undefined; node.exclamationToken = undefined; @@ -26683,7 +26686,7 @@ var ts; if (updated !== original) { // copy children used only for error reporting updated.equalsToken = original.equalsToken; - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.modifiers = original.modifiers; updated.questionToken = original.questionToken; updated.exclamationToken = original.exclamationToken; @@ -31161,7 +31164,7 @@ var ts; visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || @@ -31191,7 +31194,7 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); case 296 /* SyntaxKind.PropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || @@ -31208,7 +31211,7 @@ var ts; visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 176 /* SyntaxKind.IndexSignature */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || @@ -31246,7 +31249,7 @@ var ts; visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); case 171 /* SyntaxKind.Constructor */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || @@ -31268,7 +31271,7 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.body); case 256 /* SyntaxKind.FunctionDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || @@ -31292,7 +31295,7 @@ var ts; visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.body); case 178 /* SyntaxKind.TypeReference */: @@ -31420,7 +31423,7 @@ var ts; return visitNodes(cbNode, cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); case 237 /* SyntaxKind.VariableStatement */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); case 255 /* SyntaxKind.VariableDeclarationList */: @@ -31491,20 +31494,20 @@ var ts; visitNodes(cbNode, cbNodes, node.heritageClauses) || visitNodes(cbNode, cbNodes, node.members); case 258 /* SyntaxKind.InterfaceDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.heritageClauses) || visitNodes(cbNode, cbNodes, node.members); case 259 /* SyntaxKind.TypeAliasDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNode(cbNode, node.type); case 260 /* SyntaxKind.EnumDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.members); @@ -31512,17 +31515,17 @@ var ts; return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 261 /* SyntaxKind.ModuleDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); case 266 /* SyntaxKind.ImportDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier) || @@ -31536,7 +31539,7 @@ var ts; return visitNode(cbNode, node.name) || visitNode(cbNode, node.value); case 264 /* SyntaxKind.NamespaceExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNode(cbNode, node.name); case 268 /* SyntaxKind.NamespaceImport */: return visitNode(cbNode, node.name); @@ -31546,7 +31549,7 @@ var ts; case 273 /* SyntaxKind.NamedExports */: return visitNodes(cbNode, cbNodes, node.elements); case 272 /* SyntaxKind.ExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier) || @@ -31556,7 +31559,7 @@ var ts; return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); case 271 /* SyntaxKind.ExportAssignment */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.expression); case 223 /* SyntaxKind.TemplateExpression */: @@ -31581,7 +31584,7 @@ var ts; case 277 /* SyntaxKind.ExternalModuleReference */: return visitNode(cbNode, node.expression); case 276 /* SyntaxKind.MissingDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers); case 351 /* SyntaxKind.CommaListExpression */: return visitNodes(cbNode, cbNodes, node.elements); @@ -34132,7 +34135,7 @@ var ts; var type = parseTypeAnnotation(); parseTypeMemberSemicolon(); var node = factory.createIndexSignature(modifiers, parameters, type); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parsePropertyOrMethodSignature(pos, hasJSDoc, modifiers) { @@ -36292,7 +36295,7 @@ var ts; node = factory.createPropertyAssignment(name, initializer); } // Decorators, Modifiers, questionToken, and exclamationToken are not supported by property assignments and are reported in the grammar checker - node.decorators = decorators; + node.illegalDecorators = decorators; node.modifiers = modifiers; node.questionToken = questionToken; node.exclamationToken = exclamationToken; @@ -36940,7 +36943,7 @@ var ts; // would follow. For recovery and error reporting purposes, return an incomplete declaration. var missing = createMissingNode(276 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); ts.setTextRangePos(missing, pos); - missing.decorators = decorators; + missing.illegalDecorators = decorators; missing.modifiers = modifiers; return missing; } @@ -37083,7 +37086,7 @@ var ts; parseSemicolon(); var node = factory.createVariableStatement(modifiers, declarationList); // Decorators are not allowed on a variable statement, so we keep track of them to report them in the grammar checker. - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseFunctionDeclaration(pos, hasJSDoc, decorators, modifiers) { @@ -37103,7 +37106,7 @@ var ts; var body = parseFunctionBlockOrSemicolon(isGenerator | isAsync, ts.Diagnostics.or_expected); setAwaitContext(savedAwaitContext); var node = factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseConstructorName() { @@ -37126,7 +37129,7 @@ var ts; var body = parseFunctionBlockOrSemicolon(0 /* SignatureFlags.None */, ts.Diagnostics.or_expected); var node = factory.createConstructorDeclaration(modifiers, parameters, body); // Attach invalid nodes if they exist so that we can report them in the grammar checker. - node.decorators = decorators; + node.illegalDecorators = decorators; node.typeParameters = typeParameters; node.type = type; return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -37242,7 +37245,7 @@ var ts; parseExpectedToken(124 /* SyntaxKind.StaticKeyword */); var body = parseClassStaticBlockBody(); var node = withJSDoc(finishNode(factory.createClassStaticBlockDeclaration(body), pos), hasJSDoc); - node.decorators = decorators; + node.illegalDecorators = decorators; node.modifiers = modifiers; return node; } @@ -37483,7 +37486,7 @@ var ts; var heritageClauses = parseHeritageClauses(); var members = parseObjectTypeMembers(); var node = factory.createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers) { @@ -37494,7 +37497,7 @@ var ts; var type = token() === 138 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); parseSemicolon(); var node = factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } // In an ambient declaration, the grammar only allows integer literals as initializers. @@ -37520,7 +37523,7 @@ var ts; members = createMissingList(); } var node = factory.createEnumDeclaration(modifiers, name, members); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseModuleBlock() { @@ -37544,7 +37547,7 @@ var ts; ? parseModuleOrNamespaceDeclaration(getNodePos(), /*hasJSDoc*/ false, /*decorators*/ undefined, /*modifiers*/ undefined, 4 /* NodeFlags.NestedNamespace */ | namespaceFlag) : parseModuleBlock(); var node = factory.createModuleDeclaration(modifiers, name, body, flags); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { @@ -37567,7 +37570,7 @@ var ts; parseSemicolon(); } var node = factory.createModuleDeclaration(modifiers, name, body, flags); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { @@ -37607,7 +37610,7 @@ var ts; parseSemicolon(); var node = factory.createNamespaceExportDeclaration(name); // NamespaceExportDeclaration nodes cannot have decorators or modifiers, so we attach them here so we can report them in the grammar checker - node.decorators = decorators; + node.illegalDecorators = decorators; node.modifiers = modifiers; return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -37647,7 +37650,7 @@ var ts; } parseSemicolon(); var node = factory.createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseAssertEntry() { @@ -37692,7 +37695,7 @@ var ts; var moduleReference = parseModuleReference(); parseSemicolon(); var node = factory.createImportEqualsDeclaration(modifiers, isTypeOnly, identifier, moduleReference); - node.decorators = decorators; + node.illegalDecorators = decorators; var finished = withJSDoc(finishNode(node, pos), hasJSDoc); return finished; } @@ -37882,7 +37885,7 @@ var ts; parseSemicolon(); setAwaitContext(savedAwaitContext); var node = factory.createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseExportAssignment(pos, hasJSDoc, decorators, modifiers) { @@ -37899,7 +37902,7 @@ var ts; parseSemicolon(); setAwaitContext(savedAwaitContext); var node = factory.createExportAssignment(modifiers, isExportEquals, expression); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } var ParsingContext; @@ -43263,10 +43266,12 @@ var ts; if (resolved) { var fileName = resolved.fileName, packageId = resolved.packageId; var resolvedFileName = options.preserveSymlinks ? fileName : realPath(fileName, host, traceEnabled); + var pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host); resolvedTypeReferenceDirective = { primary: primary, - resolvedFileName: resolvedFileName, - originalPath: arePathsEqual(fileName, resolvedFileName, host) ? undefined : fileName, + // If the fileName and realpath are differing only in casing prefer fileName so that we can issue correct errors for casing under forceConsistentCasingInFileNames + resolvedFileName: pathsAreEqual ? fileName : resolvedFileName, + originalPath: pathsAreEqual ? undefined : fileName, packageId: packageId, isExternalLibraryImport: pathContainsNodeModules(fileName), }; @@ -44051,8 +44056,10 @@ var ts; var resolvedValue = resolved_1.value; if (!compilerOptions.preserveSymlinks && resolvedValue && !resolvedValue.originalPath) { var path = realPath(resolvedValue.path, host, traceEnabled); - var originalPath = arePathsEqual(path, resolvedValue.path, host) ? undefined : resolvedValue.path; - resolvedValue = __assign(__assign({}, resolvedValue), { path: path, originalPath: originalPath }); + var pathsAreEqual = arePathsEqual(path, resolvedValue.path, host); + var originalPath = pathsAreEqual ? undefined : resolvedValue.path; + // If the path and realpath are differing only in casing prefer path so that we can issue correct errors for casing under forceConsistentCasingInFileNames + resolvedValue = __assign(__assign({}, resolvedValue), { path: pathsAreEqual ? resolvedValue.path : path, originalPath: originalPath }); } // For node_modules lookups, get the real path so that multiple accesses to an `npm link`-ed module do not create duplicate files. return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } }; @@ -73705,25 +73712,7 @@ var ts; } function getTypeOfPropertyOfContextualType(type, name, nameType) { return mapType(type, function (t) { - if (t.flags & 2097152 /* TypeFlags.Intersection */) { - var intersection = t; - var newTypes = ts.mapDefined(intersection.types, getTypeOfConcretePropertyOfContextualType); - if (newTypes.length > 0) { - return getIntersectionType(newTypes); - } - newTypes = ts.mapDefined(intersection.types, getTypeOfApplicableIndexInfoOfContextualType); - if (newTypes.length > 0) { - return getIntersectionType(newTypes); - } - return undefined; - } - var concretePropertyType = getTypeOfConcretePropertyOfContextualType(t); - if (concretePropertyType) { - return concretePropertyType; - } - return getTypeOfApplicableIndexInfoOfContextualType(t); - }, /*noReductions*/ true); - function getTypeOfConcretePropertyOfContextualType(t) { + var _a; if (isGenericMappedType(t) && !t.declaration.nameType) { var constraint = getConstraintTypeFromMappedType(t); var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint; @@ -73731,9 +73720,8 @@ var ts; if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) { return substituteIndexedMappedType(t, propertyNameType); } - return undefined; } - if (t.flags & 3670016 /* TypeFlags.StructuredType */) { + else if (t.flags & 3670016 /* TypeFlags.StructuredType */) { var prop = getPropertyOfType(t, name); if (prop) { return isCircularMappedProperty(prop) ? undefined : getTypeOfSymbol(prop); @@ -73744,16 +73732,10 @@ var ts; return restType; } } + return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type; } return undefined; - } - function getTypeOfApplicableIndexInfoOfContextualType(t) { - var _a; - if (!(t.flags & 3670016 /* TypeFlags.StructuredType */)) { - return undefined; - } - return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type; - } + }, /*noReductions*/ true); } // In an object literal contextually typed by a type T, the contextual type of a property assignment is the type of // the matching property in T, if one exists. Otherwise, it is the type of the numeric index signature in T, if one @@ -88883,7 +88865,7 @@ var ts; return checkGrammarDecorators(node) || checkGrammarModifiers(node); } function checkGrammarDecorators(node) { - if (ts.canHaveIllegalDecorators(node) && ts.some(node.decorators)) { + if (ts.canHaveIllegalDecorators(node) && ts.some(node.illegalDecorators)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } if (!ts.canHaveDecorators(node) || !ts.hasDecorators(node)) { @@ -171628,9 +171610,9 @@ var ts; // - error: 5.0 var ts; (function (ts) { - var MUST_MERGE = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators have been combined with modifiers. Callers should switch to an overload without a 'decorators' parameter." }; - var DISALLOW_DECORATORS = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators are no longer supported for this function. Callers should switch to an overload without a 'decorators' parameter." }; - var DISALLOW_DECORATORS_AND_MODIFIERS = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators and modifiers are no longer supported for this function. Callers should switch to an overload without the 'decorators' or 'modifiers' parameters." }; + var MUST_MERGE = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators have been combined with modifiers. Callers should switch to an overload that does not accept a 'decorators' parameter." }; + var DISALLOW_DECORATORS = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators are no longer supported for this function. Callers should switch to an overload that does not accept a 'decorators' parameter." }; + var DISALLOW_DECORATORS_AND_MODIFIERS = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators and modifiers are no longer supported for this function. Callers should switch to an overload that does not accept the 'decorators' and 'modifiers' parameters." }; function patchNodeFactory(factory) { var createParameterDeclaration = factory.createParameterDeclaration, updateParameterDeclaration = factory.updateParameterDeclaration, createPropertyDeclaration = factory.createPropertyDeclaration, updatePropertyDeclaration = factory.updatePropertyDeclaration, createMethodDeclaration = factory.createMethodDeclaration, updateMethodDeclaration = factory.updateMethodDeclaration, createConstructorDeclaration = factory.createConstructorDeclaration, updateConstructorDeclaration = factory.updateConstructorDeclaration, createGetAccessorDeclaration = factory.createGetAccessorDeclaration, updateGetAccessorDeclaration = factory.updateGetAccessorDeclaration, createSetAccessorDeclaration = factory.createSetAccessorDeclaration, updateSetAccessorDeclaration = factory.updateSetAccessorDeclaration, createIndexSignature = factory.createIndexSignature, updateIndexSignature = factory.updateIndexSignature, createClassStaticBlockDeclaration = factory.createClassStaticBlockDeclaration, updateClassStaticBlockDeclaration = factory.updateClassStaticBlockDeclaration, createClassExpression = factory.createClassExpression, updateClassExpression = factory.updateClassExpression, createFunctionDeclaration = factory.createFunctionDeclaration, updateFunctionDeclaration = factory.updateFunctionDeclaration, createClassDeclaration = factory.createClassDeclaration, updateClassDeclaration = factory.updateClassDeclaration, createInterfaceDeclaration = factory.createInterfaceDeclaration, updateInterfaceDeclaration = factory.updateInterfaceDeclaration, createTypeAliasDeclaration = factory.createTypeAliasDeclaration, updateTypeAliasDeclaration = factory.updateTypeAliasDeclaration, createEnumDeclaration = factory.createEnumDeclaration, updateEnumDeclaration = factory.updateEnumDeclaration, createModuleDeclaration = factory.createModuleDeclaration, updateModuleDeclaration = factory.updateModuleDeclaration, createImportEqualsDeclaration = factory.createImportEqualsDeclaration, updateImportEqualsDeclaration = factory.updateImportEqualsDeclaration, createImportDeclaration = factory.createImportDeclaration, updateImportDeclaration = factory.updateImportDeclaration, createExportAssignment = factory.createExportAssignment, updateExportAssignment = factory.updateExportAssignment, createExportDeclaration = factory.createExportDeclaration, updateExportDeclaration = factory.updateExportDeclaration; factory.createParameterDeclaration = ts.buildOverload("createParameterDeclaration") @@ -171857,7 +171839,7 @@ var ts; return (decorators === undefined || !ts.some(decorators, ts.isModifier)) && (modifiers === undefined || !ts.some(modifiers, ts.isParameter)) && (parameters === undefined || ts.isArray(parameters)) && - (body === undefined || !ts.isBlock(body)); + (body === undefined || ts.isBlock(body)); }, }) .deprecate({ @@ -171886,7 +171868,7 @@ var ts; return (decorators === undefined || !ts.some(decorators, ts.isModifier)) && (modifiers === undefined || !ts.some(modifiers, ts.isParameter)) && (parameters === undefined || ts.isArray(parameters)) && - (body === undefined || !ts.isBlock(body)); + (body === undefined || ts.isBlock(body)); }, }) .deprecate({ diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts index 04387d6187a1e..33d0b06d250e5 100644 --- a/lib/typescriptServices.d.ts +++ b/lib/typescriptServices.d.ts @@ -7912,9 +7912,27 @@ declare namespace ts { } declare namespace ts { interface Node { - /** @deprecated `decorators` has been merged with `modifiers` on the declarations that support decorators. */ - readonly decorators?: NodeArray | undefined; - /** @deprecated `modifiers` has been removed from `Node` and moved to the specific `Node` subtypes that support them. */ + /** + * @deprecated `decorators` has been removed from `Node` and merged with `modifiers` on the `Node` subtypes that support them. + * Use `ts.canHaveDecorators()` to test whether a `Node` can have decorators. + * Use `ts.getDecorators()` to get the decorators of a `Node`. + * + * For example: + * ```ts + * const decorators = ts.canHaveDecorators(node) ? ts.getDecorators(node) : undefined; + * ``` + */ + readonly decorators?: undefined; + /** + * @deprecated `modifiers` has been removed from `Node` and moved to the `Node` subtypes that support them. + * Use `ts.canHaveModifiers()` to test whether a `Node` can have modifiers. + * Use `ts.getModifiers()` to get the modifiers of a `Node`. + * + * For example: + * ```ts + * const modifiers = ts.canHaveModifiers(node) ? ts.getModifiers(node) : undefined; + * ``` + */ readonly modifiers?: NodeArray | undefined; } interface PropertySignature { @@ -7941,231 +7959,155 @@ declare namespace ts { } interface NodeFactory { /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ createParameterDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, dotDotDotToken: DotDotDotToken | undefined, name: string | BindingName, questionToken?: QuestionToken, type?: TypeNode, initializer?: Expression): ParameterDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ updateParameterDeclaration(node: ParameterDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, dotDotDotToken: DotDotDotToken | undefined, name: string | BindingName, questionToken: QuestionToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): ParameterDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ createPropertyDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | PropertyName, questionOrExclamationToken: QuestionToken | ExclamationToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): PropertyDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ updatePropertyDeclaration(node: PropertyDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | PropertyName, questionOrExclamationToken: QuestionToken | ExclamationToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): PropertyDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ createMethodDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): MethodDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ updateMethodDeclaration(node: MethodDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: PropertyName, questionToken: QuestionToken | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): MethodDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated This node does not support Decorators. Callers should use an overload that does not accept a `decorators` parameter. */ createConstructorDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated This node does not support Decorators. Callers should use an overload that does not accept a `decorators` parameter. */ updateConstructorDeclaration(node: ConstructorDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ createGetAccessorDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | PropertyName, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ updateGetAccessorDeclaration(node: GetAccessorDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: PropertyName, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ createSetAccessorDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | PropertyName, parameters: readonly ParameterDeclaration[], body: Block | undefined): SetAccessorDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ updateSetAccessorDeclaration(node: SetAccessorDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: PropertyName, parameters: readonly ParameterDeclaration[], body: Block | undefined): SetAccessorDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createIndexSignature(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators and modifiers are no longer supported for this function. Callers should use an overload that does not accept the `decorators` and `modifiers` parameters. */ updateIndexSignature(node: IndexSignatureDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators and modifiers are no longer supported for this function. Callers should use an overload that does not accept the `decorators` and `modifiers` parameters. */ createClassStaticBlockDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, body: Block): ClassStaticBlockDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateClassStaticBlockDeclaration(node: ClassStaticBlockDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, body: Block): ClassStaticBlockDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ createClassExpression(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): ClassExpression; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ updateClassExpression(node: ClassExpression, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): ClassExpression; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createFunctionDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): FunctionDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateFunctionDeclaration(node: FunctionDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): FunctionDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ createClassDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): ClassDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators have been combined with modifiers. Callers should use an overload that does not accept a `decorators` parameter. */ updateClassDeclaration(node: ClassDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): ClassDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createInterfaceDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]): InterfaceDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateInterfaceDeclaration(node: InterfaceDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]): InterfaceDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createTypeAliasDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode): TypeAliasDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateTypeAliasDeclaration(node: TypeAliasDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode): TypeAliasDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createEnumDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: string | Identifier, members: readonly EnumMember[]): EnumDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateEnumDeclaration(node: EnumDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: Identifier, members: readonly EnumMember[]): EnumDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createModuleDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined, flags?: NodeFlags): ModuleDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateModuleDeclaration(node: ModuleDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined): ModuleDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createImportEqualsDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateImportEqualsDeclaration(node: ImportEqualsDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createImportDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause?: AssertClause): ImportDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateImportDeclaration(node: ImportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined): ImportDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createExportAssignment(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isExportEquals: boolean | undefined, expression: Expression): ExportAssignment; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateExportAssignment(node: ExportAssignment, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, expression: Expression): ExportAssignment; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ createExportDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, assertClause?: AssertClause): ExportDeclaration; /** - * @deprecated Decorators have been combined with modifiers. Callers should pass - * `null` to the `decorators` parameter so that a future update can introduce - * an overload that removes the parameter entirely. + * @deprecated Decorators are no longer supported for this function. Callers should use an overload that does not accept a `decorators` parameter. */ updateExportDeclaration(node: ExportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, assertClause: AssertClause | undefined): ExportDeclaration; } diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index ed8f1cb728ddb..28d6a67c6be29 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -2674,6 +2674,7 @@ var ts; var currentAssertionLevel = 0 /* AssertionLevel.None */; Debug.currentLogLevel = LogLevel.Warning; Debug.isDebugging = false; + Debug.enableDeprecationWarnings = true; function getTypeScriptVersion() { return typeScriptVersion !== null && typeScriptVersion !== void 0 ? typeScriptVersion : (typeScriptVersion = new ts.Version(ts.version)); } @@ -3297,7 +3298,7 @@ var ts; function createWarningDeprecation(name, errorAfter, since, message) { var hasWrittenDeprecation = false; return function () { - if (!hasWrittenDeprecation) { + if (Debug.enableDeprecationWarnings && !hasWrittenDeprecation) { log.warn(formatDeprecationMessage(name, /*error*/ false, errorAfter, since, message)); hasWrittenDeprecation = true; } @@ -7185,7 +7186,6 @@ var ts; // not actually work. var byteOrderMarkIndicator = "\uFEFF"; function getNodeSystem() { - var _a; var nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[a-zA-Z0-9_\s]+(\.js)?$)/; var _fs = require("fs"); var _path = require("path"); @@ -7195,7 +7195,7 @@ var ts; try { _crypto = require("crypto"); } - catch (_b) { + catch (_a) { _crypto = undefined; } var activeSession; @@ -7206,10 +7206,10 @@ var ts; var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin"; var platform = _os.platform(); var useCaseSensitiveFileNames = isFileSystemCaseSensitive(); - var realpathSync = (_a = _fs.realpathSync.native) !== null && _a !== void 0 ? _a : _fs.realpathSync; + var fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync; var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin"); var getCurrentDirectory = ts.memoize(function () { return process.cwd(); }); - var _c = createSystemWatchFunctions({ + var _b = createSystemWatchFunctions({ pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames), getModifiedTime: getModifiedTime, setTimeout: setTimeout, @@ -7229,7 +7229,7 @@ var ts; defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); }, inodeWatching: isLinuxOrMacOs, sysLog: sysLog, - }), watchFile = _c.watchFile, watchDirectory = _c.watchDirectory; + }), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory; var nodeSystem = { args: process.argv.slice(2), newLine: _os.EOL, @@ -7622,9 +7622,12 @@ var ts; function getDirectories(path) { return getAccessibleFileSystemEntries(path).directories.slice(); } + function fsRealPathHandlingLongPath(path) { + return path.length < 260 ? _fs.realpathSync.native(path) : _fs.realpathSync(path); + } function realpath(path) { try { - return realpathSync(path); + return fsRealpath(path); } catch (_a) { return path; @@ -21552,7 +21555,7 @@ var ts; case 165 /* SyntaxKind.Decorator */: { var parent_2 = node.parent; return ts.canHaveDecorators(parent_2) ? parent_2.modifiers : - ts.canHaveIllegalDecorators(parent_2) ? parent_2.decorators : + ts.canHaveIllegalDecorators(parent_2) ? parent_2.illegalDecorators : undefined; } case 291 /* SyntaxKind.HeritageClause */: @@ -23629,7 +23632,7 @@ var ts; node.body = body; node.transformFlags = propagateChildFlags(body) | 16777216 /* TransformFlags.ContainsClassFields */; // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; node.modifiers = undefined; return node; } @@ -23641,7 +23644,7 @@ var ts; } function finishUpdateClassStaticBlockDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.modifiers = original.modifiers; } return update(updated, original); @@ -23654,7 +23657,7 @@ var ts; /*type*/ undefined, body); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; node.typeParameters = undefined; node.type = undefined; return node; @@ -23669,7 +23672,7 @@ var ts; } function finishUpdateConstructorDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.typeParameters = original.typeParameters; updated.type = original.type; } @@ -25417,7 +25420,7 @@ var ts; } } // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25435,7 +25438,7 @@ var ts; function finishUpdateFunctionDeclaration(updated, original) { if (updated !== original) { // copy children used only for error reporting - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return finishUpdateBaseSignatureDeclaration(updated, original); } @@ -25469,7 +25472,7 @@ var ts; node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25484,7 +25487,7 @@ var ts; } function finishUpdateInterfaceDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25494,7 +25497,7 @@ var ts; node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25508,7 +25511,7 @@ var ts; } function finishUpdateTypeAliasDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25521,7 +25524,7 @@ var ts; 1 /* TransformFlags.ContainsTypeScript */; node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // Enum declarations cannot contain `await` // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25534,7 +25537,7 @@ var ts; } function finishUpdateEnumDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25558,7 +25561,7 @@ var ts; } node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // Module declarations cannot contain `await`. // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25571,7 +25574,7 @@ var ts; } function finishUpdateModuleDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25607,7 +25610,7 @@ var ts; /*modifiers*/ undefined, name); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; node.modifiers = undefined; return node; } @@ -25619,7 +25622,7 @@ var ts; } function finishUpdateNamespaceExportDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.modifiers = original.modifiers; } return update(updated, original); @@ -25634,7 +25637,7 @@ var ts; node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // Import= declaration is always parsed in an Await context // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25648,7 +25651,7 @@ var ts; } function finishUpdateImportEqualsDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25664,7 +25667,7 @@ var ts; propagateChildFlags(node.moduleSpecifier); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25678,7 +25681,7 @@ var ts; } function finishUpdateImportDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25824,7 +25827,7 @@ var ts; node.transformFlags |= propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.expression); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25836,7 +25839,7 @@ var ts; } function finishUpdateExportAssignment(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25854,7 +25857,7 @@ var ts; propagateChildFlags(node.moduleSpecifier); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25869,7 +25872,7 @@ var ts; } function finishUpdateExportDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -26633,7 +26636,7 @@ var ts; propagateChildFlags(node.name) | propagateChildFlags(node.initializer); // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; node.modifiers = undefined; node.questionToken = undefined; node.exclamationToken = undefined; @@ -26649,7 +26652,7 @@ var ts; function finishUpdatePropertyAssignment(updated, original) { // copy children used only for error reporting if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.modifiers = original.modifiers; updated.questionToken = original.questionToken; updated.exclamationToken = original.exclamationToken; @@ -26666,7 +26669,7 @@ var ts; 1024 /* TransformFlags.ContainsES2015 */; // The following properties are used only to report grammar errors node.equalsToken = undefined; - node.decorators = undefined; + node.illegalDecorators = undefined; node.modifiers = undefined; node.questionToken = undefined; node.exclamationToken = undefined; @@ -26683,7 +26686,7 @@ var ts; if (updated !== original) { // copy children used only for error reporting updated.equalsToken = original.equalsToken; - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.modifiers = original.modifiers; updated.questionToken = original.questionToken; updated.exclamationToken = original.exclamationToken; @@ -31161,7 +31164,7 @@ var ts; visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || @@ -31191,7 +31194,7 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); case 296 /* SyntaxKind.PropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || @@ -31208,7 +31211,7 @@ var ts; visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 176 /* SyntaxKind.IndexSignature */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || @@ -31246,7 +31249,7 @@ var ts; visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); case 171 /* SyntaxKind.Constructor */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || @@ -31268,7 +31271,7 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.body); case 256 /* SyntaxKind.FunctionDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || @@ -31292,7 +31295,7 @@ var ts; visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.body); case 178 /* SyntaxKind.TypeReference */: @@ -31420,7 +31423,7 @@ var ts; return visitNodes(cbNode, cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); case 237 /* SyntaxKind.VariableStatement */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); case 255 /* SyntaxKind.VariableDeclarationList */: @@ -31491,20 +31494,20 @@ var ts; visitNodes(cbNode, cbNodes, node.heritageClauses) || visitNodes(cbNode, cbNodes, node.members); case 258 /* SyntaxKind.InterfaceDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.heritageClauses) || visitNodes(cbNode, cbNodes, node.members); case 259 /* SyntaxKind.TypeAliasDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNode(cbNode, node.type); case 260 /* SyntaxKind.EnumDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.members); @@ -31512,17 +31515,17 @@ var ts; return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 261 /* SyntaxKind.ModuleDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); case 266 /* SyntaxKind.ImportDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier) || @@ -31536,7 +31539,7 @@ var ts; return visitNode(cbNode, node.name) || visitNode(cbNode, node.value); case 264 /* SyntaxKind.NamespaceExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNode(cbNode, node.name); case 268 /* SyntaxKind.NamespaceImport */: return visitNode(cbNode, node.name); @@ -31546,7 +31549,7 @@ var ts; case 273 /* SyntaxKind.NamedExports */: return visitNodes(cbNode, cbNodes, node.elements); case 272 /* SyntaxKind.ExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier) || @@ -31556,7 +31559,7 @@ var ts; return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); case 271 /* SyntaxKind.ExportAssignment */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.expression); case 223 /* SyntaxKind.TemplateExpression */: @@ -31581,7 +31584,7 @@ var ts; case 277 /* SyntaxKind.ExternalModuleReference */: return visitNode(cbNode, node.expression); case 276 /* SyntaxKind.MissingDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers); case 351 /* SyntaxKind.CommaListExpression */: return visitNodes(cbNode, cbNodes, node.elements); @@ -34132,7 +34135,7 @@ var ts; var type = parseTypeAnnotation(); parseTypeMemberSemicolon(); var node = factory.createIndexSignature(modifiers, parameters, type); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parsePropertyOrMethodSignature(pos, hasJSDoc, modifiers) { @@ -36292,7 +36295,7 @@ var ts; node = factory.createPropertyAssignment(name, initializer); } // Decorators, Modifiers, questionToken, and exclamationToken are not supported by property assignments and are reported in the grammar checker - node.decorators = decorators; + node.illegalDecorators = decorators; node.modifiers = modifiers; node.questionToken = questionToken; node.exclamationToken = exclamationToken; @@ -36940,7 +36943,7 @@ var ts; // would follow. For recovery and error reporting purposes, return an incomplete declaration. var missing = createMissingNode(276 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); ts.setTextRangePos(missing, pos); - missing.decorators = decorators; + missing.illegalDecorators = decorators; missing.modifiers = modifiers; return missing; } @@ -37083,7 +37086,7 @@ var ts; parseSemicolon(); var node = factory.createVariableStatement(modifiers, declarationList); // Decorators are not allowed on a variable statement, so we keep track of them to report them in the grammar checker. - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseFunctionDeclaration(pos, hasJSDoc, decorators, modifiers) { @@ -37103,7 +37106,7 @@ var ts; var body = parseFunctionBlockOrSemicolon(isGenerator | isAsync, ts.Diagnostics.or_expected); setAwaitContext(savedAwaitContext); var node = factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseConstructorName() { @@ -37126,7 +37129,7 @@ var ts; var body = parseFunctionBlockOrSemicolon(0 /* SignatureFlags.None */, ts.Diagnostics.or_expected); var node = factory.createConstructorDeclaration(modifiers, parameters, body); // Attach invalid nodes if they exist so that we can report them in the grammar checker. - node.decorators = decorators; + node.illegalDecorators = decorators; node.typeParameters = typeParameters; node.type = type; return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -37242,7 +37245,7 @@ var ts; parseExpectedToken(124 /* SyntaxKind.StaticKeyword */); var body = parseClassStaticBlockBody(); var node = withJSDoc(finishNode(factory.createClassStaticBlockDeclaration(body), pos), hasJSDoc); - node.decorators = decorators; + node.illegalDecorators = decorators; node.modifiers = modifiers; return node; } @@ -37483,7 +37486,7 @@ var ts; var heritageClauses = parseHeritageClauses(); var members = parseObjectTypeMembers(); var node = factory.createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers) { @@ -37494,7 +37497,7 @@ var ts; var type = token() === 138 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); parseSemicolon(); var node = factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } // In an ambient declaration, the grammar only allows integer literals as initializers. @@ -37520,7 +37523,7 @@ var ts; members = createMissingList(); } var node = factory.createEnumDeclaration(modifiers, name, members); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseModuleBlock() { @@ -37544,7 +37547,7 @@ var ts; ? parseModuleOrNamespaceDeclaration(getNodePos(), /*hasJSDoc*/ false, /*decorators*/ undefined, /*modifiers*/ undefined, 4 /* NodeFlags.NestedNamespace */ | namespaceFlag) : parseModuleBlock(); var node = factory.createModuleDeclaration(modifiers, name, body, flags); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { @@ -37567,7 +37570,7 @@ var ts; parseSemicolon(); } var node = factory.createModuleDeclaration(modifiers, name, body, flags); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { @@ -37607,7 +37610,7 @@ var ts; parseSemicolon(); var node = factory.createNamespaceExportDeclaration(name); // NamespaceExportDeclaration nodes cannot have decorators or modifiers, so we attach them here so we can report them in the grammar checker - node.decorators = decorators; + node.illegalDecorators = decorators; node.modifiers = modifiers; return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -37647,7 +37650,7 @@ var ts; } parseSemicolon(); var node = factory.createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseAssertEntry() { @@ -37692,7 +37695,7 @@ var ts; var moduleReference = parseModuleReference(); parseSemicolon(); var node = factory.createImportEqualsDeclaration(modifiers, isTypeOnly, identifier, moduleReference); - node.decorators = decorators; + node.illegalDecorators = decorators; var finished = withJSDoc(finishNode(node, pos), hasJSDoc); return finished; } @@ -37882,7 +37885,7 @@ var ts; parseSemicolon(); setAwaitContext(savedAwaitContext); var node = factory.createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseExportAssignment(pos, hasJSDoc, decorators, modifiers) { @@ -37899,7 +37902,7 @@ var ts; parseSemicolon(); setAwaitContext(savedAwaitContext); var node = factory.createExportAssignment(modifiers, isExportEquals, expression); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } var ParsingContext; @@ -43263,10 +43266,12 @@ var ts; if (resolved) { var fileName = resolved.fileName, packageId = resolved.packageId; var resolvedFileName = options.preserveSymlinks ? fileName : realPath(fileName, host, traceEnabled); + var pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host); resolvedTypeReferenceDirective = { primary: primary, - resolvedFileName: resolvedFileName, - originalPath: arePathsEqual(fileName, resolvedFileName, host) ? undefined : fileName, + // If the fileName and realpath are differing only in casing prefer fileName so that we can issue correct errors for casing under forceConsistentCasingInFileNames + resolvedFileName: pathsAreEqual ? fileName : resolvedFileName, + originalPath: pathsAreEqual ? undefined : fileName, packageId: packageId, isExternalLibraryImport: pathContainsNodeModules(fileName), }; @@ -44051,8 +44056,10 @@ var ts; var resolvedValue = resolved_1.value; if (!compilerOptions.preserveSymlinks && resolvedValue && !resolvedValue.originalPath) { var path = realPath(resolvedValue.path, host, traceEnabled); - var originalPath = arePathsEqual(path, resolvedValue.path, host) ? undefined : resolvedValue.path; - resolvedValue = __assign(__assign({}, resolvedValue), { path: path, originalPath: originalPath }); + var pathsAreEqual = arePathsEqual(path, resolvedValue.path, host); + var originalPath = pathsAreEqual ? undefined : resolvedValue.path; + // If the path and realpath are differing only in casing prefer path so that we can issue correct errors for casing under forceConsistentCasingInFileNames + resolvedValue = __assign(__assign({}, resolvedValue), { path: pathsAreEqual ? resolvedValue.path : path, originalPath: originalPath }); } // For node_modules lookups, get the real path so that multiple accesses to an `npm link`-ed module do not create duplicate files. return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } }; @@ -73705,25 +73712,7 @@ var ts; } function getTypeOfPropertyOfContextualType(type, name, nameType) { return mapType(type, function (t) { - if (t.flags & 2097152 /* TypeFlags.Intersection */) { - var intersection = t; - var newTypes = ts.mapDefined(intersection.types, getTypeOfConcretePropertyOfContextualType); - if (newTypes.length > 0) { - return getIntersectionType(newTypes); - } - newTypes = ts.mapDefined(intersection.types, getTypeOfApplicableIndexInfoOfContextualType); - if (newTypes.length > 0) { - return getIntersectionType(newTypes); - } - return undefined; - } - var concretePropertyType = getTypeOfConcretePropertyOfContextualType(t); - if (concretePropertyType) { - return concretePropertyType; - } - return getTypeOfApplicableIndexInfoOfContextualType(t); - }, /*noReductions*/ true); - function getTypeOfConcretePropertyOfContextualType(t) { + var _a; if (isGenericMappedType(t) && !t.declaration.nameType) { var constraint = getConstraintTypeFromMappedType(t); var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint; @@ -73731,9 +73720,8 @@ var ts; if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) { return substituteIndexedMappedType(t, propertyNameType); } - return undefined; } - if (t.flags & 3670016 /* TypeFlags.StructuredType */) { + else if (t.flags & 3670016 /* TypeFlags.StructuredType */) { var prop = getPropertyOfType(t, name); if (prop) { return isCircularMappedProperty(prop) ? undefined : getTypeOfSymbol(prop); @@ -73744,16 +73732,10 @@ var ts; return restType; } } + return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type; } return undefined; - } - function getTypeOfApplicableIndexInfoOfContextualType(t) { - var _a; - if (!(t.flags & 3670016 /* TypeFlags.StructuredType */)) { - return undefined; - } - return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type; - } + }, /*noReductions*/ true); } // In an object literal contextually typed by a type T, the contextual type of a property assignment is the type of // the matching property in T, if one exists. Otherwise, it is the type of the numeric index signature in T, if one @@ -88883,7 +88865,7 @@ var ts; return checkGrammarDecorators(node) || checkGrammarModifiers(node); } function checkGrammarDecorators(node) { - if (ts.canHaveIllegalDecorators(node) && ts.some(node.decorators)) { + if (ts.canHaveIllegalDecorators(node) && ts.some(node.illegalDecorators)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } if (!ts.canHaveDecorators(node) || !ts.hasDecorators(node)) { @@ -171628,9 +171610,9 @@ var ts; // - error: 5.0 var ts; (function (ts) { - var MUST_MERGE = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators have been combined with modifiers. Callers should switch to an overload without a 'decorators' parameter." }; - var DISALLOW_DECORATORS = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators are no longer supported for this function. Callers should switch to an overload without a 'decorators' parameter." }; - var DISALLOW_DECORATORS_AND_MODIFIERS = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators and modifiers are no longer supported for this function. Callers should switch to an overload without the 'decorators' or 'modifiers' parameters." }; + var MUST_MERGE = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators have been combined with modifiers. Callers should switch to an overload that does not accept a 'decorators' parameter." }; + var DISALLOW_DECORATORS = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators are no longer supported for this function. Callers should switch to an overload that does not accept a 'decorators' parameter." }; + var DISALLOW_DECORATORS_AND_MODIFIERS = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators and modifiers are no longer supported for this function. Callers should switch to an overload that does not accept the 'decorators' and 'modifiers' parameters." }; function patchNodeFactory(factory) { var createParameterDeclaration = factory.createParameterDeclaration, updateParameterDeclaration = factory.updateParameterDeclaration, createPropertyDeclaration = factory.createPropertyDeclaration, updatePropertyDeclaration = factory.updatePropertyDeclaration, createMethodDeclaration = factory.createMethodDeclaration, updateMethodDeclaration = factory.updateMethodDeclaration, createConstructorDeclaration = factory.createConstructorDeclaration, updateConstructorDeclaration = factory.updateConstructorDeclaration, createGetAccessorDeclaration = factory.createGetAccessorDeclaration, updateGetAccessorDeclaration = factory.updateGetAccessorDeclaration, createSetAccessorDeclaration = factory.createSetAccessorDeclaration, updateSetAccessorDeclaration = factory.updateSetAccessorDeclaration, createIndexSignature = factory.createIndexSignature, updateIndexSignature = factory.updateIndexSignature, createClassStaticBlockDeclaration = factory.createClassStaticBlockDeclaration, updateClassStaticBlockDeclaration = factory.updateClassStaticBlockDeclaration, createClassExpression = factory.createClassExpression, updateClassExpression = factory.updateClassExpression, createFunctionDeclaration = factory.createFunctionDeclaration, updateFunctionDeclaration = factory.updateFunctionDeclaration, createClassDeclaration = factory.createClassDeclaration, updateClassDeclaration = factory.updateClassDeclaration, createInterfaceDeclaration = factory.createInterfaceDeclaration, updateInterfaceDeclaration = factory.updateInterfaceDeclaration, createTypeAliasDeclaration = factory.createTypeAliasDeclaration, updateTypeAliasDeclaration = factory.updateTypeAliasDeclaration, createEnumDeclaration = factory.createEnumDeclaration, updateEnumDeclaration = factory.updateEnumDeclaration, createModuleDeclaration = factory.createModuleDeclaration, updateModuleDeclaration = factory.updateModuleDeclaration, createImportEqualsDeclaration = factory.createImportEqualsDeclaration, updateImportEqualsDeclaration = factory.updateImportEqualsDeclaration, createImportDeclaration = factory.createImportDeclaration, updateImportDeclaration = factory.updateImportDeclaration, createExportAssignment = factory.createExportAssignment, updateExportAssignment = factory.updateExportAssignment, createExportDeclaration = factory.createExportDeclaration, updateExportDeclaration = factory.updateExportDeclaration; factory.createParameterDeclaration = ts.buildOverload("createParameterDeclaration") @@ -171857,7 +171839,7 @@ var ts; return (decorators === undefined || !ts.some(decorators, ts.isModifier)) && (modifiers === undefined || !ts.some(modifiers, ts.isParameter)) && (parameters === undefined || ts.isArray(parameters)) && - (body === undefined || !ts.isBlock(body)); + (body === undefined || ts.isBlock(body)); }, }) .deprecate({ @@ -171886,7 +171868,7 @@ var ts; return (decorators === undefined || !ts.some(decorators, ts.isModifier)) && (modifiers === undefined || !ts.some(modifiers, ts.isParameter)) && (parameters === undefined || ts.isArray(parameters)) && - (body === undefined || !ts.isBlock(body)); + (body === undefined || ts.isBlock(body)); }, }) .deprecate({ diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index 881dba5f44635..8ef2b40f93c13 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -2469,6 +2469,7 @@ var ts; var currentAssertionLevel = 0 /* AssertionLevel.None */; Debug.currentLogLevel = LogLevel.Warning; Debug.isDebugging = false; + Debug.enableDeprecationWarnings = true; function getTypeScriptVersion() { return typeScriptVersion !== null && typeScriptVersion !== void 0 ? typeScriptVersion : (typeScriptVersion = new ts.Version(ts.version)); } @@ -3092,7 +3093,7 @@ var ts; function createWarningDeprecation(name, errorAfter, since, message) { var hasWrittenDeprecation = false; return function () { - if (!hasWrittenDeprecation) { + if (Debug.enableDeprecationWarnings && !hasWrittenDeprecation) { log.warn(formatDeprecationMessage(name, /*error*/ false, errorAfter, since, message)); hasWrittenDeprecation = true; } @@ -6980,7 +6981,6 @@ var ts; // not actually work. var byteOrderMarkIndicator = "\uFEFF"; function getNodeSystem() { - var _a; var nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[a-zA-Z0-9_\s]+(\.js)?$)/; var _fs = require("fs"); var _path = require("path"); @@ -6990,7 +6990,7 @@ var ts; try { _crypto = require("crypto"); } - catch (_b) { + catch (_a) { _crypto = undefined; } var activeSession; @@ -7001,10 +7001,10 @@ var ts; var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin"; var platform = _os.platform(); var useCaseSensitiveFileNames = isFileSystemCaseSensitive(); - var realpathSync = (_a = _fs.realpathSync.native) !== null && _a !== void 0 ? _a : _fs.realpathSync; + var fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync; var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin"); var getCurrentDirectory = ts.memoize(function () { return process.cwd(); }); - var _c = createSystemWatchFunctions({ + var _b = createSystemWatchFunctions({ pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames), getModifiedTime: getModifiedTime, setTimeout: setTimeout, @@ -7024,7 +7024,7 @@ var ts; defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); }, inodeWatching: isLinuxOrMacOs, sysLog: sysLog, - }), watchFile = _c.watchFile, watchDirectory = _c.watchDirectory; + }), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory; var nodeSystem = { args: process.argv.slice(2), newLine: _os.EOL, @@ -7417,9 +7417,12 @@ var ts; function getDirectories(path) { return getAccessibleFileSystemEntries(path).directories.slice(); } + function fsRealPathHandlingLongPath(path) { + return path.length < 260 ? _fs.realpathSync.native(path) : _fs.realpathSync(path); + } function realpath(path) { try { - return realpathSync(path); + return fsRealpath(path); } catch (_a) { return path; @@ -21347,7 +21350,7 @@ var ts; case 165 /* SyntaxKind.Decorator */: { var parent_2 = node.parent; return ts.canHaveDecorators(parent_2) ? parent_2.modifiers : - ts.canHaveIllegalDecorators(parent_2) ? parent_2.decorators : + ts.canHaveIllegalDecorators(parent_2) ? parent_2.illegalDecorators : undefined; } case 291 /* SyntaxKind.HeritageClause */: @@ -23424,7 +23427,7 @@ var ts; node.body = body; node.transformFlags = propagateChildFlags(body) | 16777216 /* TransformFlags.ContainsClassFields */; // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; node.modifiers = undefined; return node; } @@ -23436,7 +23439,7 @@ var ts; } function finishUpdateClassStaticBlockDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.modifiers = original.modifiers; } return update(updated, original); @@ -23449,7 +23452,7 @@ var ts; /*type*/ undefined, body); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; node.typeParameters = undefined; node.type = undefined; return node; @@ -23464,7 +23467,7 @@ var ts; } function finishUpdateConstructorDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.typeParameters = original.typeParameters; updated.type = original.type; } @@ -25212,7 +25215,7 @@ var ts; } } // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25230,7 +25233,7 @@ var ts; function finishUpdateFunctionDeclaration(updated, original) { if (updated !== original) { // copy children used only for error reporting - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return finishUpdateBaseSignatureDeclaration(updated, original); } @@ -25264,7 +25267,7 @@ var ts; node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25279,7 +25282,7 @@ var ts; } function finishUpdateInterfaceDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25289,7 +25292,7 @@ var ts; node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25303,7 +25306,7 @@ var ts; } function finishUpdateTypeAliasDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25316,7 +25319,7 @@ var ts; 1 /* TransformFlags.ContainsTypeScript */; node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // Enum declarations cannot contain `await` // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25329,7 +25332,7 @@ var ts; } function finishUpdateEnumDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25353,7 +25356,7 @@ var ts; } node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // Module declarations cannot contain `await`. // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25366,7 +25369,7 @@ var ts; } function finishUpdateModuleDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25402,7 +25405,7 @@ var ts; /*modifiers*/ undefined, name); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; node.modifiers = undefined; return node; } @@ -25414,7 +25417,7 @@ var ts; } function finishUpdateNamespaceExportDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.modifiers = original.modifiers; } return update(updated, original); @@ -25429,7 +25432,7 @@ var ts; node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // Import= declaration is always parsed in an Await context // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25443,7 +25446,7 @@ var ts; } function finishUpdateImportEqualsDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25459,7 +25462,7 @@ var ts; propagateChildFlags(node.moduleSpecifier); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25473,7 +25476,7 @@ var ts; } function finishUpdateImportDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25619,7 +25622,7 @@ var ts; node.transformFlags |= propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.expression); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25631,7 +25634,7 @@ var ts; } function finishUpdateExportAssignment(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -25649,7 +25652,7 @@ var ts; propagateChildFlags(node.moduleSpecifier); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; return node; } // @api @@ -25664,7 +25667,7 @@ var ts; } function finishUpdateExportDeclaration(updated, original) { if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; } return update(updated, original); } @@ -26428,7 +26431,7 @@ var ts; propagateChildFlags(node.name) | propagateChildFlags(node.initializer); // The following properties are used only to report grammar errors - node.decorators = undefined; + node.illegalDecorators = undefined; node.modifiers = undefined; node.questionToken = undefined; node.exclamationToken = undefined; @@ -26444,7 +26447,7 @@ var ts; function finishUpdatePropertyAssignment(updated, original) { // copy children used only for error reporting if (updated !== original) { - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.modifiers = original.modifiers; updated.questionToken = original.questionToken; updated.exclamationToken = original.exclamationToken; @@ -26461,7 +26464,7 @@ var ts; 1024 /* TransformFlags.ContainsES2015 */; // The following properties are used only to report grammar errors node.equalsToken = undefined; - node.decorators = undefined; + node.illegalDecorators = undefined; node.modifiers = undefined; node.questionToken = undefined; node.exclamationToken = undefined; @@ -26478,7 +26481,7 @@ var ts; if (updated !== original) { // copy children used only for error reporting updated.equalsToken = original.equalsToken; - updated.decorators = original.decorators; + updated.illegalDecorators = original.illegalDecorators; updated.modifiers = original.modifiers; updated.questionToken = original.questionToken; updated.exclamationToken = original.exclamationToken; @@ -30956,7 +30959,7 @@ var ts; visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || @@ -30986,7 +30989,7 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); case 296 /* SyntaxKind.PropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || @@ -31003,7 +31006,7 @@ var ts; visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 176 /* SyntaxKind.IndexSignature */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || @@ -31041,7 +31044,7 @@ var ts; visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); case 171 /* SyntaxKind.Constructor */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || @@ -31063,7 +31066,7 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.body); case 256 /* SyntaxKind.FunctionDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || @@ -31087,7 +31090,7 @@ var ts; visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.body); case 178 /* SyntaxKind.TypeReference */: @@ -31215,7 +31218,7 @@ var ts; return visitNodes(cbNode, cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); case 237 /* SyntaxKind.VariableStatement */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); case 255 /* SyntaxKind.VariableDeclarationList */: @@ -31286,20 +31289,20 @@ var ts; visitNodes(cbNode, cbNodes, node.heritageClauses) || visitNodes(cbNode, cbNodes, node.members); case 258 /* SyntaxKind.InterfaceDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.heritageClauses) || visitNodes(cbNode, cbNodes, node.members); case 259 /* SyntaxKind.TypeAliasDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNode(cbNode, node.type); case 260 /* SyntaxKind.EnumDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.members); @@ -31307,17 +31310,17 @@ var ts; return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 261 /* SyntaxKind.ModuleDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); case 266 /* SyntaxKind.ImportDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier) || @@ -31331,7 +31334,7 @@ var ts; return visitNode(cbNode, node.name) || visitNode(cbNode, node.value); case 264 /* SyntaxKind.NamespaceExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNode(cbNode, node.name); case 268 /* SyntaxKind.NamespaceImport */: return visitNode(cbNode, node.name); @@ -31341,7 +31344,7 @@ var ts; case 273 /* SyntaxKind.NamedExports */: return visitNodes(cbNode, cbNodes, node.elements); case 272 /* SyntaxKind.ExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier) || @@ -31351,7 +31354,7 @@ var ts; return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); case 271 /* SyntaxKind.ExportAssignment */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.expression); case 223 /* SyntaxKind.TemplateExpression */: @@ -31376,7 +31379,7 @@ var ts; case 277 /* SyntaxKind.ExternalModuleReference */: return visitNode(cbNode, node.expression); case 276 /* SyntaxKind.MissingDeclaration */: - return visitNodes(cbNode, cbNodes, node.decorators) || + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || visitNodes(cbNode, cbNodes, node.modifiers); case 351 /* SyntaxKind.CommaListExpression */: return visitNodes(cbNode, cbNodes, node.elements); @@ -33927,7 +33930,7 @@ var ts; var type = parseTypeAnnotation(); parseTypeMemberSemicolon(); var node = factory.createIndexSignature(modifiers, parameters, type); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parsePropertyOrMethodSignature(pos, hasJSDoc, modifiers) { @@ -36087,7 +36090,7 @@ var ts; node = factory.createPropertyAssignment(name, initializer); } // Decorators, Modifiers, questionToken, and exclamationToken are not supported by property assignments and are reported in the grammar checker - node.decorators = decorators; + node.illegalDecorators = decorators; node.modifiers = modifiers; node.questionToken = questionToken; node.exclamationToken = exclamationToken; @@ -36735,7 +36738,7 @@ var ts; // would follow. For recovery and error reporting purposes, return an incomplete declaration. var missing = createMissingNode(276 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); ts.setTextRangePos(missing, pos); - missing.decorators = decorators; + missing.illegalDecorators = decorators; missing.modifiers = modifiers; return missing; } @@ -36878,7 +36881,7 @@ var ts; parseSemicolon(); var node = factory.createVariableStatement(modifiers, declarationList); // Decorators are not allowed on a variable statement, so we keep track of them to report them in the grammar checker. - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseFunctionDeclaration(pos, hasJSDoc, decorators, modifiers) { @@ -36898,7 +36901,7 @@ var ts; var body = parseFunctionBlockOrSemicolon(isGenerator | isAsync, ts.Diagnostics.or_expected); setAwaitContext(savedAwaitContext); var node = factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseConstructorName() { @@ -36921,7 +36924,7 @@ var ts; var body = parseFunctionBlockOrSemicolon(0 /* SignatureFlags.None */, ts.Diagnostics.or_expected); var node = factory.createConstructorDeclaration(modifiers, parameters, body); // Attach invalid nodes if they exist so that we can report them in the grammar checker. - node.decorators = decorators; + node.illegalDecorators = decorators; node.typeParameters = typeParameters; node.type = type; return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -37037,7 +37040,7 @@ var ts; parseExpectedToken(124 /* SyntaxKind.StaticKeyword */); var body = parseClassStaticBlockBody(); var node = withJSDoc(finishNode(factory.createClassStaticBlockDeclaration(body), pos), hasJSDoc); - node.decorators = decorators; + node.illegalDecorators = decorators; node.modifiers = modifiers; return node; } @@ -37278,7 +37281,7 @@ var ts; var heritageClauses = parseHeritageClauses(); var members = parseObjectTypeMembers(); var node = factory.createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers) { @@ -37289,7 +37292,7 @@ var ts; var type = token() === 138 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); parseSemicolon(); var node = factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } // In an ambient declaration, the grammar only allows integer literals as initializers. @@ -37315,7 +37318,7 @@ var ts; members = createMissingList(); } var node = factory.createEnumDeclaration(modifiers, name, members); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseModuleBlock() { @@ -37339,7 +37342,7 @@ var ts; ? parseModuleOrNamespaceDeclaration(getNodePos(), /*hasJSDoc*/ false, /*decorators*/ undefined, /*modifiers*/ undefined, 4 /* NodeFlags.NestedNamespace */ | namespaceFlag) : parseModuleBlock(); var node = factory.createModuleDeclaration(modifiers, name, body, flags); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { @@ -37362,7 +37365,7 @@ var ts; parseSemicolon(); } var node = factory.createModuleDeclaration(modifiers, name, body, flags); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { @@ -37402,7 +37405,7 @@ var ts; parseSemicolon(); var node = factory.createNamespaceExportDeclaration(name); // NamespaceExportDeclaration nodes cannot have decorators or modifiers, so we attach them here so we can report them in the grammar checker - node.decorators = decorators; + node.illegalDecorators = decorators; node.modifiers = modifiers; return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -37442,7 +37445,7 @@ var ts; } parseSemicolon(); var node = factory.createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseAssertEntry() { @@ -37487,7 +37490,7 @@ var ts; var moduleReference = parseModuleReference(); parseSemicolon(); var node = factory.createImportEqualsDeclaration(modifiers, isTypeOnly, identifier, moduleReference); - node.decorators = decorators; + node.illegalDecorators = decorators; var finished = withJSDoc(finishNode(node, pos), hasJSDoc); return finished; } @@ -37677,7 +37680,7 @@ var ts; parseSemicolon(); setAwaitContext(savedAwaitContext); var node = factory.createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseExportAssignment(pos, hasJSDoc, decorators, modifiers) { @@ -37694,7 +37697,7 @@ var ts; parseSemicolon(); setAwaitContext(savedAwaitContext); var node = factory.createExportAssignment(modifiers, isExportEquals, expression); - node.decorators = decorators; + node.illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } var ParsingContext; @@ -43058,10 +43061,12 @@ var ts; if (resolved) { var fileName = resolved.fileName, packageId = resolved.packageId; var resolvedFileName = options.preserveSymlinks ? fileName : realPath(fileName, host, traceEnabled); + var pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host); resolvedTypeReferenceDirective = { primary: primary, - resolvedFileName: resolvedFileName, - originalPath: arePathsEqual(fileName, resolvedFileName, host) ? undefined : fileName, + // If the fileName and realpath are differing only in casing prefer fileName so that we can issue correct errors for casing under forceConsistentCasingInFileNames + resolvedFileName: pathsAreEqual ? fileName : resolvedFileName, + originalPath: pathsAreEqual ? undefined : fileName, packageId: packageId, isExternalLibraryImport: pathContainsNodeModules(fileName), }; @@ -43846,8 +43851,10 @@ var ts; var resolvedValue = resolved_1.value; if (!compilerOptions.preserveSymlinks && resolvedValue && !resolvedValue.originalPath) { var path = realPath(resolvedValue.path, host, traceEnabled); - var originalPath = arePathsEqual(path, resolvedValue.path, host) ? undefined : resolvedValue.path; - resolvedValue = __assign(__assign({}, resolvedValue), { path: path, originalPath: originalPath }); + var pathsAreEqual = arePathsEqual(path, resolvedValue.path, host); + var originalPath = pathsAreEqual ? undefined : resolvedValue.path; + // If the path and realpath are differing only in casing prefer path so that we can issue correct errors for casing under forceConsistentCasingInFileNames + resolvedValue = __assign(__assign({}, resolvedValue), { path: pathsAreEqual ? resolvedValue.path : path, originalPath: originalPath }); } // For node_modules lookups, get the real path so that multiple accesses to an `npm link`-ed module do not create duplicate files. return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } }; @@ -73500,25 +73507,7 @@ var ts; } function getTypeOfPropertyOfContextualType(type, name, nameType) { return mapType(type, function (t) { - if (t.flags & 2097152 /* TypeFlags.Intersection */) { - var intersection = t; - var newTypes = ts.mapDefined(intersection.types, getTypeOfConcretePropertyOfContextualType); - if (newTypes.length > 0) { - return getIntersectionType(newTypes); - } - newTypes = ts.mapDefined(intersection.types, getTypeOfApplicableIndexInfoOfContextualType); - if (newTypes.length > 0) { - return getIntersectionType(newTypes); - } - return undefined; - } - var concretePropertyType = getTypeOfConcretePropertyOfContextualType(t); - if (concretePropertyType) { - return concretePropertyType; - } - return getTypeOfApplicableIndexInfoOfContextualType(t); - }, /*noReductions*/ true); - function getTypeOfConcretePropertyOfContextualType(t) { + var _a; if (isGenericMappedType(t) && !t.declaration.nameType) { var constraint = getConstraintTypeFromMappedType(t); var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint; @@ -73526,9 +73515,8 @@ var ts; if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) { return substituteIndexedMappedType(t, propertyNameType); } - return undefined; } - if (t.flags & 3670016 /* TypeFlags.StructuredType */) { + else if (t.flags & 3670016 /* TypeFlags.StructuredType */) { var prop = getPropertyOfType(t, name); if (prop) { return isCircularMappedProperty(prop) ? undefined : getTypeOfSymbol(prop); @@ -73539,16 +73527,10 @@ var ts; return restType; } } + return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type; } return undefined; - } - function getTypeOfApplicableIndexInfoOfContextualType(t) { - var _a; - if (!(t.flags & 3670016 /* TypeFlags.StructuredType */)) { - return undefined; - } - return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type; - } + }, /*noReductions*/ true); } // In an object literal contextually typed by a type T, the contextual type of a property assignment is the type of // the matching property in T, if one exists. Otherwise, it is the type of the numeric index signature in T, if one @@ -88678,7 +88660,7 @@ var ts; return checkGrammarDecorators(node) || checkGrammarModifiers(node); } function checkGrammarDecorators(node) { - if (ts.canHaveIllegalDecorators(node) && ts.some(node.decorators)) { + if (ts.canHaveIllegalDecorators(node) && ts.some(node.illegalDecorators)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } if (!ts.canHaveDecorators(node) || !ts.hasDecorators(node)) {