typescript 5.1.0-dev.20230315 → 5.1.0-dev.20230317
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +88 -76
- package/lib/tsserver.js +116 -100
- package/lib/tsserverlibrary.js +113 -99
- package/lib/typescript.js +89 -78
- package/lib/typingsInstaller.js +13 -34
- package/package.json +3 -3
package/lib/tsserver.js
CHANGED
|
@@ -2285,7 +2285,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2285
2285
|
|
|
2286
2286
|
// src/compiler/corePublic.ts
|
|
2287
2287
|
var versionMajorMinor = "5.1";
|
|
2288
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2288
|
+
var version = `${versionMajorMinor}.0-dev.20230317`;
|
|
2289
2289
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2290
2290
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2291
2291
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -5303,28 +5303,6 @@ function tryGetNativePerformanceHooks() {
|
|
|
5303
5303
|
var timestamp = nativePerformance ? () => nativePerformance.now() : Date.now ? Date.now : () => +/* @__PURE__ */ new Date();
|
|
5304
5304
|
|
|
5305
5305
|
// src/compiler/perfLogger.ts
|
|
5306
|
-
var nullLogger = {
|
|
5307
|
-
logEvent: noop,
|
|
5308
|
-
logErrEvent: noop,
|
|
5309
|
-
logPerfEvent: noop,
|
|
5310
|
-
logInfoEvent: noop,
|
|
5311
|
-
logStartCommand: noop,
|
|
5312
|
-
logStopCommand: noop,
|
|
5313
|
-
logStartUpdateProgram: noop,
|
|
5314
|
-
logStopUpdateProgram: noop,
|
|
5315
|
-
logStartUpdateGraph: noop,
|
|
5316
|
-
logStopUpdateGraph: noop,
|
|
5317
|
-
logStartResolveModule: noop,
|
|
5318
|
-
logStopResolveModule: noop,
|
|
5319
|
-
logStartParseSourceFile: noop,
|
|
5320
|
-
logStopParseSourceFile: noop,
|
|
5321
|
-
logStartReadFile: noop,
|
|
5322
|
-
logStopReadFile: noop,
|
|
5323
|
-
logStartBindFile: noop,
|
|
5324
|
-
logStopBindFile: noop,
|
|
5325
|
-
logStartScheduledOperation: noop,
|
|
5326
|
-
logStopScheduledOperation: noop
|
|
5327
|
-
};
|
|
5328
5306
|
var etwModule;
|
|
5329
5307
|
var _a;
|
|
5330
5308
|
try {
|
|
@@ -5333,7 +5311,7 @@ try {
|
|
|
5333
5311
|
} catch (e) {
|
|
5334
5312
|
etwModule = void 0;
|
|
5335
5313
|
}
|
|
5336
|
-
var perfLogger = (etwModule == null ? void 0 : etwModule.logEvent) ? etwModule :
|
|
5314
|
+
var perfLogger = (etwModule == null ? void 0 : etwModule.logEvent) ? etwModule : void 0;
|
|
5337
5315
|
|
|
5338
5316
|
// src/compiler/_namespaces/ts.performance.ts
|
|
5339
5317
|
var ts_performance_exports = {};
|
|
@@ -8614,13 +8592,15 @@ var sys = (() => {
|
|
|
8614
8592
|
return buffer.toString("utf8");
|
|
8615
8593
|
}
|
|
8616
8594
|
function readFile(fileName, _encoding) {
|
|
8617
|
-
|
|
8595
|
+
var _a2, _b;
|
|
8596
|
+
(_a2 = perfLogger) == null ? void 0 : _a2.logStartReadFile(fileName);
|
|
8618
8597
|
const file = readFileWorker(fileName, _encoding);
|
|
8619
|
-
perfLogger.logStopReadFile();
|
|
8598
|
+
(_b = perfLogger) == null ? void 0 : _b.logStopReadFile();
|
|
8620
8599
|
return file;
|
|
8621
8600
|
}
|
|
8622
8601
|
function writeFile2(fileName, data, writeByteOrderMark) {
|
|
8623
|
-
|
|
8602
|
+
var _a2;
|
|
8603
|
+
(_a2 = perfLogger) == null ? void 0 : _a2.logEvent("WriteFile: " + fileName);
|
|
8624
8604
|
if (writeByteOrderMark) {
|
|
8625
8605
|
data = byteOrderMarkIndicator + data;
|
|
8626
8606
|
}
|
|
@@ -8641,7 +8621,8 @@ var sys = (() => {
|
|
|
8641
8621
|
}
|
|
8642
8622
|
}
|
|
8643
8623
|
function getAccessibleFileSystemEntries(path) {
|
|
8644
|
-
|
|
8624
|
+
var _a2;
|
|
8625
|
+
(_a2 = perfLogger) == null ? void 0 : _a2.logEvent("ReadDir: " + (path || "."));
|
|
8645
8626
|
try {
|
|
8646
8627
|
const entries = _fs.readdirSync(path || ".", { withFileTypes: true });
|
|
8647
8628
|
const files = [];
|
|
@@ -30259,7 +30240,7 @@ function setExternalModuleIndicator(sourceFile) {
|
|
|
30259
30240
|
sourceFile.externalModuleIndicator = isFileProbablyExternalModule(sourceFile);
|
|
30260
30241
|
}
|
|
30261
30242
|
function createSourceFile(fileName, sourceText, languageVersionOrOptions, setParentNodes = false, scriptKind) {
|
|
30262
|
-
var _a2, _b;
|
|
30243
|
+
var _a2, _b, _c, _d;
|
|
30263
30244
|
(_a2 = tracing) == null ? void 0 : _a2.push(
|
|
30264
30245
|
tracing.Phase.Parse,
|
|
30265
30246
|
"createSourceFile",
|
|
@@ -30269,7 +30250,7 @@ function createSourceFile(fileName, sourceText, languageVersionOrOptions, setPar
|
|
|
30269
30250
|
);
|
|
30270
30251
|
mark("beforeParse");
|
|
30271
30252
|
let result;
|
|
30272
|
-
perfLogger.logStartParseSourceFile(fileName);
|
|
30253
|
+
(_b = perfLogger) == null ? void 0 : _b.logStartParseSourceFile(fileName);
|
|
30273
30254
|
const {
|
|
30274
30255
|
languageVersion,
|
|
30275
30256
|
setExternalModuleIndicator: overrideSetExternalModuleIndicator,
|
|
@@ -30302,10 +30283,10 @@ function createSourceFile(fileName, sourceText, languageVersionOrOptions, setPar
|
|
|
30302
30283
|
setIndicator
|
|
30303
30284
|
);
|
|
30304
30285
|
}
|
|
30305
|
-
perfLogger.logStopParseSourceFile();
|
|
30286
|
+
(_c = perfLogger) == null ? void 0 : _c.logStopParseSourceFile();
|
|
30306
30287
|
mark("afterParse");
|
|
30307
30288
|
measure("Parse", "beforeParse", "afterParse");
|
|
30308
|
-
(
|
|
30289
|
+
(_d = tracing) == null ? void 0 : _d.pop();
|
|
30309
30290
|
return result;
|
|
30310
30291
|
}
|
|
30311
30292
|
function parseIsolatedEntityName(text, languageVersion) {
|
|
@@ -41596,6 +41577,7 @@ function resolveModuleNameFromCache(moduleName, containingFile, cache, mode) {
|
|
|
41596
41577
|
);
|
|
41597
41578
|
}
|
|
41598
41579
|
function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
41580
|
+
var _a2, _b, _c;
|
|
41599
41581
|
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
41600
41582
|
if (redirectedReference) {
|
|
41601
41583
|
compilerOptions = redirectedReference.commandLine.options;
|
|
@@ -41637,10 +41619,7 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
|
|
|
41637
41619
|
trace(host, Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ModuleResolutionKind[moduleResolution]);
|
|
41638
41620
|
}
|
|
41639
41621
|
}
|
|
41640
|
-
perfLogger.logStartResolveModule(
|
|
41641
|
-
moduleName
|
|
41642
|
-
/* , containingFile, ModuleResolutionKind[moduleResolution]*/
|
|
41643
|
-
);
|
|
41622
|
+
(_a2 = perfLogger) == null ? void 0 : _a2.logStartResolveModule(moduleName);
|
|
41644
41623
|
switch (moduleResolution) {
|
|
41645
41624
|
case 3 /* Node16 */:
|
|
41646
41625
|
result = node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
@@ -41661,8 +41640,8 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
|
|
|
41661
41640
|
return Debug.fail(`Unexpected moduleResolution: ${moduleResolution}`);
|
|
41662
41641
|
}
|
|
41663
41642
|
if (result && result.resolvedModule)
|
|
41664
|
-
perfLogger.logInfoEvent(`Module "${moduleName}" resolved to "${result.resolvedModule.resolvedFileName}"`);
|
|
41665
|
-
perfLogger.logStopResolveModule(result && result.resolvedModule ? "" + result.resolvedModule.resolvedFileName : "null");
|
|
41643
|
+
(_b = perfLogger) == null ? void 0 : _b.logInfoEvent(`Module "${moduleName}" resolved to "${result.resolvedModule.resolvedFileName}"`);
|
|
41644
|
+
(_c = perfLogger) == null ? void 0 : _c.logStopResolveModule(result && result.resolvedModule ? "" + result.resolvedModule.resolvedFileName : "null");
|
|
41666
41645
|
cache == null ? void 0 : cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(moduleName, resolutionMode, result);
|
|
41667
41646
|
if (!isExternalModuleNameRelative(moduleName)) {
|
|
41668
41647
|
cache == null ? void 0 : cache.getOrCreateCacheForNonRelativeName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
@@ -43433,10 +43412,11 @@ function initFlowNode(node) {
|
|
|
43433
43412
|
}
|
|
43434
43413
|
var binder = /* @__PURE__ */ createBinder();
|
|
43435
43414
|
function bindSourceFile(file, options) {
|
|
43415
|
+
var _a2, _b;
|
|
43436
43416
|
mark("beforeBind");
|
|
43437
|
-
perfLogger.logStartBindFile("" + file.fileName);
|
|
43417
|
+
(_a2 = perfLogger) == null ? void 0 : _a2.logStartBindFile("" + file.fileName);
|
|
43438
43418
|
binder(file, options);
|
|
43439
|
-
perfLogger.logStopBindFile();
|
|
43419
|
+
(_b = perfLogger) == null ? void 0 : _b.logStopBindFile();
|
|
43440
43420
|
mark("afterBind");
|
|
43441
43421
|
measure("Bind", "beforeBind", "afterBind");
|
|
43442
43422
|
}
|
|
@@ -50566,6 +50546,10 @@ function createTypeChecker(host) {
|
|
|
50566
50546
|
return;
|
|
50567
50547
|
merged.exports.set(name, merged.exports.has(name) ? mergeSymbol(merged.exports.get(name), s) : s);
|
|
50568
50548
|
});
|
|
50549
|
+
if (merged === exported) {
|
|
50550
|
+
getSymbolLinks(merged).resolvedExports = void 0;
|
|
50551
|
+
getSymbolLinks(merged).resolvedMembers = void 0;
|
|
50552
|
+
}
|
|
50569
50553
|
getSymbolLinks(merged).cjsExportMerged = merged;
|
|
50570
50554
|
return links.cjsExportMerged = merged;
|
|
50571
50555
|
}
|
|
@@ -50599,7 +50583,7 @@ function createTypeChecker(host) {
|
|
|
50599
50583
|
/*skipObjectFunctionPropertyAugment*/
|
|
50600
50584
|
true
|
|
50601
50585
|
) || isEsmCjsRef) {
|
|
50602
|
-
const moduleType = getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol, reference);
|
|
50586
|
+
const moduleType = type.flags & 3670016 /* StructuredType */ ? getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol, reference) : createDefaultPropertyWrapperForModule(symbol, symbol.parent);
|
|
50603
50587
|
return cloneTypeAsModuleType(symbol, moduleType, referenceParent);
|
|
50604
50588
|
}
|
|
50605
50589
|
}
|
|
@@ -54019,7 +54003,8 @@ function createTypeChecker(host) {
|
|
|
54019
54003
|
), modifierFlags);
|
|
54020
54004
|
}
|
|
54021
54005
|
function getNamespaceMembersForSerialization(symbol) {
|
|
54022
|
-
|
|
54006
|
+
const exports = getExportsOfSymbol(symbol);
|
|
54007
|
+
return !exports ? [] : filter(arrayFrom(exports.values()), (m) => isNamespaceMember(m) && isIdentifierText(m.escapedName, 99 /* ESNext */));
|
|
54023
54008
|
}
|
|
54024
54009
|
function isTypeOnlyNamespace(symbol) {
|
|
54025
54010
|
return every(getNamespaceMembersForSerialization(symbol), (m) => !(getAllSymbolFlags(resolveSymbol(m)) & 111551 /* Value */));
|
|
@@ -57822,9 +57807,10 @@ function createTypeChecker(host) {
|
|
|
57822
57807
|
setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, emptyArray);
|
|
57823
57808
|
const typeParameter = getTypeParameterFromMappedType(type);
|
|
57824
57809
|
const constraintType = getConstraintTypeFromMappedType(type);
|
|
57825
|
-
const
|
|
57826
|
-
const
|
|
57827
|
-
const
|
|
57810
|
+
const mappedType = type.target || type;
|
|
57811
|
+
const nameType = getNameTypeFromMappedType(mappedType);
|
|
57812
|
+
const shouldLinkPropDeclarations = !nameType || isFilteringMappedType(mappedType);
|
|
57813
|
+
const templateType = getTemplateTypeFromMappedType(mappedType);
|
|
57828
57814
|
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
57829
57815
|
const templateModifiers = getMappedTypeModifiers(type);
|
|
57830
57816
|
const include = keyofStringsOnly ? 128 /* StringLiteral */ : 8576 /* StringOrNumberLiteralOrUnique */;
|
|
@@ -57861,7 +57847,7 @@ function createTypeChecker(host) {
|
|
|
57861
57847
|
prop.links.keyType = keyType;
|
|
57862
57848
|
if (modifiersProp) {
|
|
57863
57849
|
prop.links.syntheticOrigin = modifiersProp;
|
|
57864
|
-
prop.declarations =
|
|
57850
|
+
prop.declarations = shouldLinkPropDeclarations ? modifiersProp.declarations : void 0;
|
|
57865
57851
|
}
|
|
57866
57852
|
members.set(propName, prop);
|
|
57867
57853
|
}
|
|
@@ -57967,6 +57953,10 @@ function createTypeChecker(host) {
|
|
|
57967
57953
|
}
|
|
57968
57954
|
return false;
|
|
57969
57955
|
}
|
|
57956
|
+
function isFilteringMappedType(type) {
|
|
57957
|
+
const nameType = getNameTypeFromMappedType(type);
|
|
57958
|
+
return !!nameType && isTypeAssignableTo(nameType, getTypeParameterFromMappedType(type));
|
|
57959
|
+
}
|
|
57970
57960
|
function resolveStructuredTypeMembers(type) {
|
|
57971
57961
|
if (!type.members) {
|
|
57972
57962
|
if (type.flags & 524288 /* Object */) {
|
|
@@ -58326,7 +58316,7 @@ function createTypeChecker(host) {
|
|
|
58326
58316
|
const typeVariable = getHomomorphicTypeVariable(type);
|
|
58327
58317
|
if (typeVariable && !type.declaration.nameType) {
|
|
58328
58318
|
const constraint = getConstraintOfTypeParameter(typeVariable);
|
|
58329
|
-
if (constraint &&
|
|
58319
|
+
if (constraint && isArrayType(constraint)) {
|
|
58330
58320
|
return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper));
|
|
58331
58321
|
}
|
|
58332
58322
|
}
|
|
@@ -61506,8 +61496,7 @@ function createTypeChecker(host) {
|
|
|
61506
61496
|
}
|
|
61507
61497
|
}
|
|
61508
61498
|
if (isGenericMappedType(objectType)) {
|
|
61509
|
-
|
|
61510
|
-
if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) {
|
|
61499
|
+
if (!getNameTypeFromMappedType(objectType) || isFilteringMappedType(objectType)) {
|
|
61511
61500
|
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), (t) => getSimplifiedType(t, writing));
|
|
61512
61501
|
}
|
|
61513
61502
|
}
|
|
@@ -63243,8 +63232,20 @@ function createTypeChecker(host) {
|
|
|
63243
63232
|
return result;
|
|
63244
63233
|
}
|
|
63245
63234
|
const moreThanOneRealChildren = length(validChildren) > 1;
|
|
63246
|
-
|
|
63247
|
-
|
|
63235
|
+
let arrayLikeTargetParts;
|
|
63236
|
+
let nonArrayLikeTargetParts;
|
|
63237
|
+
const iterableType = getGlobalIterableType(
|
|
63238
|
+
/*reportErrors*/
|
|
63239
|
+
false
|
|
63240
|
+
);
|
|
63241
|
+
if (iterableType !== emptyGenericType) {
|
|
63242
|
+
const anyIterable = createIterableType(anyType);
|
|
63243
|
+
arrayLikeTargetParts = filterType(childrenTargetType, (t) => isTypeAssignableTo(t, anyIterable));
|
|
63244
|
+
nonArrayLikeTargetParts = filterType(childrenTargetType, (t) => !isTypeAssignableTo(t, anyIterable));
|
|
63245
|
+
} else {
|
|
63246
|
+
arrayLikeTargetParts = filterType(childrenTargetType, isArrayOrTupleLikeType);
|
|
63247
|
+
nonArrayLikeTargetParts = filterType(childrenTargetType, (t) => !isArrayOrTupleLikeType(t));
|
|
63248
|
+
}
|
|
63248
63249
|
if (moreThanOneRealChildren) {
|
|
63249
63250
|
if (arrayLikeTargetParts !== neverType) {
|
|
63250
63251
|
const realSource = createTupleType(checkJsxChildren(containingElement, 0 /* Normal */));
|
|
@@ -66524,13 +66525,6 @@ function createTypeChecker(host) {
|
|
|
66524
66525
|
function isArrayOrTupleLikeType(type) {
|
|
66525
66526
|
return isArrayLikeType(type) || isTupleLikeType(type);
|
|
66526
66527
|
}
|
|
66527
|
-
function isAssignableToAvailableAnyIterable(type) {
|
|
66528
|
-
const anyIterable = getGlobalIterableType(
|
|
66529
|
-
/*reportErrors*/
|
|
66530
|
-
false
|
|
66531
|
-
) !== emptyGenericType && createIterableType(anyType);
|
|
66532
|
-
return anyIterable ? isTypeAssignableTo(type, anyIterable) : isArrayOrTupleLikeType(type);
|
|
66533
|
-
}
|
|
66534
66528
|
function getTupleElementType(type, index) {
|
|
66535
66529
|
const propType = getTypeOfPropertyOfType(type, "" + index);
|
|
66536
66530
|
if (propType) {
|
|
@@ -71128,7 +71122,7 @@ function createTypeChecker(host) {
|
|
|
71128
71122
|
return void 0;
|
|
71129
71123
|
}
|
|
71130
71124
|
}
|
|
71131
|
-
return isInJSFile(decl2) ? void 0 : getTypeOfExpression(binaryExpression.left);
|
|
71125
|
+
return isInJSFile(decl2) || decl2 === binaryExpression.left ? void 0 : getTypeOfExpression(binaryExpression.left);
|
|
71132
71126
|
}
|
|
71133
71127
|
case 1 /* ExportsProperty */:
|
|
71134
71128
|
case 6 /* Prototype */:
|
|
@@ -71284,7 +71278,7 @@ function createTypeChecker(host) {
|
|
|
71284
71278
|
return void 0;
|
|
71285
71279
|
}
|
|
71286
71280
|
function getContextualTypeForElementExpression(arrayContextualType, index) {
|
|
71287
|
-
return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(
|
|
71281
|
+
return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
|
|
71288
71282
|
arrayContextualType,
|
|
71289
71283
|
(t) => isTupleType(t) ? getElementTypeOfSliceOfTupleType(
|
|
71290
71284
|
t,
|
|
@@ -72026,7 +72020,7 @@ function createTypeChecker(host) {
|
|
|
72026
72020
|
const inConstContext = isConstContext(node);
|
|
72027
72021
|
const checkFlags = inConstContext ? 8 /* Readonly */ : 0;
|
|
72028
72022
|
const isInJavascript = isInJSFile(node) && !isInJsonFile(node);
|
|
72029
|
-
const enumTag = getJSDocEnumTag(node);
|
|
72023
|
+
const enumTag = isInJavascript ? getJSDocEnumTag(node) : void 0;
|
|
72030
72024
|
const isJSObjectLiteral = !contextualType && isInJavascript && !enumTag;
|
|
72031
72025
|
let objectFlags = freshObjectLiteralFlag;
|
|
72032
72026
|
let patternWithComputedProperties = false;
|
|
@@ -72252,7 +72246,7 @@ function createTypeChecker(host) {
|
|
|
72252
72246
|
}
|
|
72253
72247
|
function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) {
|
|
72254
72248
|
const attributes = openingLikeElement.attributes;
|
|
72255
|
-
const
|
|
72249
|
+
const contextualType = getContextualType2(attributes, 0 /* None */);
|
|
72256
72250
|
const allAttributesTable = strictNullChecks ? createSymbolTable() : void 0;
|
|
72257
72251
|
let attributesTable = createSymbolTable();
|
|
72258
72252
|
let spread = emptyJsxObjectType;
|
|
@@ -72279,12 +72273,18 @@ function createTypeChecker(host) {
|
|
|
72279
72273
|
if (attributeDecl.name.escapedText === jsxChildrenPropertyName) {
|
|
72280
72274
|
explicitlySpecifyChildrenAttribute = true;
|
|
72281
72275
|
}
|
|
72282
|
-
if (
|
|
72283
|
-
const prop = getPropertyOfType(
|
|
72276
|
+
if (contextualType) {
|
|
72277
|
+
const prop = getPropertyOfType(contextualType, member.escapedName);
|
|
72284
72278
|
if (prop && prop.declarations && isDeprecatedSymbol(prop)) {
|
|
72285
72279
|
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
72286
72280
|
}
|
|
72287
72281
|
}
|
|
72282
|
+
if (contextualType && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) {
|
|
72283
|
+
const inferenceContext = getInferenceContext(attributes);
|
|
72284
|
+
Debug.assert(inferenceContext);
|
|
72285
|
+
const inferenceNode = attributeDecl.initializer.expression;
|
|
72286
|
+
addIntraExpressionInferenceSite(inferenceContext, inferenceNode, exprType);
|
|
72287
|
+
}
|
|
72288
72288
|
} else {
|
|
72289
72289
|
Debug.assert(attributeDecl.kind === 291 /* JsxSpreadAttribute */);
|
|
72290
72290
|
if (attributesTable.size > 0) {
|
|
@@ -72339,12 +72339,12 @@ function createTypeChecker(host) {
|
|
|
72339
72339
|
if (explicitlySpecifyChildrenAttribute) {
|
|
72340
72340
|
error(attributes, Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, unescapeLeadingUnderscores(jsxChildrenPropertyName));
|
|
72341
72341
|
}
|
|
72342
|
-
const
|
|
72342
|
+
const contextualType2 = getApparentTypeOfContextualType(
|
|
72343
72343
|
openingLikeElement.attributes,
|
|
72344
72344
|
/*contextFlags*/
|
|
72345
72345
|
void 0
|
|
72346
72346
|
);
|
|
72347
|
-
const childrenContextualType =
|
|
72347
|
+
const childrenContextualType = contextualType2 && getTypeOfPropertyOfContextualType(contextualType2, jsxChildrenPropertyName);
|
|
72348
72348
|
const childrenPropSymbol = createSymbol(4 /* Property */, jsxChildrenPropertyName);
|
|
72349
72349
|
childrenPropSymbol.links.type = childrenTypes.length === 1 ? childrenTypes[0] : childrenContextualType && someType(childrenContextualType, isTupleLikeType) ? createTupleType(childrenTypes) : createArrayType(getUnionType(childrenTypes));
|
|
72350
72350
|
childrenPropSymbol.valueDeclaration = factory.createPropertySignature(
|
|
@@ -76777,6 +76777,11 @@ function createTypeChecker(host) {
|
|
|
76777
76777
|
} else {
|
|
76778
76778
|
assignNonContextualParameterTypes(signature);
|
|
76779
76779
|
}
|
|
76780
|
+
} else if (contextualSignature && !node.typeParameters && contextualSignature.parameters.length > node.parameters.length) {
|
|
76781
|
+
const inferenceContext = getInferenceContext(node);
|
|
76782
|
+
if (checkMode && checkMode & 2 /* Inferential */) {
|
|
76783
|
+
inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
|
|
76784
|
+
}
|
|
76780
76785
|
}
|
|
76781
76786
|
if (contextualSignature && !getReturnTypeFromAnnotation(node) && !signature.resolvedReturnType) {
|
|
76782
76787
|
const returnType = getReturnTypeFromBody(node, checkMode);
|
|
@@ -95907,8 +95912,11 @@ function transformESDecorators(context) {
|
|
|
95907
95912
|
false,
|
|
95908
95913
|
visitor
|
|
95909
95914
|
);
|
|
95915
|
+
const superStatementIndex = findSuperStatementIndex(node.body.statements, nonPrologueStart);
|
|
95916
|
+
const indexOfFirstStatementAfterSuper = superStatementIndex >= 0 ? superStatementIndex + 1 : void 0;
|
|
95917
|
+
addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, nonPrologueStart, indexOfFirstStatementAfterSuper ? indexOfFirstStatementAfterSuper - nonPrologueStart : void 0));
|
|
95910
95918
|
addRange(statements, initializerStatements);
|
|
95911
|
-
addRange(statements, visitNodes2(node.body.statements, visitor, isStatement,
|
|
95919
|
+
addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, indexOfFirstStatementAfterSuper));
|
|
95912
95920
|
body = factory2.createBlock(
|
|
95913
95921
|
statements,
|
|
95914
95922
|
/*multiLine*/
|
|
@@ -108700,7 +108708,7 @@ function transformNodeModule(context) {
|
|
|
108700
108708
|
|
|
108701
108709
|
// src/compiler/transformers/declarations/diagnostics.ts
|
|
108702
108710
|
function canProduceDiagnostics(node) {
|
|
108703
|
-
return isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isBindingElement(node) || isSetAccessor(node) || isGetAccessor(node) || isConstructSignatureDeclaration(node) || isCallSignatureDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isFunctionDeclaration(node) || isParameter(node) || isTypeParameterDeclaration(node) || isExpressionWithTypeArguments(node) || isImportEqualsDeclaration(node) || isTypeAliasDeclaration(node) || isConstructorDeclaration(node) || isIndexSignatureDeclaration(node) || isPropertyAccessExpression(node) || isJSDocTypeAlias(node);
|
|
108711
|
+
return isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isBindingElement(node) || isSetAccessor(node) || isGetAccessor(node) || isConstructSignatureDeclaration(node) || isCallSignatureDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isFunctionDeclaration(node) || isParameter(node) || isTypeParameterDeclaration(node) || isExpressionWithTypeArguments(node) || isImportEqualsDeclaration(node) || isTypeAliasDeclaration(node) || isConstructorDeclaration(node) || isIndexSignatureDeclaration(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node) || isBinaryExpression(node) || isJSDocTypeAlias(node);
|
|
108704
108712
|
}
|
|
108705
108713
|
function createGetSymbolAccessibilityDiagnosticForNodeName(node) {
|
|
108706
108714
|
if (isSetAccessor(node) || isGetAccessor(node)) {
|
|
@@ -108746,7 +108754,7 @@ function createGetSymbolAccessibilityDiagnosticForNodeName(node) {
|
|
|
108746
108754
|
}
|
|
108747
108755
|
}
|
|
108748
108756
|
function createGetSymbolAccessibilityDiagnosticForNode(node) {
|
|
108749
|
-
if (isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isPropertyAccessExpression(node) || isBindingElement(node) || isConstructorDeclaration(node)) {
|
|
108757
|
+
if (isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node) || isBinaryExpression(node) || isBindingElement(node) || isConstructorDeclaration(node)) {
|
|
108750
108758
|
return getVariableDeclarationTypeVisibilityError;
|
|
108751
108759
|
} else if (isSetAccessor(node) || isGetAccessor(node)) {
|
|
108752
108760
|
return getAccessorDeclarationTypeVisibilityError;
|
|
@@ -108771,7 +108779,7 @@ function createGetSymbolAccessibilityDiagnosticForNode(node) {
|
|
|
108771
108779
|
function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
|
|
108772
108780
|
if (node.kind === 258 /* VariableDeclaration */ || node.kind === 206 /* BindingElement */) {
|
|
108773
108781
|
return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Exported_variable_0_has_or_is_using_private_name_1;
|
|
108774
|
-
} else if (node.kind === 170 /* PropertyDeclaration */ || node.kind === 209 /* PropertyAccessExpression */ || node.kind === 169 /* PropertySignature */ || node.kind === 167 /* Parameter */ && hasSyntacticModifier(node.parent, 8 /* Private */)) {
|
|
108782
|
+
} else if (node.kind === 170 /* PropertyDeclaration */ || node.kind === 209 /* PropertyAccessExpression */ || node.kind === 210 /* ElementAccessExpression */ || node.kind === 224 /* BinaryExpression */ || node.kind === 169 /* PropertySignature */ || node.kind === 167 /* Parameter */ && hasSyntacticModifier(node.parent, 8 /* Private */)) {
|
|
108775
108783
|
if (isStatic(node)) {
|
|
108776
108784
|
return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
|
|
108777
108785
|
} else if (node.parent.kind === 261 /* ClassDeclaration */ || node.kind === 167 /* Parameter */) {
|
|
@@ -110224,13 +110232,16 @@ function transformDeclarations(context) {
|
|
|
110224
110232
|
fakespace.symbol = props[0].parent;
|
|
110225
110233
|
const exportMappings = [];
|
|
110226
110234
|
let declarations = mapDefined(props, (p) => {
|
|
110227
|
-
if (!p.valueDeclaration || !isPropertyAccessExpression(p.valueDeclaration)) {
|
|
110235
|
+
if (!p.valueDeclaration || !(isPropertyAccessExpression(p.valueDeclaration) || isElementAccessExpression(p.valueDeclaration) || isBinaryExpression(p.valueDeclaration))) {
|
|
110236
|
+
return void 0;
|
|
110237
|
+
}
|
|
110238
|
+
const nameStr = unescapeLeadingUnderscores(p.escapedName);
|
|
110239
|
+
if (!isIdentifierText(nameStr, 99 /* ESNext */)) {
|
|
110228
110240
|
return void 0;
|
|
110229
110241
|
}
|
|
110230
110242
|
getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(p.valueDeclaration);
|
|
110231
110243
|
const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags, symbolTracker);
|
|
110232
110244
|
getSymbolAccessibilityDiagnostic = oldDiag;
|
|
110233
|
-
const nameStr = unescapeLeadingUnderscores(p.escapedName);
|
|
110234
110245
|
const isNonContextualKeywordName = isStringANonContextualKeyword(nameStr);
|
|
110235
110246
|
const name = isNonContextualKeywordName ? factory2.getGeneratedNameForNode(p.valueDeclaration) : factory2.createIdentifier(nameStr);
|
|
110236
110247
|
if (isNonContextualKeywordName) {
|
|
@@ -124620,21 +124631,22 @@ function createWatchProgram(host) {
|
|
|
124620
124631
|
updateProgram();
|
|
124621
124632
|
}
|
|
124622
124633
|
function updateProgram() {
|
|
124634
|
+
var _a2, _b, _c, _d;
|
|
124623
124635
|
switch (reloadLevel) {
|
|
124624
124636
|
case 1 /* Partial */:
|
|
124625
|
-
perfLogger.logStartUpdateProgram("PartialConfigReload");
|
|
124637
|
+
(_a2 = perfLogger) == null ? void 0 : _a2.logStartUpdateProgram("PartialConfigReload");
|
|
124626
124638
|
reloadFileNamesFromConfigFile();
|
|
124627
124639
|
break;
|
|
124628
124640
|
case 2 /* Full */:
|
|
124629
|
-
perfLogger.logStartUpdateProgram("FullConfigReload");
|
|
124641
|
+
(_b = perfLogger) == null ? void 0 : _b.logStartUpdateProgram("FullConfigReload");
|
|
124630
124642
|
reloadConfigFile();
|
|
124631
124643
|
break;
|
|
124632
124644
|
default:
|
|
124633
|
-
perfLogger.logStartUpdateProgram("SynchronizeProgram");
|
|
124645
|
+
(_c = perfLogger) == null ? void 0 : _c.logStartUpdateProgram("SynchronizeProgram");
|
|
124634
124646
|
synchronizeProgram();
|
|
124635
124647
|
break;
|
|
124636
124648
|
}
|
|
124637
|
-
perfLogger.logStopUpdateProgram("Done");
|
|
124649
|
+
(_d = perfLogger) == null ? void 0 : _d.logStopUpdateProgram("Done");
|
|
124638
124650
|
return getCurrentBuilderProgram();
|
|
124639
124651
|
}
|
|
124640
124652
|
function reloadFileNamesFromConfigFile() {
|
|
@@ -170620,13 +170632,14 @@ var ThrottledOperations = class {
|
|
|
170620
170632
|
return this.pendingTimeouts.delete(operationId);
|
|
170621
170633
|
}
|
|
170622
170634
|
static run(self, operationId, cb) {
|
|
170623
|
-
|
|
170635
|
+
var _a2, _b;
|
|
170636
|
+
(_a2 = perfLogger) == null ? void 0 : _a2.logStartScheduledOperation(operationId);
|
|
170624
170637
|
self.pendingTimeouts.delete(operationId);
|
|
170625
170638
|
if (self.logger) {
|
|
170626
170639
|
self.logger.info(`Running: ${operationId}`);
|
|
170627
170640
|
}
|
|
170628
170641
|
cb();
|
|
170629
|
-
perfLogger.logStopScheduledOperation();
|
|
170642
|
+
(_b = perfLogger) == null ? void 0 : _b.logStopScheduledOperation();
|
|
170630
170643
|
}
|
|
170631
170644
|
};
|
|
170632
170645
|
var GcTimer = class {
|
|
@@ -170642,8 +170655,9 @@ var GcTimer = class {
|
|
|
170642
170655
|
this.timerId = this.host.setTimeout(GcTimer.run, this.delay, this);
|
|
170643
170656
|
}
|
|
170644
170657
|
static run(self) {
|
|
170658
|
+
var _a2, _b;
|
|
170645
170659
|
self.timerId = void 0;
|
|
170646
|
-
perfLogger.logStartScheduledOperation("GC collect");
|
|
170660
|
+
(_a2 = perfLogger) == null ? void 0 : _a2.logStartScheduledOperation("GC collect");
|
|
170647
170661
|
const log = self.logger.hasLevel(2 /* requestTime */);
|
|
170648
170662
|
const before = log && self.host.getMemoryUsage();
|
|
170649
170663
|
self.host.gc();
|
|
@@ -170651,7 +170665,7 @@ var GcTimer = class {
|
|
|
170651
170665
|
const after = self.host.getMemoryUsage();
|
|
170652
170666
|
self.logger.perftrc(`GC::before ${before}, after ${after}`);
|
|
170653
170667
|
}
|
|
170654
|
-
perfLogger.logStopScheduledOperation();
|
|
170668
|
+
(_b = perfLogger) == null ? void 0 : _b.logStopScheduledOperation();
|
|
170655
170669
|
}
|
|
170656
170670
|
};
|
|
170657
170671
|
function getBaseConfigFileName(configFilePath) {
|
|
@@ -172356,9 +172370,9 @@ var Project3 = class {
|
|
|
172356
172370
|
* @returns: true if set of files in the project stays the same and false - otherwise.
|
|
172357
172371
|
*/
|
|
172358
172372
|
updateGraph() {
|
|
172359
|
-
var _a2, _b, _c;
|
|
172373
|
+
var _a2, _b, _c, _d, _e;
|
|
172360
172374
|
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Session, "updateGraph", { name: this.projectName, kind: ProjectKind[this.projectKind] });
|
|
172361
|
-
perfLogger.logStartUpdateGraph();
|
|
172375
|
+
(_b = perfLogger) == null ? void 0 : _b.logStartUpdateGraph();
|
|
172362
172376
|
this.resolutionCache.startRecordingFilesWithChangedResolutions();
|
|
172363
172377
|
const hasNewProgram = this.updateGraphWorker();
|
|
172364
172378
|
const hasAddedorRemovedFiles = this.hasAddedorRemovedFiles;
|
|
@@ -172383,13 +172397,13 @@ var Project3 = class {
|
|
|
172383
172397
|
if (hasAddedorRemovedFiles) {
|
|
172384
172398
|
if (!this.autoImportProviderHost)
|
|
172385
172399
|
this.autoImportProviderHost = void 0;
|
|
172386
|
-
(
|
|
172400
|
+
(_c = this.autoImportProviderHost) == null ? void 0 : _c.markAsDirty();
|
|
172387
172401
|
}
|
|
172388
172402
|
if (isFirstProgramLoad) {
|
|
172389
172403
|
this.getPackageJsonAutoImportProvider();
|
|
172390
172404
|
}
|
|
172391
|
-
perfLogger.logStopUpdateGraph();
|
|
172392
|
-
(
|
|
172405
|
+
(_d = perfLogger) == null ? void 0 : _d.logStopUpdateGraph();
|
|
172406
|
+
(_e = tracing) == null ? void 0 : _e.pop();
|
|
172393
172407
|
return !hasNewProgram;
|
|
172394
172408
|
}
|
|
172395
172409
|
/** @internal */
|
|
@@ -178507,8 +178521,9 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
178507
178521
|
this.writeMessage(msg);
|
|
178508
178522
|
}
|
|
178509
178523
|
writeMessage(msg) {
|
|
178524
|
+
var _a2;
|
|
178510
178525
|
const msgText = formatMessage2(msg, this.logger, this.byteLength, this.host.newLine);
|
|
178511
|
-
perfLogger.logEvent(`Response message size: ${msgText.length}`);
|
|
178526
|
+
(_a2 = perfLogger) == null ? void 0 : _a2.logEvent(`Response message size: ${msgText.length}`);
|
|
178512
178527
|
this.host.write(msgText);
|
|
178513
178528
|
}
|
|
178514
178529
|
event(body, eventName) {
|
|
@@ -180276,7 +180291,7 @@ ${e.message}`;
|
|
|
180276
180291
|
}
|
|
180277
180292
|
}
|
|
180278
180293
|
onMessage(message) {
|
|
180279
|
-
var _a2, _b, _c, _d, _e, _f, _g;
|
|
180294
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
180280
180295
|
this.gcTimer.scheduleCollect();
|
|
180281
180296
|
this.performanceData = void 0;
|
|
180282
180297
|
let start2;
|
|
@@ -180292,8 +180307,8 @@ ${e.message}`;
|
|
|
180292
180307
|
request = this.parseMessage(message);
|
|
180293
180308
|
relevantFile = request.arguments && request.arguments.file ? request.arguments : void 0;
|
|
180294
180309
|
(_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.Session, "request", { seq: request.seq, command: request.command });
|
|
180295
|
-
perfLogger.logStartCommand("" + request.command, this.toStringMessage(message).substring(0, 100));
|
|
180296
|
-
(
|
|
180310
|
+
(_b = perfLogger) == null ? void 0 : _b.logStartCommand("" + request.command, this.toStringMessage(message).substring(0, 100));
|
|
180311
|
+
(_c = tracing) == null ? void 0 : _c.push(
|
|
180297
180312
|
tracing.Phase.Session,
|
|
180298
180313
|
"executeCommand",
|
|
180299
180314
|
{ seq: request.seq, command: request.command },
|
|
@@ -180301,7 +180316,7 @@ ${e.message}`;
|
|
|
180301
180316
|
true
|
|
180302
180317
|
);
|
|
180303
180318
|
const { response, responseRequired } = this.executeCommand(request);
|
|
180304
|
-
(
|
|
180319
|
+
(_d = tracing) == null ? void 0 : _d.pop();
|
|
180305
180320
|
if (this.logger.hasLevel(2 /* requestTime */)) {
|
|
180306
180321
|
const elapsedTime = hrTimeToMilliseconds(this.hrtime(start2)).toFixed(4);
|
|
180307
180322
|
if (responseRequired) {
|
|
@@ -180310,8 +180325,8 @@ ${e.message}`;
|
|
|
180310
180325
|
this.logger.perftrc(`${request.seq}::${request.command}: async elapsed time (in milliseconds) ${elapsedTime}`);
|
|
180311
180326
|
}
|
|
180312
180327
|
}
|
|
180313
|
-
perfLogger.logStopCommand("" + request.command, "Success");
|
|
180314
|
-
(
|
|
180328
|
+
(_e = perfLogger) == null ? void 0 : _e.logStopCommand("" + request.command, "Success");
|
|
180329
|
+
(_f = tracing) == null ? void 0 : _f.instant(tracing.Phase.Session, "response", { seq: request.seq, command: request.command, success: !!response });
|
|
180315
180330
|
if (response) {
|
|
180316
180331
|
this.doOutput(
|
|
180317
180332
|
response,
|
|
@@ -180332,10 +180347,10 @@ ${e.message}`;
|
|
|
180332
180347
|
);
|
|
180333
180348
|
}
|
|
180334
180349
|
} catch (err) {
|
|
180335
|
-
(
|
|
180350
|
+
(_g = tracing) == null ? void 0 : _g.popAll();
|
|
180336
180351
|
if (err instanceof OperationCanceledException) {
|
|
180337
|
-
perfLogger.logStopCommand("" + (request && request.command), "Canceled: " + err);
|
|
180338
|
-
(
|
|
180352
|
+
(_h = perfLogger) == null ? void 0 : _h.logStopCommand("" + (request && request.command), "Canceled: " + err);
|
|
180353
|
+
(_i = tracing) == null ? void 0 : _i.instant(tracing.Phase.Session, "commandCanceled", { seq: request == null ? void 0 : request.seq, command: request == null ? void 0 : request.command });
|
|
180339
180354
|
this.doOutput(
|
|
180340
180355
|
{ canceled: true },
|
|
180341
180356
|
request.command,
|
|
@@ -180346,8 +180361,8 @@ ${e.message}`;
|
|
|
180346
180361
|
return;
|
|
180347
180362
|
}
|
|
180348
180363
|
this.logErrorWorker(err, this.toStringMessage(message), relevantFile);
|
|
180349
|
-
perfLogger.logStopCommand("" + (request && request.command), "Error: " + err);
|
|
180350
|
-
(
|
|
180364
|
+
(_j = perfLogger) == null ? void 0 : _j.logStopCommand("" + (request && request.command), "Error: " + err);
|
|
180365
|
+
(_k = tracing) == null ? void 0 : _k.instant(tracing.Phase.Session, "commandError", { seq: request == null ? void 0 : request.seq, command: request == null ? void 0 : request.command, message: err.message });
|
|
180351
180366
|
this.doOutput(
|
|
180352
180367
|
/*info*/
|
|
180353
180368
|
void 0,
|
|
@@ -181348,15 +181363,16 @@ function initializeNodeSystem() {
|
|
|
181348
181363
|
return this.loggingEnabled() && this.level >= level;
|
|
181349
181364
|
}
|
|
181350
181365
|
msg(s, type = "Err" /* Err */) {
|
|
181366
|
+
var _a2, _b, _c;
|
|
181351
181367
|
switch (type) {
|
|
181352
181368
|
case "Info" /* Info */:
|
|
181353
|
-
perfLogger.logInfoEvent(s);
|
|
181369
|
+
(_a2 = perfLogger) == null ? void 0 : _a2.logInfoEvent(s);
|
|
181354
181370
|
break;
|
|
181355
181371
|
case "Perf" /* Perf */:
|
|
181356
|
-
perfLogger.logPerfEvent(s);
|
|
181372
|
+
(_b = perfLogger) == null ? void 0 : _b.logPerfEvent(s);
|
|
181357
181373
|
break;
|
|
181358
181374
|
default:
|
|
181359
|
-
perfLogger.logErrEvent(s);
|
|
181375
|
+
(_c = perfLogger) == null ? void 0 : _c.logErrEvent(s);
|
|
181360
181376
|
break;
|
|
181361
181377
|
}
|
|
181362
181378
|
if (!this.canWrite())
|