typescript 4.8.0-dev.20220522 → 4.8.0-dev.20220525
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 +77 -45
- package/lib/tsserver.js +102 -58
- package/lib/tsserverlibrary.js +102 -58
- package/lib/typescript.js +102 -58
- package/lib/typescriptServices.js +102 -58
- package/lib/typingsInstaller.js +101 -58
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.8";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220525";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -51631,7 +51631,7 @@ var ts;
|
|
|
51631
51631
|
function substituteIndexedMappedType(objectType, index) {
|
|
51632
51632
|
var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
|
|
51633
51633
|
var templateMapper = combineTypeMappers(objectType.mapper, mapper);
|
|
51634
|
-
return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper);
|
|
51634
|
+
return instantiateType(getTemplateTypeFromMappedType(objectType.target || objectType), templateMapper);
|
|
51635
51635
|
}
|
|
51636
51636
|
function getIndexedAccessType(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) {
|
|
51637
51637
|
if (accessFlags === void 0) { accessFlags = 0; }
|
|
@@ -60320,7 +60320,7 @@ var ts;
|
|
|
60320
60320
|
if (result) {
|
|
60321
60321
|
return result;
|
|
60322
60322
|
}
|
|
60323
|
-
if (!(contextFlags & 8) && ts.isBindingPattern(declaration.name)) {
|
|
60323
|
+
if (!(contextFlags & 8) && ts.isBindingPattern(declaration.name) && declaration.name.elements.length > 0) {
|
|
60324
60324
|
return getTypeFromBindingPattern(declaration.name, true, false);
|
|
60325
60325
|
}
|
|
60326
60326
|
}
|
|
@@ -60737,16 +60737,14 @@ var ts;
|
|
|
60737
60737
|
function instantiateContextualType(contextualType, node, contextFlags) {
|
|
60738
60738
|
if (contextualType && maybeTypeOfKind(contextualType, 465829888)) {
|
|
60739
60739
|
var inferenceContext = getInferenceContext(node);
|
|
60740
|
-
if (inferenceContext && ts.some(inferenceContext.inferences, hasInferenceCandidates)) {
|
|
60741
|
-
|
|
60742
|
-
|
|
60743
|
-
|
|
60744
|
-
|
|
60745
|
-
|
|
60746
|
-
|
|
60747
|
-
|
|
60748
|
-
type;
|
|
60749
|
-
}
|
|
60740
|
+
if (inferenceContext && contextFlags & 1 && ts.some(inferenceContext.inferences, hasInferenceCandidates)) {
|
|
60741
|
+
return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
|
|
60742
|
+
}
|
|
60743
|
+
if (inferenceContext === null || inferenceContext === void 0 ? void 0 : inferenceContext.returnMapper) {
|
|
60744
|
+
var type = instantiateInstantiableTypes(contextualType, inferenceContext.returnMapper);
|
|
60745
|
+
return type.flags & 1048576 && containsType(type.types, regularFalseType) && containsType(type.types, regularTrueType) ?
|
|
60746
|
+
filterType(type, function (t) { return t !== regularFalseType && t !== regularTrueType; }) :
|
|
60747
|
+
type;
|
|
60750
60748
|
}
|
|
60751
60749
|
}
|
|
60752
60750
|
return contextualType;
|
|
@@ -62900,18 +62898,22 @@ var ts;
|
|
|
62900
62898
|
return inferJsxTypeArguments(node, signature, checkMode, context);
|
|
62901
62899
|
}
|
|
62902
62900
|
if (node.kind !== 165) {
|
|
62903
|
-
var
|
|
62901
|
+
var skipBindingPatterns = ts.every(signature.typeParameters, function (p) { return !!getDefaultFromTypeParameter(p); });
|
|
62902
|
+
var contextualType = getContextualType(node, skipBindingPatterns ? 8 : 0);
|
|
62904
62903
|
if (contextualType) {
|
|
62905
62904
|
var inferenceTargetType = getReturnTypeOfSignature(signature);
|
|
62906
62905
|
if (couldContainTypeVariables(inferenceTargetType)) {
|
|
62907
62906
|
var outerContext = getInferenceContext(node);
|
|
62908
|
-
var
|
|
62909
|
-
|
|
62910
|
-
|
|
62911
|
-
|
|
62912
|
-
|
|
62913
|
-
|
|
62914
|
-
|
|
62907
|
+
var isFromBindingPattern = !skipBindingPatterns && getContextualType(node, 8) !== contextualType;
|
|
62908
|
+
if (!isFromBindingPattern) {
|
|
62909
|
+
var outerMapper = getMapperFromContext(cloneInferenceContext(outerContext, 1));
|
|
62910
|
+
var instantiatedType = instantiateType(contextualType, outerMapper);
|
|
62911
|
+
var contextualSignature = getSingleCallSignature(instantiatedType);
|
|
62912
|
+
var inferenceSourceType = contextualSignature && contextualSignature.typeParameters ?
|
|
62913
|
+
getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) :
|
|
62914
|
+
instantiatedType;
|
|
62915
|
+
inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128);
|
|
62916
|
+
}
|
|
62915
62917
|
var returnContext = createInferenceContext(signature.typeParameters, signature, context.flags);
|
|
62916
62918
|
var returnSourceType = instantiateType(contextualType, outerContext && outerContext.returnMapper);
|
|
62917
62919
|
inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType);
|
|
@@ -87835,7 +87837,7 @@ var ts;
|
|
|
87835
87837
|
function visitor(node) {
|
|
87836
87838
|
switch (node.kind) {
|
|
87837
87839
|
case 265:
|
|
87838
|
-
return ts.
|
|
87840
|
+
return ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.Node16 ? visitImportEqualsDeclaration(node) : undefined;
|
|
87839
87841
|
case 271:
|
|
87840
87842
|
return visitExportAssignment(node);
|
|
87841
87843
|
case 272:
|
|
@@ -102742,7 +102744,6 @@ var ts;
|
|
|
102742
102744
|
allProjectBuildPending: true,
|
|
102743
102745
|
needsSummary: true,
|
|
102744
102746
|
watchAllProjectsPending: watch,
|
|
102745
|
-
currentInvalidatedProject: undefined,
|
|
102746
102747
|
watch: watch,
|
|
102747
102748
|
allWatchedWildcardDirectories: new ts.Map(),
|
|
102748
102749
|
allWatchedInputFiles: new ts.Map(),
|
|
@@ -102967,7 +102968,6 @@ var ts;
|
|
|
102967
102968
|
})(InvalidatedProjectKind = ts.InvalidatedProjectKind || (ts.InvalidatedProjectKind = {}));
|
|
102968
102969
|
function doneInvalidatedProject(state, projectPath) {
|
|
102969
102970
|
state.projectPendingBuild.delete(projectPath);
|
|
102970
|
-
state.currentInvalidatedProject = undefined;
|
|
102971
102971
|
return state.diagnostics.has(projectPath) ?
|
|
102972
102972
|
ts.ExitStatus.DiagnosticsPresent_OutputsSkipped :
|
|
102973
102973
|
ts.ExitStatus.Success;
|
|
@@ -103302,16 +103302,11 @@ var ts;
|
|
|
103302
103302
|
!!ts.getConfigFileParsingDiagnostics(config).length ||
|
|
103303
103303
|
!ts.isIncrementalCompilation(config.options);
|
|
103304
103304
|
}
|
|
103305
|
-
function
|
|
103305
|
+
function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
|
|
103306
103306
|
if (!state.projectPendingBuild.size)
|
|
103307
103307
|
return undefined;
|
|
103308
103308
|
if (isCircularBuildOrder(buildOrder))
|
|
103309
103309
|
return undefined;
|
|
103310
|
-
if (state.currentInvalidatedProject) {
|
|
103311
|
-
return ts.arrayIsEqualTo(state.currentInvalidatedProject.buildOrder, buildOrder) ?
|
|
103312
|
-
state.currentInvalidatedProject :
|
|
103313
|
-
undefined;
|
|
103314
|
-
}
|
|
103315
103310
|
var options = state.options, projectPendingBuild = state.projectPendingBuild;
|
|
103316
103311
|
for (var projectIndex = 0; projectIndex < buildOrder.length; projectIndex++) {
|
|
103317
103312
|
var project = buildOrder[projectIndex];
|
|
@@ -103343,9 +103338,9 @@ var ts;
|
|
|
103343
103338
|
watchPackageJsonFiles(state, project, projectPath, config);
|
|
103344
103339
|
}
|
|
103345
103340
|
var status = getUpToDateStatus(state, config, projectPath);
|
|
103346
|
-
verboseReportProjectStatus(state, project, status);
|
|
103347
103341
|
if (!options.force) {
|
|
103348
103342
|
if (status.type === ts.UpToDateStatusType.UpToDate) {
|
|
103343
|
+
verboseReportProjectStatus(state, project, status);
|
|
103349
103344
|
reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
|
|
103350
103345
|
projectPendingBuild.delete(projectPath);
|
|
103351
103346
|
if (options.dry) {
|
|
@@ -103355,10 +103350,18 @@ var ts;
|
|
|
103355
103350
|
}
|
|
103356
103351
|
if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes) {
|
|
103357
103352
|
reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
|
|
103358
|
-
return
|
|
103353
|
+
return {
|
|
103354
|
+
kind: InvalidatedProjectKind.UpdateOutputFileStamps,
|
|
103355
|
+
status: status,
|
|
103356
|
+
project: project,
|
|
103357
|
+
projectPath: projectPath,
|
|
103358
|
+
projectIndex: projectIndex,
|
|
103359
|
+
config: config
|
|
103360
|
+
};
|
|
103359
103361
|
}
|
|
103360
103362
|
}
|
|
103361
103363
|
if (status.type === ts.UpToDateStatusType.UpstreamBlocked) {
|
|
103364
|
+
verboseReportProjectStatus(state, project, status);
|
|
103362
103365
|
reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
|
|
103363
103366
|
projectPendingBuild.delete(projectPath);
|
|
103364
103367
|
if (options.verbose) {
|
|
@@ -103369,16 +103372,36 @@ var ts;
|
|
|
103369
103372
|
continue;
|
|
103370
103373
|
}
|
|
103371
103374
|
if (status.type === ts.UpToDateStatusType.ContainerOnly) {
|
|
103375
|
+
verboseReportProjectStatus(state, project, status);
|
|
103372
103376
|
reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
|
|
103373
103377
|
projectPendingBuild.delete(projectPath);
|
|
103374
103378
|
continue;
|
|
103375
103379
|
}
|
|
103376
|
-
return
|
|
103377
|
-
|
|
103378
|
-
|
|
103380
|
+
return {
|
|
103381
|
+
kind: needsBuild(state, status, config) ?
|
|
103382
|
+
InvalidatedProjectKind.Build :
|
|
103383
|
+
InvalidatedProjectKind.UpdateBundle,
|
|
103384
|
+
status: status,
|
|
103385
|
+
project: project,
|
|
103386
|
+
projectPath: projectPath,
|
|
103387
|
+
projectIndex: projectIndex,
|
|
103388
|
+
config: config,
|
|
103389
|
+
};
|
|
103379
103390
|
}
|
|
103380
103391
|
return undefined;
|
|
103381
103392
|
}
|
|
103393
|
+
function createInvalidatedProjectWithInfo(state, info, buildOrder) {
|
|
103394
|
+
verboseReportProjectStatus(state, info.project, info.status);
|
|
103395
|
+
return info.kind !== InvalidatedProjectKind.UpdateOutputFileStamps ?
|
|
103396
|
+
createBuildOrUpdateInvalidedProject(info.kind, state, info.project, info.projectPath, info.projectIndex, info.config, buildOrder) :
|
|
103397
|
+
createUpdateOutputFileStampsProject(state, info.project, info.projectPath, info.config, buildOrder);
|
|
103398
|
+
}
|
|
103399
|
+
function getNextInvalidatedProject(state, buildOrder, reportQueue) {
|
|
103400
|
+
var info = getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue);
|
|
103401
|
+
if (!info)
|
|
103402
|
+
return info;
|
|
103403
|
+
return createInvalidatedProjectWithInfo(state, info, buildOrder);
|
|
103404
|
+
}
|
|
103382
103405
|
function listEmittedFile(_a, proj, file) {
|
|
103383
103406
|
var write = _a.write;
|
|
103384
103407
|
if (write && proj.options.listEmittedFiles) {
|
|
@@ -103782,9 +103805,9 @@ var ts;
|
|
|
103782
103805
|
function invalidateProjectAndScheduleBuilds(state, resolvedPath, reloadLevel) {
|
|
103783
103806
|
state.reportFileChangeDetected = true;
|
|
103784
103807
|
invalidateProject(state, resolvedPath, reloadLevel);
|
|
103785
|
-
scheduleBuildInvalidatedProject(state);
|
|
103808
|
+
scheduleBuildInvalidatedProject(state, 250, true);
|
|
103786
103809
|
}
|
|
103787
|
-
function scheduleBuildInvalidatedProject(state) {
|
|
103810
|
+
function scheduleBuildInvalidatedProject(state, time, changeDetected) {
|
|
103788
103811
|
var hostWithWatch = state.hostWithWatch;
|
|
103789
103812
|
if (!hostWithWatch.setTimeout || !hostWithWatch.clearTimeout) {
|
|
103790
103813
|
return;
|
|
@@ -103792,24 +103815,35 @@ var ts;
|
|
|
103792
103815
|
if (state.timerToBuildInvalidatedProject) {
|
|
103793
103816
|
hostWithWatch.clearTimeout(state.timerToBuildInvalidatedProject);
|
|
103794
103817
|
}
|
|
103795
|
-
state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject,
|
|
103818
|
+
state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected);
|
|
103796
103819
|
}
|
|
103797
|
-
function buildNextInvalidatedProject(state) {
|
|
103820
|
+
function buildNextInvalidatedProject(state, changeDetected) {
|
|
103798
103821
|
state.timerToBuildInvalidatedProject = undefined;
|
|
103799
103822
|
if (state.reportFileChangeDetected) {
|
|
103800
103823
|
state.reportFileChangeDetected = false;
|
|
103801
103824
|
state.projectErrorsReported.clear();
|
|
103802
103825
|
reportWatchStatus(state, ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
103803
103826
|
}
|
|
103827
|
+
var projectsBuilt = 0;
|
|
103804
103828
|
var buildOrder = getBuildOrder(state);
|
|
103805
103829
|
var invalidatedProject = getNextInvalidatedProject(state, buildOrder, false);
|
|
103806
103830
|
if (invalidatedProject) {
|
|
103807
103831
|
invalidatedProject.done();
|
|
103808
|
-
|
|
103809
|
-
|
|
103810
|
-
|
|
103832
|
+
projectsBuilt++;
|
|
103833
|
+
while (state.projectPendingBuild.size) {
|
|
103834
|
+
if (state.timerToBuildInvalidatedProject)
|
|
103835
|
+
return;
|
|
103836
|
+
var info = getNextInvalidatedProjectCreateInfo(state, buildOrder, false);
|
|
103837
|
+
if (!info)
|
|
103838
|
+
break;
|
|
103839
|
+
if (info.kind !== InvalidatedProjectKind.UpdateOutputFileStamps && (changeDetected || projectsBuilt === 5)) {
|
|
103840
|
+
scheduleBuildInvalidatedProject(state, 100, false);
|
|
103841
|
+
return;
|
|
103811
103842
|
}
|
|
103812
|
-
|
|
103843
|
+
var project = createInvalidatedProjectWithInfo(state, info, buildOrder);
|
|
103844
|
+
project.done();
|
|
103845
|
+
if (info.kind !== InvalidatedProjectKind.UpdateOutputFileStamps)
|
|
103846
|
+
projectsBuilt++;
|
|
103813
103847
|
}
|
|
103814
103848
|
}
|
|
103815
103849
|
disableCache(state);
|
|
@@ -103909,8 +103943,6 @@ var ts;
|
|
|
103909
103943
|
return getUpToDateStatus(state, parseConfigFile(state, configFileName, configFilePath), configFilePath);
|
|
103910
103944
|
},
|
|
103911
103945
|
invalidateProject: function (configFilePath, reloadLevel) { return invalidateProject(state, configFilePath, reloadLevel || ts.ConfigFileProgramReloadLevel.None); },
|
|
103912
|
-
buildNextInvalidatedProject: function () { return buildNextInvalidatedProject(state); },
|
|
103913
|
-
getAllParsedConfigs: function () { return ts.arrayFrom(ts.mapDefinedIterator(state.configFileCache.values(), function (config) { return isParsedCommandLine(config) ? config : undefined; })); },
|
|
103914
103946
|
close: function () { return stopWatching(state); },
|
|
103915
103947
|
};
|
|
103916
103948
|
}
|
package/lib/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220525";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -62184,7 +62184,7 @@ var ts;
|
|
|
62184
62184
|
function substituteIndexedMappedType(objectType, index) {
|
|
62185
62185
|
var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
|
|
62186
62186
|
var templateMapper = combineTypeMappers(objectType.mapper, mapper);
|
|
62187
|
-
return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper);
|
|
62187
|
+
return instantiateType(getTemplateTypeFromMappedType(objectType.target || objectType), templateMapper);
|
|
62188
62188
|
}
|
|
62189
62189
|
function getIndexedAccessType(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) {
|
|
62190
62190
|
if (accessFlags === void 0) { accessFlags = 0 /* None */; }
|
|
@@ -72296,7 +72296,7 @@ var ts;
|
|
|
72296
72296
|
if (result) {
|
|
72297
72297
|
return result;
|
|
72298
72298
|
}
|
|
72299
|
-
if (!(contextFlags & 8 /* SkipBindingPatterns */) && ts.isBindingPattern(declaration.name)
|
|
72299
|
+
if (!(contextFlags & 8 /* SkipBindingPatterns */) && ts.isBindingPattern(declaration.name) && declaration.name.elements.length > 0) {
|
|
72300
72300
|
return getTypeFromBindingPattern(declaration.name, /*includePatternInType*/ true, /*reportErrors*/ false);
|
|
72301
72301
|
}
|
|
72302
72302
|
}
|
|
@@ -72765,22 +72765,20 @@ var ts;
|
|
|
72765
72765
|
var inferenceContext = getInferenceContext(node);
|
|
72766
72766
|
// If no inferences have been made, nothing is gained from instantiating as type parameters
|
|
72767
72767
|
// would just be replaced with their defaults similar to the apparent type.
|
|
72768
|
-
if (inferenceContext && ts.some(inferenceContext.inferences, hasInferenceCandidates)) {
|
|
72768
|
+
if (inferenceContext && contextFlags & 1 /* Signature */ && ts.some(inferenceContext.inferences, hasInferenceCandidates)) {
|
|
72769
72769
|
// For contextual signatures we incorporate all inferences made so far, e.g. from return
|
|
72770
72770
|
// types as well as arguments to the left in a function call.
|
|
72771
|
-
|
|
72772
|
-
|
|
72773
|
-
|
|
72771
|
+
return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
|
|
72772
|
+
}
|
|
72773
|
+
if (inferenceContext === null || inferenceContext === void 0 ? void 0 : inferenceContext.returnMapper) {
|
|
72774
72774
|
// For other purposes (e.g. determining whether to produce literal types) we only
|
|
72775
72775
|
// incorporate inferences made from the return type in a function call. We remove
|
|
72776
72776
|
// the 'boolean' type from the contextual type such that contextually typed boolean
|
|
72777
72777
|
// literals actually end up widening to 'boolean' (see #48363).
|
|
72778
|
-
|
|
72779
|
-
|
|
72780
|
-
|
|
72781
|
-
|
|
72782
|
-
type;
|
|
72783
|
-
}
|
|
72778
|
+
var type = instantiateInstantiableTypes(contextualType, inferenceContext.returnMapper);
|
|
72779
|
+
return type.flags & 1048576 /* Union */ && containsType(type.types, regularFalseType) && containsType(type.types, regularTrueType) ?
|
|
72780
|
+
filterType(type, function (t) { return t !== regularFalseType && t !== regularTrueType; }) :
|
|
72781
|
+
type;
|
|
72784
72782
|
}
|
|
72785
72783
|
}
|
|
72786
72784
|
return contextualType;
|
|
@@ -75314,29 +75312,43 @@ var ts;
|
|
|
75314
75312
|
// 'let f: (x: string) => number = wrap(s => s.length)', we infer from the declared type of 'f' to the
|
|
75315
75313
|
// return type of 'wrap'.
|
|
75316
75314
|
if (node.kind !== 165 /* Decorator */) {
|
|
75317
|
-
var
|
|
75315
|
+
var skipBindingPatterns = ts.every(signature.typeParameters, function (p) { return !!getDefaultFromTypeParameter(p); });
|
|
75316
|
+
var contextualType = getContextualType(node, skipBindingPatterns ? 8 /* SkipBindingPatterns */ : 0 /* None */);
|
|
75318
75317
|
if (contextualType) {
|
|
75319
75318
|
var inferenceTargetType = getReturnTypeOfSignature(signature);
|
|
75320
75319
|
if (couldContainTypeVariables(inferenceTargetType)) {
|
|
75321
|
-
// We clone the inference context to avoid disturbing a resolution in progress for an
|
|
75322
|
-
// outer call expression. Effectively we just want a snapshot of whatever has been
|
|
75323
|
-
// inferred for any outer call expression so far.
|
|
75324
75320
|
var outerContext = getInferenceContext(node);
|
|
75325
|
-
var
|
|
75326
|
-
|
|
75327
|
-
//
|
|
75328
|
-
//
|
|
75329
|
-
//
|
|
75330
|
-
//
|
|
75331
|
-
// declare function
|
|
75332
|
-
// const
|
|
75333
|
-
//
|
|
75334
|
-
|
|
75335
|
-
|
|
75336
|
-
|
|
75337
|
-
|
|
75338
|
-
|
|
75339
|
-
|
|
75321
|
+
var isFromBindingPattern = !skipBindingPatterns && getContextualType(node, 8 /* SkipBindingPatterns */) !== contextualType;
|
|
75322
|
+
// A return type inference from a binding pattern can be used in instantiating the contextual
|
|
75323
|
+
// type of an argument later in inference, but cannot stand on its own as the final return type.
|
|
75324
|
+
// It is incorporated into `context.returnMapper` which is used in `instantiateContextualType`,
|
|
75325
|
+
// but doesn't need to go into `context.inferences`. This allows a an array binding pattern to
|
|
75326
|
+
// produce a tuple for `T` in
|
|
75327
|
+
// declare function f<T>(cb: () => T): T;
|
|
75328
|
+
// const [e1, e2, e3] = f(() => [1, "hi", true]);
|
|
75329
|
+
// but does not produce any inference for `T` in
|
|
75330
|
+
// declare function f<T>(): T;
|
|
75331
|
+
// const [e1, e2, e3] = f();
|
|
75332
|
+
if (!isFromBindingPattern) {
|
|
75333
|
+
// We clone the inference context to avoid disturbing a resolution in progress for an
|
|
75334
|
+
// outer call expression. Effectively we just want a snapshot of whatever has been
|
|
75335
|
+
// inferred for any outer call expression so far.
|
|
75336
|
+
var outerMapper = getMapperFromContext(cloneInferenceContext(outerContext, 1 /* NoDefault */));
|
|
75337
|
+
var instantiatedType = instantiateType(contextualType, outerMapper);
|
|
75338
|
+
// If the contextual type is a generic function type with a single call signature, we
|
|
75339
|
+
// instantiate the type with its own type parameters and type arguments. This ensures that
|
|
75340
|
+
// the type parameters are not erased to type any during type inference such that they can
|
|
75341
|
+
// be inferred as actual types from the contextual type. For example:
|
|
75342
|
+
// declare function arrayMap<T, U>(f: (x: T) => U): (a: T[]) => U[];
|
|
75343
|
+
// const boxElements: <A>(a: A[]) => { value: A }[] = arrayMap(value => ({ value }));
|
|
75344
|
+
// Above, the type of the 'value' parameter is inferred to be 'A'.
|
|
75345
|
+
var contextualSignature = getSingleCallSignature(instantiatedType);
|
|
75346
|
+
var inferenceSourceType = contextualSignature && contextualSignature.typeParameters ?
|
|
75347
|
+
getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) :
|
|
75348
|
+
instantiatedType;
|
|
75349
|
+
// Inferences made from return types have lower priority than all other inferences.
|
|
75350
|
+
inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
|
|
75351
|
+
}
|
|
75340
75352
|
// Create a type mapper for instantiating generic contextual types using the inferences made
|
|
75341
75353
|
// from the return type. We need a separate inference pass here because (a) instantiation of
|
|
75342
75354
|
// the source type uses the outer context's return mapper (which excludes inferences made from
|
|
@@ -107261,7 +107273,7 @@ var ts;
|
|
|
107261
107273
|
// Though an error in es2020 modules, in node-flavor es2020 modules, we can helpfully transform this to a synthetic `require` call
|
|
107262
107274
|
// To give easy access to a synchronous `require` in node-flavor esm. We do the transform even in scenarios where we error, but `import.meta.url`
|
|
107263
107275
|
// is available, just because the output is reasonable for a node-like runtime.
|
|
107264
|
-
return ts.
|
|
107276
|
+
return ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.Node16 ? visitImportEqualsDeclaration(node) : undefined;
|
|
107265
107277
|
case 271 /* ExportAssignment */:
|
|
107266
107278
|
return visitExportAssignment(node);
|
|
107267
107279
|
case 272 /* ExportDeclaration */:
|
|
@@ -124092,7 +124104,6 @@ var ts;
|
|
|
124092
124104
|
allProjectBuildPending: true,
|
|
124093
124105
|
needsSummary: true,
|
|
124094
124106
|
watchAllProjectsPending: watch,
|
|
124095
|
-
currentInvalidatedProject: undefined,
|
|
124096
124107
|
// Watch state
|
|
124097
124108
|
watch: watch,
|
|
124098
124109
|
allWatchedWildcardDirectories: new ts.Map(),
|
|
@@ -124325,7 +124336,6 @@ var ts;
|
|
|
124325
124336
|
})(InvalidatedProjectKind = ts.InvalidatedProjectKind || (ts.InvalidatedProjectKind = {}));
|
|
124326
124337
|
function doneInvalidatedProject(state, projectPath) {
|
|
124327
124338
|
state.projectPendingBuild.delete(projectPath);
|
|
124328
|
-
state.currentInvalidatedProject = undefined;
|
|
124329
124339
|
return state.diagnostics.has(projectPath) ?
|
|
124330
124340
|
ts.ExitStatus.DiagnosticsPresent_OutputsSkipped :
|
|
124331
124341
|
ts.ExitStatus.Success;
|
|
@@ -124676,17 +124686,11 @@ var ts;
|
|
|
124676
124686
|
!!ts.getConfigFileParsingDiagnostics(config).length ||
|
|
124677
124687
|
!ts.isIncrementalCompilation(config.options);
|
|
124678
124688
|
}
|
|
124679
|
-
function
|
|
124689
|
+
function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
|
|
124680
124690
|
if (!state.projectPendingBuild.size)
|
|
124681
124691
|
return undefined;
|
|
124682
124692
|
if (isCircularBuildOrder(buildOrder))
|
|
124683
124693
|
return undefined;
|
|
124684
|
-
if (state.currentInvalidatedProject) {
|
|
124685
|
-
// Only if same buildOrder the currentInvalidated project can be sent again
|
|
124686
|
-
return ts.arrayIsEqualTo(state.currentInvalidatedProject.buildOrder, buildOrder) ?
|
|
124687
|
-
state.currentInvalidatedProject :
|
|
124688
|
-
undefined;
|
|
124689
|
-
}
|
|
124690
124694
|
var options = state.options, projectPendingBuild = state.projectPendingBuild;
|
|
124691
124695
|
for (var projectIndex = 0; projectIndex < buildOrder.length; projectIndex++) {
|
|
124692
124696
|
var project = buildOrder[projectIndex];
|
|
@@ -124719,9 +124723,9 @@ var ts;
|
|
|
124719
124723
|
watchPackageJsonFiles(state, project, projectPath, config);
|
|
124720
124724
|
}
|
|
124721
124725
|
var status = getUpToDateStatus(state, config, projectPath);
|
|
124722
|
-
verboseReportProjectStatus(state, project, status);
|
|
124723
124726
|
if (!options.force) {
|
|
124724
124727
|
if (status.type === ts.UpToDateStatusType.UpToDate) {
|
|
124728
|
+
verboseReportProjectStatus(state, project, status);
|
|
124725
124729
|
reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
|
|
124726
124730
|
projectPendingBuild.delete(projectPath);
|
|
124727
124731
|
// Up to date, skip
|
|
@@ -124733,10 +124737,18 @@ var ts;
|
|
|
124733
124737
|
}
|
|
124734
124738
|
if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes) {
|
|
124735
124739
|
reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
|
|
124736
|
-
return
|
|
124740
|
+
return {
|
|
124741
|
+
kind: InvalidatedProjectKind.UpdateOutputFileStamps,
|
|
124742
|
+
status: status,
|
|
124743
|
+
project: project,
|
|
124744
|
+
projectPath: projectPath,
|
|
124745
|
+
projectIndex: projectIndex,
|
|
124746
|
+
config: config
|
|
124747
|
+
};
|
|
124737
124748
|
}
|
|
124738
124749
|
}
|
|
124739
124750
|
if (status.type === ts.UpToDateStatusType.UpstreamBlocked) {
|
|
124751
|
+
verboseReportProjectStatus(state, project, status);
|
|
124740
124752
|
reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
|
|
124741
124753
|
projectPendingBuild.delete(projectPath);
|
|
124742
124754
|
if (options.verbose) {
|
|
@@ -124747,17 +124759,37 @@ var ts;
|
|
|
124747
124759
|
continue;
|
|
124748
124760
|
}
|
|
124749
124761
|
if (status.type === ts.UpToDateStatusType.ContainerOnly) {
|
|
124762
|
+
verboseReportProjectStatus(state, project, status);
|
|
124750
124763
|
reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
|
|
124751
124764
|
projectPendingBuild.delete(projectPath);
|
|
124752
124765
|
// Do nothing
|
|
124753
124766
|
continue;
|
|
124754
124767
|
}
|
|
124755
|
-
return
|
|
124756
|
-
|
|
124757
|
-
|
|
124768
|
+
return {
|
|
124769
|
+
kind: needsBuild(state, status, config) ?
|
|
124770
|
+
InvalidatedProjectKind.Build :
|
|
124771
|
+
InvalidatedProjectKind.UpdateBundle,
|
|
124772
|
+
status: status,
|
|
124773
|
+
project: project,
|
|
124774
|
+
projectPath: projectPath,
|
|
124775
|
+
projectIndex: projectIndex,
|
|
124776
|
+
config: config,
|
|
124777
|
+
};
|
|
124758
124778
|
}
|
|
124759
124779
|
return undefined;
|
|
124760
124780
|
}
|
|
124781
|
+
function createInvalidatedProjectWithInfo(state, info, buildOrder) {
|
|
124782
|
+
verboseReportProjectStatus(state, info.project, info.status);
|
|
124783
|
+
return info.kind !== InvalidatedProjectKind.UpdateOutputFileStamps ?
|
|
124784
|
+
createBuildOrUpdateInvalidedProject(info.kind, state, info.project, info.projectPath, info.projectIndex, info.config, buildOrder) :
|
|
124785
|
+
createUpdateOutputFileStampsProject(state, info.project, info.projectPath, info.config, buildOrder);
|
|
124786
|
+
}
|
|
124787
|
+
function getNextInvalidatedProject(state, buildOrder, reportQueue) {
|
|
124788
|
+
var info = getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue);
|
|
124789
|
+
if (!info)
|
|
124790
|
+
return info;
|
|
124791
|
+
return createInvalidatedProjectWithInfo(state, info, buildOrder);
|
|
124792
|
+
}
|
|
124761
124793
|
function listEmittedFile(_a, proj, file) {
|
|
124762
124794
|
var write = _a.write;
|
|
124763
124795
|
if (write && proj.options.listEmittedFiles) {
|
|
@@ -125198,9 +125230,9 @@ var ts;
|
|
|
125198
125230
|
function invalidateProjectAndScheduleBuilds(state, resolvedPath, reloadLevel) {
|
|
125199
125231
|
state.reportFileChangeDetected = true;
|
|
125200
125232
|
invalidateProject(state, resolvedPath, reloadLevel);
|
|
125201
|
-
scheduleBuildInvalidatedProject(state);
|
|
125233
|
+
scheduleBuildInvalidatedProject(state, 250, /*changeDetected*/ true);
|
|
125202
125234
|
}
|
|
125203
|
-
function scheduleBuildInvalidatedProject(state) {
|
|
125235
|
+
function scheduleBuildInvalidatedProject(state, time, changeDetected) {
|
|
125204
125236
|
var hostWithWatch = state.hostWithWatch;
|
|
125205
125237
|
if (!hostWithWatch.setTimeout || !hostWithWatch.clearTimeout) {
|
|
125206
125238
|
return;
|
|
@@ -125208,25 +125240,38 @@ var ts;
|
|
|
125208
125240
|
if (state.timerToBuildInvalidatedProject) {
|
|
125209
125241
|
hostWithWatch.clearTimeout(state.timerToBuildInvalidatedProject);
|
|
125210
125242
|
}
|
|
125211
|
-
state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject,
|
|
125243
|
+
state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected);
|
|
125212
125244
|
}
|
|
125213
|
-
function buildNextInvalidatedProject(state) {
|
|
125245
|
+
function buildNextInvalidatedProject(state, changeDetected) {
|
|
125214
125246
|
state.timerToBuildInvalidatedProject = undefined;
|
|
125215
125247
|
if (state.reportFileChangeDetected) {
|
|
125216
125248
|
state.reportFileChangeDetected = false;
|
|
125217
125249
|
state.projectErrorsReported.clear();
|
|
125218
125250
|
reportWatchStatus(state, ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
125219
125251
|
}
|
|
125252
|
+
var projectsBuilt = 0;
|
|
125220
125253
|
var buildOrder = getBuildOrder(state);
|
|
125221
125254
|
var invalidatedProject = getNextInvalidatedProject(state, buildOrder, /*reportQueue*/ false);
|
|
125222
125255
|
if (invalidatedProject) {
|
|
125223
125256
|
invalidatedProject.done();
|
|
125224
|
-
|
|
125225
|
-
|
|
125226
|
-
|
|
125227
|
-
|
|
125257
|
+
projectsBuilt++;
|
|
125258
|
+
while (state.projectPendingBuild.size) {
|
|
125259
|
+
// If already scheduled, skip
|
|
125260
|
+
if (state.timerToBuildInvalidatedProject)
|
|
125261
|
+
return;
|
|
125262
|
+
// Before scheduling check if the next project needs build
|
|
125263
|
+
var info = getNextInvalidatedProjectCreateInfo(state, buildOrder, /*reportQueue*/ false);
|
|
125264
|
+
if (!info)
|
|
125265
|
+
break; // Nothing to build any more
|
|
125266
|
+
if (info.kind !== InvalidatedProjectKind.UpdateOutputFileStamps && (changeDetected || projectsBuilt === 5)) {
|
|
125267
|
+
// Schedule next project for build
|
|
125268
|
+
scheduleBuildInvalidatedProject(state, 100, /*changeDetected*/ false);
|
|
125269
|
+
return;
|
|
125228
125270
|
}
|
|
125229
|
-
|
|
125271
|
+
var project = createInvalidatedProjectWithInfo(state, info, buildOrder);
|
|
125272
|
+
project.done();
|
|
125273
|
+
if (info.kind !== InvalidatedProjectKind.UpdateOutputFileStamps)
|
|
125274
|
+
projectsBuilt++;
|
|
125230
125275
|
}
|
|
125231
125276
|
}
|
|
125232
125277
|
disableCache(state);
|
|
@@ -125330,8 +125375,6 @@ var ts;
|
|
|
125330
125375
|
return getUpToDateStatus(state, parseConfigFile(state, configFileName, configFilePath), configFilePath);
|
|
125331
125376
|
},
|
|
125332
125377
|
invalidateProject: function (configFilePath, reloadLevel) { return invalidateProject(state, configFilePath, reloadLevel || ts.ConfigFileProgramReloadLevel.None); },
|
|
125333
|
-
buildNextInvalidatedProject: function () { return buildNextInvalidatedProject(state); },
|
|
125334
|
-
getAllParsedConfigs: function () { return ts.arrayFrom(ts.mapDefinedIterator(state.configFileCache.values(), function (config) { return isParsedCommandLine(config) ? config : undefined; })); },
|
|
125335
125378
|
close: function () { return stopWatching(state); },
|
|
125336
125379
|
};
|
|
125337
125380
|
}
|
|
@@ -134667,6 +134710,7 @@ var ts;
|
|
|
134667
134710
|
return kind === 131 /* AsyncKeyword */
|
|
134668
134711
|
|| kind === 132 /* AwaitKeyword */
|
|
134669
134712
|
|| kind === 127 /* AsKeyword */
|
|
134713
|
+
|| kind === 152 /* TypeKeyword */
|
|
134670
134714
|
|| !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
|
|
134671
134715
|
}
|
|
134672
134716
|
function keywordForNode(node) {
|