typescript 5.5.0-dev.20240416 → 5.5.0-dev.20240417
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 +168 -26
- package/lib/typescript.js +197 -37
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.5";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240417`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -34483,6 +34483,7 @@ var optionsForWatch = [
|
|
|
34483
34483
|
isFilePath: true,
|
|
34484
34484
|
extraValidation: specToDiagnostic
|
|
34485
34485
|
},
|
|
34486
|
+
allowConfigDirTemplateSubstitution: true,
|
|
34486
34487
|
category: Diagnostics.Watch_and_Build_Modes,
|
|
34487
34488
|
description: Diagnostics.Remove_a_list_of_directories_from_the_watch_process
|
|
34488
34489
|
},
|
|
@@ -34495,6 +34496,7 @@ var optionsForWatch = [
|
|
|
34495
34496
|
isFilePath: true,
|
|
34496
34497
|
extraValidation: specToDiagnostic
|
|
34497
34498
|
},
|
|
34499
|
+
allowConfigDirTemplateSubstitution: true,
|
|
34498
34500
|
category: Diagnostics.Watch_and_Build_Modes,
|
|
34499
34501
|
description: Diagnostics.Remove_a_list_of_files_from_the_watch_mode_s_processing
|
|
34500
34502
|
}
|
|
@@ -35193,6 +35195,7 @@ var commandOptionsWithoutBuild = [
|
|
|
35193
35195
|
name: "paths",
|
|
35194
35196
|
type: "object",
|
|
35195
35197
|
affectsModuleResolution: true,
|
|
35198
|
+
allowConfigDirTemplateSubstitution: true,
|
|
35196
35199
|
isTSConfigOnly: true,
|
|
35197
35200
|
category: Diagnostics.Modules,
|
|
35198
35201
|
description: Diagnostics.Specify_a_set_of_entries_that_re_map_imports_to_additional_lookup_locations,
|
|
@@ -35210,6 +35213,7 @@ var commandOptionsWithoutBuild = [
|
|
|
35210
35213
|
isFilePath: true
|
|
35211
35214
|
},
|
|
35212
35215
|
affectsModuleResolution: true,
|
|
35216
|
+
allowConfigDirTemplateSubstitution: true,
|
|
35213
35217
|
category: Diagnostics.Modules,
|
|
35214
35218
|
description: Diagnostics.Allow_multiple_folders_to_be_treated_as_one_when_resolving_modules,
|
|
35215
35219
|
transpileOptionValue: void 0,
|
|
@@ -35224,6 +35228,7 @@ var commandOptionsWithoutBuild = [
|
|
|
35224
35228
|
isFilePath: true
|
|
35225
35229
|
},
|
|
35226
35230
|
affectsModuleResolution: true,
|
|
35231
|
+
allowConfigDirTemplateSubstitution: true,
|
|
35227
35232
|
category: Diagnostics.Modules,
|
|
35228
35233
|
description: Diagnostics.Specify_multiple_folders_that_act_like_Slashnode_modules_Slash_types
|
|
35229
35234
|
},
|
|
@@ -35738,6 +35743,12 @@ var moduleResolutionOptionDeclarations = optionDeclarations.filter((option) => !
|
|
|
35738
35743
|
var sourceFileAffectingCompilerOptions = optionDeclarations.filter((option) => !!option.affectsSourceFile || !!option.affectsBindDiagnostics);
|
|
35739
35744
|
var optionsAffectingProgramStructure = optionDeclarations.filter((option) => !!option.affectsProgramStructure);
|
|
35740
35745
|
var transpileOptionValueCompilerOptions = optionDeclarations.filter((option) => hasProperty(option, "transpileOptionValue"));
|
|
35746
|
+
var configDirTemplateSubstitutionOptions = optionDeclarations.filter(
|
|
35747
|
+
(option) => option.allowConfigDirTemplateSubstitution || !option.isCommandLineOnly && option.isFilePath
|
|
35748
|
+
);
|
|
35749
|
+
var configDirTemplateSubstitutionWatchOptions = optionsForWatch.filter(
|
|
35750
|
+
(option) => option.allowConfigDirTemplateSubstitution || !option.isCommandLineOnly && option.isFilePath
|
|
35751
|
+
);
|
|
35741
35752
|
var optionsForBuild = [
|
|
35742
35753
|
{
|
|
35743
35754
|
name: "verbose",
|
|
@@ -36521,6 +36532,8 @@ function serializeOptionBaseObject(options, { optionsNameMap }, pathOptions) {
|
|
|
36521
36532
|
if (!customTypeMap) {
|
|
36522
36533
|
if (pathOptions && optionDefinition.isFilePath) {
|
|
36523
36534
|
result.set(name, getRelativePathFromFile(pathOptions.configFilePath, getNormalizedAbsolutePath(value, getDirectoryPath(pathOptions.configFilePath)), getCanonicalFileName));
|
|
36535
|
+
} else if (pathOptions && optionDefinition.type === "list" && optionDefinition.element.isFilePath) {
|
|
36536
|
+
result.set(name, value.map((v) => getRelativePathFromFile(pathOptions.configFilePath, getNormalizedAbsolutePath(v, getDirectoryPath(pathOptions.configFilePath)), getCanonicalFileName)));
|
|
36524
36537
|
} else {
|
|
36525
36538
|
result.set(name, value);
|
|
36526
36539
|
}
|
|
@@ -36705,14 +36718,21 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
|
|
|
36705
36718
|
const errors = [];
|
|
36706
36719
|
const parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors, extendedConfigCache);
|
|
36707
36720
|
const { raw } = parsedConfig;
|
|
36708
|
-
const options =
|
|
36709
|
-
|
|
36721
|
+
const options = handleOptionConfigDirTemplateSubstitution(
|
|
36722
|
+
extend(existingOptions, parsedConfig.options || {}),
|
|
36723
|
+
configDirTemplateSubstitutionOptions,
|
|
36724
|
+
basePath
|
|
36725
|
+
);
|
|
36726
|
+
const watchOptions = handleWatchOptionsConfigDirTemplateSubstitution(
|
|
36727
|
+
existingWatchOptions && parsedConfig.watchOptions ? extend(existingWatchOptions, parsedConfig.watchOptions) : parsedConfig.watchOptions || existingWatchOptions,
|
|
36728
|
+
basePath
|
|
36729
|
+
);
|
|
36710
36730
|
options.configFilePath = configFileName && normalizeSlashes(configFileName);
|
|
36731
|
+
const basePathForFileNames = normalizePath(configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath);
|
|
36711
36732
|
const configFileSpecs = getConfigFileSpecs();
|
|
36712
36733
|
if (sourceFile)
|
|
36713
36734
|
sourceFile.configFileSpecs = configFileSpecs;
|
|
36714
36735
|
setConfigFileInOptions(options, sourceFile);
|
|
36715
|
-
const basePathForFileNames = normalizePath(configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath);
|
|
36716
36736
|
return {
|
|
36717
36737
|
options,
|
|
36718
36738
|
watchOptions,
|
|
@@ -36761,9 +36781,10 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
|
|
|
36761
36781
|
includeSpecs = [defaultIncludeSpec];
|
|
36762
36782
|
isDefaultIncludeSpec = true;
|
|
36763
36783
|
}
|
|
36784
|
+
let validatedIncludeSpecsBeforeSubstitution, validatedExcludeSpecsBeforeSubstitution;
|
|
36764
36785
|
let validatedIncludeSpecs, validatedExcludeSpecs;
|
|
36765
36786
|
if (includeSpecs) {
|
|
36766
|
-
|
|
36787
|
+
validatedIncludeSpecsBeforeSubstitution = validateSpecs(
|
|
36767
36788
|
includeSpecs,
|
|
36768
36789
|
errors,
|
|
36769
36790
|
/*disallowTrailingRecursion*/
|
|
@@ -36771,9 +36792,13 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
|
|
|
36771
36792
|
sourceFile,
|
|
36772
36793
|
"include"
|
|
36773
36794
|
);
|
|
36795
|
+
validatedIncludeSpecs = getSubstitutedStringArrayWithConfigDirTemplate(
|
|
36796
|
+
validatedIncludeSpecsBeforeSubstitution,
|
|
36797
|
+
basePathForFileNames
|
|
36798
|
+
) || validatedIncludeSpecsBeforeSubstitution;
|
|
36774
36799
|
}
|
|
36775
36800
|
if (excludeSpecs) {
|
|
36776
|
-
|
|
36801
|
+
validatedExcludeSpecsBeforeSubstitution = validateSpecs(
|
|
36777
36802
|
excludeSpecs,
|
|
36778
36803
|
errors,
|
|
36779
36804
|
/*disallowTrailingRecursion*/
|
|
@@ -36781,14 +36806,26 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
|
|
|
36781
36806
|
sourceFile,
|
|
36782
36807
|
"exclude"
|
|
36783
36808
|
);
|
|
36809
|
+
validatedExcludeSpecs = getSubstitutedStringArrayWithConfigDirTemplate(
|
|
36810
|
+
validatedExcludeSpecsBeforeSubstitution,
|
|
36811
|
+
basePathForFileNames
|
|
36812
|
+
) || validatedExcludeSpecsBeforeSubstitution;
|
|
36784
36813
|
}
|
|
36814
|
+
const validatedFilesSpecBeforeSubstitution = filter(filesSpecs, isString);
|
|
36815
|
+
const validatedFilesSpec = getSubstitutedStringArrayWithConfigDirTemplate(
|
|
36816
|
+
validatedFilesSpecBeforeSubstitution,
|
|
36817
|
+
basePathForFileNames
|
|
36818
|
+
) || validatedFilesSpecBeforeSubstitution;
|
|
36785
36819
|
return {
|
|
36786
36820
|
filesSpecs,
|
|
36787
36821
|
includeSpecs,
|
|
36788
36822
|
excludeSpecs,
|
|
36789
|
-
validatedFilesSpec
|
|
36823
|
+
validatedFilesSpec,
|
|
36790
36824
|
validatedIncludeSpecs,
|
|
36791
36825
|
validatedExcludeSpecs,
|
|
36826
|
+
validatedFilesSpecBeforeSubstitution,
|
|
36827
|
+
validatedIncludeSpecsBeforeSubstitution,
|
|
36828
|
+
validatedExcludeSpecsBeforeSubstitution,
|
|
36792
36829
|
pathPatterns: void 0,
|
|
36793
36830
|
// Initialized on first use
|
|
36794
36831
|
isDefaultIncludeSpec
|
|
@@ -36847,6 +36884,81 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
|
|
|
36847
36884
|
}
|
|
36848
36885
|
}
|
|
36849
36886
|
}
|
|
36887
|
+
function handleWatchOptionsConfigDirTemplateSubstitution(watchOptions, basePath) {
|
|
36888
|
+
return handleOptionConfigDirTemplateSubstitution(watchOptions, configDirTemplateSubstitutionWatchOptions, basePath);
|
|
36889
|
+
}
|
|
36890
|
+
function handleOptionConfigDirTemplateSubstitution(options, optionDeclarations2, basePath) {
|
|
36891
|
+
if (!options)
|
|
36892
|
+
return options;
|
|
36893
|
+
let result;
|
|
36894
|
+
for (const option of optionDeclarations2) {
|
|
36895
|
+
if (options[option.name] !== void 0) {
|
|
36896
|
+
const value = options[option.name];
|
|
36897
|
+
switch (option.type) {
|
|
36898
|
+
case "string":
|
|
36899
|
+
Debug.assert(option.isFilePath);
|
|
36900
|
+
if (startsWithConfigDirTemplate(value)) {
|
|
36901
|
+
setOptionValue(option, getSubstitutedPathWithConfigDirTemplate(value, basePath));
|
|
36902
|
+
}
|
|
36903
|
+
break;
|
|
36904
|
+
case "list":
|
|
36905
|
+
Debug.assert(option.element.isFilePath);
|
|
36906
|
+
const listResult = getSubstitutedStringArrayWithConfigDirTemplate(value, basePath);
|
|
36907
|
+
if (listResult)
|
|
36908
|
+
setOptionValue(option, listResult);
|
|
36909
|
+
break;
|
|
36910
|
+
case "object":
|
|
36911
|
+
Debug.assert(option.name === "paths");
|
|
36912
|
+
const objectResult = getSubstitutedMapLikeOfStringArrayWithConfigDirTemplate(value, basePath);
|
|
36913
|
+
if (objectResult)
|
|
36914
|
+
setOptionValue(option, objectResult);
|
|
36915
|
+
break;
|
|
36916
|
+
default:
|
|
36917
|
+
Debug.fail("option type not supported");
|
|
36918
|
+
}
|
|
36919
|
+
}
|
|
36920
|
+
}
|
|
36921
|
+
return result || options;
|
|
36922
|
+
function setOptionValue(option, value) {
|
|
36923
|
+
(result ?? (result = assign({}, options)))[option.name] = value;
|
|
36924
|
+
}
|
|
36925
|
+
}
|
|
36926
|
+
var configDirTemplate = `\${configDir}`;
|
|
36927
|
+
function startsWithConfigDirTemplate(value) {
|
|
36928
|
+
return isString(value) && startsWith(
|
|
36929
|
+
value,
|
|
36930
|
+
configDirTemplate,
|
|
36931
|
+
/*ignoreCase*/
|
|
36932
|
+
true
|
|
36933
|
+
);
|
|
36934
|
+
}
|
|
36935
|
+
function getSubstitutedPathWithConfigDirTemplate(value, basePath) {
|
|
36936
|
+
return getNormalizedAbsolutePath(value.replace(configDirTemplate, "./"), basePath);
|
|
36937
|
+
}
|
|
36938
|
+
function getSubstitutedStringArrayWithConfigDirTemplate(list, basePath) {
|
|
36939
|
+
if (!list)
|
|
36940
|
+
return list;
|
|
36941
|
+
let result;
|
|
36942
|
+
list.forEach((element, index) => {
|
|
36943
|
+
if (!startsWithConfigDirTemplate(element))
|
|
36944
|
+
return;
|
|
36945
|
+
(result ?? (result = list.slice()))[index] = getSubstitutedPathWithConfigDirTemplate(element, basePath);
|
|
36946
|
+
});
|
|
36947
|
+
return result;
|
|
36948
|
+
}
|
|
36949
|
+
function getSubstitutedMapLikeOfStringArrayWithConfigDirTemplate(mapLike, basePath) {
|
|
36950
|
+
let result;
|
|
36951
|
+
const ownKeys = getOwnKeys(mapLike);
|
|
36952
|
+
ownKeys.forEach((key) => {
|
|
36953
|
+
if (!isArray(mapLike[key]))
|
|
36954
|
+
return;
|
|
36955
|
+
const subStitution = getSubstitutedStringArrayWithConfigDirTemplate(mapLike[key], basePath);
|
|
36956
|
+
if (!subStitution)
|
|
36957
|
+
return;
|
|
36958
|
+
(result ?? (result = assign({}, mapLike)))[key] = subStitution;
|
|
36959
|
+
});
|
|
36960
|
+
return result;
|
|
36961
|
+
}
|
|
36850
36962
|
function isErrorNoInputFiles(error) {
|
|
36851
36963
|
return error.code === Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2.code;
|
|
36852
36964
|
}
|
|
@@ -36896,11 +37008,11 @@ function parseConfig(json, sourceFile, host, basePath, configFileName, resolutio
|
|
|
36896
37008
|
} else {
|
|
36897
37009
|
ownConfig.extendedConfigPath.forEach((extendedConfigPath) => applyExtendedConfig(result, extendedConfigPath));
|
|
36898
37010
|
}
|
|
36899
|
-
if (
|
|
37011
|
+
if (result.include)
|
|
36900
37012
|
ownConfig.raw.include = result.include;
|
|
36901
|
-
if (
|
|
37013
|
+
if (result.exclude)
|
|
36902
37014
|
ownConfig.raw.exclude = result.exclude;
|
|
36903
|
-
if (
|
|
37015
|
+
if (result.files)
|
|
36904
37016
|
ownConfig.raw.files = result.files;
|
|
36905
37017
|
if (ownConfig.raw.compileOnSave === void 0 && result.compileOnSave)
|
|
36906
37018
|
ownConfig.raw.compileOnSave = result.compileOnSave;
|
|
@@ -36916,8 +37028,10 @@ function parseConfig(json, sourceFile, host, basePath, configFileName, resolutio
|
|
|
36916
37028
|
const extendsRaw = extendedConfig.raw;
|
|
36917
37029
|
let relativeDifference;
|
|
36918
37030
|
const setPropertyInResultIfNotUndefined = (propertyName) => {
|
|
37031
|
+
if (ownConfig.raw[propertyName])
|
|
37032
|
+
return;
|
|
36919
37033
|
if (extendsRaw[propertyName]) {
|
|
36920
|
-
result[propertyName] = map(extendsRaw[propertyName], (path) => isRootedDiskPath(path) ? path : combinePaths(
|
|
37034
|
+
result[propertyName] = map(extendsRaw[propertyName], (path) => startsWithConfigDirTemplate(path) || isRootedDiskPath(path) ? path : combinePaths(
|
|
36921
37035
|
relativeDifference || (relativeDifference = convertToRelativePath(getDirectoryPath(extendedConfigPath), basePath, createGetCanonicalFileName(host.useCaseSensitiveFileNames))),
|
|
36922
37036
|
path
|
|
36923
37037
|
));
|
|
@@ -37185,7 +37299,8 @@ function convertJsonOption(opt, value, basePath, errors, propertyAssignment, val
|
|
|
37185
37299
|
}
|
|
37186
37300
|
function normalizeNonListOptionValue(option, basePath, value) {
|
|
37187
37301
|
if (option.isFilePath) {
|
|
37188
|
-
value =
|
|
37302
|
+
value = normalizeSlashes(value);
|
|
37303
|
+
value = !startsWithConfigDirTemplate(value) ? getNormalizedAbsolutePath(value, basePath) : value;
|
|
37189
37304
|
if (value === "") {
|
|
37190
37305
|
value = ".";
|
|
37191
37306
|
}
|
|
@@ -44909,7 +45024,6 @@ function createTypeChecker(host) {
|
|
|
44909
45024
|
};
|
|
44910
45025
|
var amalgamatedDuplicates;
|
|
44911
45026
|
var reverseMappedCache = /* @__PURE__ */ new Map();
|
|
44912
|
-
var homomorphicMappedTypeInferenceStack = [];
|
|
44913
45027
|
var ambientModulesCache;
|
|
44914
45028
|
var patternAmbientModules;
|
|
44915
45029
|
var patternAmbientModuleAugmentations;
|
|
@@ -45010,6 +45124,9 @@ function createTypeChecker(host) {
|
|
|
45010
45124
|
var potentialReflectCollisions = [];
|
|
45011
45125
|
var potentialUnusedRenamedBindingElementsInTypes = [];
|
|
45012
45126
|
var awaitedTypeStack = [];
|
|
45127
|
+
var reverseMappedSourceStack = [];
|
|
45128
|
+
var reverseMappedTargetStack = [];
|
|
45129
|
+
var reverseExpandingFlags = 0 /* None */;
|
|
45013
45130
|
var diagnostics = createDiagnosticCollection();
|
|
45014
45131
|
var suggestionDiagnostics = createDiagnosticCollection();
|
|
45015
45132
|
var typeofType = createTypeofType();
|
|
@@ -53093,7 +53210,7 @@ function createTypeChecker(host) {
|
|
|
53093
53210
|
result.aliasTypeArguments = length(args) ? args : void 0;
|
|
53094
53211
|
}
|
|
53095
53212
|
}
|
|
53096
|
-
result.objectFlags |= getObjectFlags(type) & 4096 /* JSLiteral
|
|
53213
|
+
result.objectFlags |= getPropagatingFlagsOfTypes([type]) | getObjectFlags(type) & (4096 /* JSLiteral */ | 16384 /* ArrayLiteral */ | 128 /* ObjectLiteral */);
|
|
53097
53214
|
if (result.symbol && result.symbol.flags & 32 /* Class */ && type === getDeclaredTypeOfClassOrInterface(result.symbol)) {
|
|
53098
53215
|
result.objectFlags |= 16777216 /* IsClassInstanceClone */;
|
|
53099
53216
|
}
|
|
@@ -55039,7 +55156,7 @@ function createTypeChecker(host) {
|
|
|
55039
55156
|
const modifiers = getMappedTypeModifiers(type.mappedType);
|
|
55040
55157
|
const readonlyMask = modifiers & 1 /* IncludeReadonly */ ? false : true;
|
|
55041
55158
|
const optionalMask = modifiers & 4 /* IncludeOptional */ ? 0 : 16777216 /* Optional */;
|
|
55042
|
-
const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType), readonlyMask && indexInfo.isReadonly)] : emptyArray;
|
|
55159
|
+
const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType) || unknownType, readonlyMask && indexInfo.isReadonly)] : emptyArray;
|
|
55043
55160
|
const members = createSymbolTable();
|
|
55044
55161
|
const limitedConstraint = getLimitedConstraint(type);
|
|
55045
55162
|
for (const prop of getPropertiesOfType(type.source)) {
|
|
@@ -64859,13 +64976,7 @@ function createTypeChecker(host) {
|
|
|
64859
64976
|
if (reverseMappedCache.has(cacheKey)) {
|
|
64860
64977
|
return reverseMappedCache.get(cacheKey);
|
|
64861
64978
|
}
|
|
64862
|
-
const recursionKey = source.id + "," + (target.target || target).id;
|
|
64863
|
-
if (contains(homomorphicMappedTypeInferenceStack, recursionKey)) {
|
|
64864
|
-
return void 0;
|
|
64865
|
-
}
|
|
64866
|
-
homomorphicMappedTypeInferenceStack.push(recursionKey);
|
|
64867
64979
|
const type = createReverseMappedType(source, target, constraint);
|
|
64868
|
-
homomorphicMappedTypeInferenceStack.pop();
|
|
64869
64980
|
reverseMappedCache.set(cacheKey, type);
|
|
64870
64981
|
return type;
|
|
64871
64982
|
}
|
|
@@ -64877,10 +64988,17 @@ function createTypeChecker(host) {
|
|
|
64877
64988
|
return void 0;
|
|
64878
64989
|
}
|
|
64879
64990
|
if (isArrayType(source)) {
|
|
64880
|
-
|
|
64991
|
+
const elementType = inferReverseMappedType(getTypeArguments(source)[0], target, constraint);
|
|
64992
|
+
if (!elementType) {
|
|
64993
|
+
return void 0;
|
|
64994
|
+
}
|
|
64995
|
+
return createArrayType(elementType, isReadonlyArrayType(source));
|
|
64881
64996
|
}
|
|
64882
64997
|
if (isTupleType(source)) {
|
|
64883
64998
|
const elementTypes = map(getElementTypes(source), (t) => inferReverseMappedType(t, target, constraint));
|
|
64999
|
+
if (!every(elementTypes, (t) => !!t)) {
|
|
65000
|
+
return void 0;
|
|
65001
|
+
}
|
|
64884
65002
|
const elementFlags = getMappedTypeModifiers(target) & 4 /* IncludeOptional */ ? sameMap(source.target.elementFlags, (f) => f & 2 /* Optional */ ? 1 /* Required */ : f) : source.target.elementFlags;
|
|
64885
65003
|
return createTupleType(elementTypes, elementFlags, source.target.readonly, source.target.labeledElementDeclarations);
|
|
64886
65004
|
}
|
|
@@ -64897,17 +65015,39 @@ function createTypeChecker(host) {
|
|
|
64897
65015
|
function getTypeOfReverseMappedSymbol(symbol) {
|
|
64898
65016
|
const links = getSymbolLinks(symbol);
|
|
64899
65017
|
if (!links.type) {
|
|
64900
|
-
links.type = inferReverseMappedType(symbol.links.propertyType, symbol.links.mappedType, symbol.links.constraintType);
|
|
65018
|
+
links.type = inferReverseMappedType(symbol.links.propertyType, symbol.links.mappedType, symbol.links.constraintType) || unknownType;
|
|
64901
65019
|
}
|
|
64902
65020
|
return links.type;
|
|
64903
65021
|
}
|
|
64904
|
-
function
|
|
65022
|
+
function inferReverseMappedTypeWorker(sourceType, target, constraint) {
|
|
64905
65023
|
const typeParameter = getIndexedAccessType(constraint.type, getTypeParameterFromMappedType(target));
|
|
64906
65024
|
const templateType = getTemplateTypeFromMappedType(target);
|
|
64907
65025
|
const inference = createInferenceInfo(typeParameter);
|
|
64908
65026
|
inferTypes([inference], sourceType, templateType);
|
|
64909
65027
|
return getTypeFromInference(inference) || unknownType;
|
|
64910
65028
|
}
|
|
65029
|
+
function inferReverseMappedType(source, target, constraint) {
|
|
65030
|
+
const cacheKey = source.id + "," + target.id + "," + constraint.id;
|
|
65031
|
+
if (reverseMappedCache.has(cacheKey)) {
|
|
65032
|
+
return reverseMappedCache.get(cacheKey) || unknownType;
|
|
65033
|
+
}
|
|
65034
|
+
reverseMappedSourceStack.push(source);
|
|
65035
|
+
reverseMappedTargetStack.push(target);
|
|
65036
|
+
const saveExpandingFlags = reverseExpandingFlags;
|
|
65037
|
+
if (isDeeplyNestedType(source, reverseMappedSourceStack, reverseMappedSourceStack.length, 2))
|
|
65038
|
+
reverseExpandingFlags |= 1 /* Source */;
|
|
65039
|
+
if (isDeeplyNestedType(target, reverseMappedTargetStack, reverseMappedTargetStack.length, 2))
|
|
65040
|
+
reverseExpandingFlags |= 2 /* Target */;
|
|
65041
|
+
let type;
|
|
65042
|
+
if (reverseExpandingFlags !== 3 /* Both */) {
|
|
65043
|
+
type = inferReverseMappedTypeWorker(source, target, constraint);
|
|
65044
|
+
}
|
|
65045
|
+
reverseMappedSourceStack.pop();
|
|
65046
|
+
reverseMappedTargetStack.pop();
|
|
65047
|
+
reverseExpandingFlags = saveExpandingFlags;
|
|
65048
|
+
reverseMappedCache.set(cacheKey, type);
|
|
65049
|
+
return type;
|
|
65050
|
+
}
|
|
64911
65051
|
function* getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties) {
|
|
64912
65052
|
const properties = getPropertiesOfType(target);
|
|
64913
65053
|
for (const targetProp of properties) {
|
|
@@ -123525,7 +123665,8 @@ function getMatchedFileSpec(program, fileName) {
|
|
|
123525
123665
|
return void 0;
|
|
123526
123666
|
const filePath = program.getCanonicalFileName(fileName);
|
|
123527
123667
|
const basePath = getDirectoryPath(getNormalizedAbsolutePath(configFile.fileName, program.getCurrentDirectory()));
|
|
123528
|
-
|
|
123668
|
+
const index = findIndex(configFile.configFileSpecs.validatedFilesSpec, (fileSpec) => program.getCanonicalFileName(getNormalizedAbsolutePath(fileSpec, basePath)) === filePath);
|
|
123669
|
+
return index !== -1 ? configFile.configFileSpecs.validatedFilesSpecBeforeSubstitution[index] : void 0;
|
|
123529
123670
|
}
|
|
123530
123671
|
function getMatchedIncludeSpec(program, fileName) {
|
|
123531
123672
|
var _a, _b;
|
|
@@ -123537,12 +123678,13 @@ function getMatchedIncludeSpec(program, fileName) {
|
|
|
123537
123678
|
const isJsonFile = fileExtensionIs(fileName, ".json" /* Json */);
|
|
123538
123679
|
const basePath = getDirectoryPath(getNormalizedAbsolutePath(configFile.fileName, program.getCurrentDirectory()));
|
|
123539
123680
|
const useCaseSensitiveFileNames2 = program.useCaseSensitiveFileNames();
|
|
123540
|
-
|
|
123681
|
+
const index = findIndex((_b = configFile == null ? void 0 : configFile.configFileSpecs) == null ? void 0 : _b.validatedIncludeSpecs, (includeSpec) => {
|
|
123541
123682
|
if (isJsonFile && !endsWith(includeSpec, ".json" /* Json */))
|
|
123542
123683
|
return false;
|
|
123543
123684
|
const pattern = getPatternFromSpec(includeSpec, basePath, "files");
|
|
123544
123685
|
return !!pattern && getRegexFromPattern(`(${pattern})$`, useCaseSensitiveFileNames2).test(fileName);
|
|
123545
123686
|
});
|
|
123687
|
+
return index !== -1 ? configFile.configFileSpecs.validatedIncludeSpecsBeforeSubstitution[index] : void 0;
|
|
123546
123688
|
}
|
|
123547
123689
|
function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) {
|
|
123548
123690
|
var _a, _b;
|
package/lib/typescript.js
CHANGED
|
@@ -339,6 +339,8 @@ __export(typescript_exports, {
|
|
|
339
339
|
computedOptions: () => computedOptions,
|
|
340
340
|
concatenate: () => concatenate,
|
|
341
341
|
concatenateDiagnosticMessageChains: () => concatenateDiagnosticMessageChains,
|
|
342
|
+
configDirTemplateSubstitutionOptions: () => configDirTemplateSubstitutionOptions,
|
|
343
|
+
configDirTemplateSubstitutionWatchOptions: () => configDirTemplateSubstitutionWatchOptions,
|
|
342
344
|
consumesNodeCoreModules: () => consumesNodeCoreModules,
|
|
343
345
|
contains: () => contains,
|
|
344
346
|
containsIgnoredPath: () => containsIgnoredPath,
|
|
@@ -1109,6 +1111,7 @@ __export(typescript_exports, {
|
|
|
1109
1111
|
groupBy: () => groupBy,
|
|
1110
1112
|
guessIndentation: () => guessIndentation,
|
|
1111
1113
|
handleNoEmitOptions: () => handleNoEmitOptions,
|
|
1114
|
+
handleWatchOptionsConfigDirTemplateSubstitution: () => handleWatchOptionsConfigDirTemplateSubstitution,
|
|
1112
1115
|
hasAbstractModifier: () => hasAbstractModifier,
|
|
1113
1116
|
hasAccessorModifier: () => hasAccessorModifier,
|
|
1114
1117
|
hasAmbientModifier: () => hasAmbientModifier,
|
|
@@ -2347,7 +2350,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2347
2350
|
|
|
2348
2351
|
// src/compiler/corePublic.ts
|
|
2349
2352
|
var versionMajorMinor = "5.5";
|
|
2350
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2353
|
+
var version = `${versionMajorMinor}.0-dev.20240417`;
|
|
2351
2354
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2352
2355
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2353
2356
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -38925,6 +38928,7 @@ var optionsForWatch = [
|
|
|
38925
38928
|
isFilePath: true,
|
|
38926
38929
|
extraValidation: specToDiagnostic
|
|
38927
38930
|
},
|
|
38931
|
+
allowConfigDirTemplateSubstitution: true,
|
|
38928
38932
|
category: Diagnostics.Watch_and_Build_Modes,
|
|
38929
38933
|
description: Diagnostics.Remove_a_list_of_directories_from_the_watch_process
|
|
38930
38934
|
},
|
|
@@ -38937,6 +38941,7 @@ var optionsForWatch = [
|
|
|
38937
38941
|
isFilePath: true,
|
|
38938
38942
|
extraValidation: specToDiagnostic
|
|
38939
38943
|
},
|
|
38944
|
+
allowConfigDirTemplateSubstitution: true,
|
|
38940
38945
|
category: Diagnostics.Watch_and_Build_Modes,
|
|
38941
38946
|
description: Diagnostics.Remove_a_list_of_files_from_the_watch_mode_s_processing
|
|
38942
38947
|
}
|
|
@@ -39635,6 +39640,7 @@ var commandOptionsWithoutBuild = [
|
|
|
39635
39640
|
name: "paths",
|
|
39636
39641
|
type: "object",
|
|
39637
39642
|
affectsModuleResolution: true,
|
|
39643
|
+
allowConfigDirTemplateSubstitution: true,
|
|
39638
39644
|
isTSConfigOnly: true,
|
|
39639
39645
|
category: Diagnostics.Modules,
|
|
39640
39646
|
description: Diagnostics.Specify_a_set_of_entries_that_re_map_imports_to_additional_lookup_locations,
|
|
@@ -39652,6 +39658,7 @@ var commandOptionsWithoutBuild = [
|
|
|
39652
39658
|
isFilePath: true
|
|
39653
39659
|
},
|
|
39654
39660
|
affectsModuleResolution: true,
|
|
39661
|
+
allowConfigDirTemplateSubstitution: true,
|
|
39655
39662
|
category: Diagnostics.Modules,
|
|
39656
39663
|
description: Diagnostics.Allow_multiple_folders_to_be_treated_as_one_when_resolving_modules,
|
|
39657
39664
|
transpileOptionValue: void 0,
|
|
@@ -39666,6 +39673,7 @@ var commandOptionsWithoutBuild = [
|
|
|
39666
39673
|
isFilePath: true
|
|
39667
39674
|
},
|
|
39668
39675
|
affectsModuleResolution: true,
|
|
39676
|
+
allowConfigDirTemplateSubstitution: true,
|
|
39669
39677
|
category: Diagnostics.Modules,
|
|
39670
39678
|
description: Diagnostics.Specify_multiple_folders_that_act_like_Slashnode_modules_Slash_types
|
|
39671
39679
|
},
|
|
@@ -40180,6 +40188,12 @@ var moduleResolutionOptionDeclarations = optionDeclarations.filter((option) => !
|
|
|
40180
40188
|
var sourceFileAffectingCompilerOptions = optionDeclarations.filter((option) => !!option.affectsSourceFile || !!option.affectsBindDiagnostics);
|
|
40181
40189
|
var optionsAffectingProgramStructure = optionDeclarations.filter((option) => !!option.affectsProgramStructure);
|
|
40182
40190
|
var transpileOptionValueCompilerOptions = optionDeclarations.filter((option) => hasProperty(option, "transpileOptionValue"));
|
|
40191
|
+
var configDirTemplateSubstitutionOptions = optionDeclarations.filter(
|
|
40192
|
+
(option) => option.allowConfigDirTemplateSubstitution || !option.isCommandLineOnly && option.isFilePath
|
|
40193
|
+
);
|
|
40194
|
+
var configDirTemplateSubstitutionWatchOptions = optionsForWatch.filter(
|
|
40195
|
+
(option) => option.allowConfigDirTemplateSubstitution || !option.isCommandLineOnly && option.isFilePath
|
|
40196
|
+
);
|
|
40183
40197
|
var optionsForBuild = [
|
|
40184
40198
|
{
|
|
40185
40199
|
name: "verbose",
|
|
@@ -40973,6 +40987,8 @@ function serializeOptionBaseObject(options, { optionsNameMap }, pathOptions) {
|
|
|
40973
40987
|
if (!customTypeMap) {
|
|
40974
40988
|
if (pathOptions && optionDefinition.isFilePath) {
|
|
40975
40989
|
result.set(name, getRelativePathFromFile(pathOptions.configFilePath, getNormalizedAbsolutePath(value, getDirectoryPath(pathOptions.configFilePath)), getCanonicalFileName));
|
|
40990
|
+
} else if (pathOptions && optionDefinition.type === "list" && optionDefinition.element.isFilePath) {
|
|
40991
|
+
result.set(name, value.map((v) => getRelativePathFromFile(pathOptions.configFilePath, getNormalizedAbsolutePath(v, getDirectoryPath(pathOptions.configFilePath)), getCanonicalFileName)));
|
|
40976
40992
|
} else {
|
|
40977
40993
|
result.set(name, value);
|
|
40978
40994
|
}
|
|
@@ -41172,14 +41188,21 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
|
|
|
41172
41188
|
const errors = [];
|
|
41173
41189
|
const parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors, extendedConfigCache);
|
|
41174
41190
|
const { raw } = parsedConfig;
|
|
41175
|
-
const options =
|
|
41176
|
-
|
|
41191
|
+
const options = handleOptionConfigDirTemplateSubstitution(
|
|
41192
|
+
extend(existingOptions, parsedConfig.options || {}),
|
|
41193
|
+
configDirTemplateSubstitutionOptions,
|
|
41194
|
+
basePath
|
|
41195
|
+
);
|
|
41196
|
+
const watchOptions = handleWatchOptionsConfigDirTemplateSubstitution(
|
|
41197
|
+
existingWatchOptions && parsedConfig.watchOptions ? extend(existingWatchOptions, parsedConfig.watchOptions) : parsedConfig.watchOptions || existingWatchOptions,
|
|
41198
|
+
basePath
|
|
41199
|
+
);
|
|
41177
41200
|
options.configFilePath = configFileName && normalizeSlashes(configFileName);
|
|
41201
|
+
const basePathForFileNames = normalizePath(configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath);
|
|
41178
41202
|
const configFileSpecs = getConfigFileSpecs();
|
|
41179
41203
|
if (sourceFile)
|
|
41180
41204
|
sourceFile.configFileSpecs = configFileSpecs;
|
|
41181
41205
|
setConfigFileInOptions(options, sourceFile);
|
|
41182
|
-
const basePathForFileNames = normalizePath(configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath);
|
|
41183
41206
|
return {
|
|
41184
41207
|
options,
|
|
41185
41208
|
watchOptions,
|
|
@@ -41228,9 +41251,10 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
|
|
|
41228
41251
|
includeSpecs = [defaultIncludeSpec];
|
|
41229
41252
|
isDefaultIncludeSpec = true;
|
|
41230
41253
|
}
|
|
41254
|
+
let validatedIncludeSpecsBeforeSubstitution, validatedExcludeSpecsBeforeSubstitution;
|
|
41231
41255
|
let validatedIncludeSpecs, validatedExcludeSpecs;
|
|
41232
41256
|
if (includeSpecs) {
|
|
41233
|
-
|
|
41257
|
+
validatedIncludeSpecsBeforeSubstitution = validateSpecs(
|
|
41234
41258
|
includeSpecs,
|
|
41235
41259
|
errors,
|
|
41236
41260
|
/*disallowTrailingRecursion*/
|
|
@@ -41238,9 +41262,13 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
|
|
|
41238
41262
|
sourceFile,
|
|
41239
41263
|
"include"
|
|
41240
41264
|
);
|
|
41265
|
+
validatedIncludeSpecs = getSubstitutedStringArrayWithConfigDirTemplate(
|
|
41266
|
+
validatedIncludeSpecsBeforeSubstitution,
|
|
41267
|
+
basePathForFileNames
|
|
41268
|
+
) || validatedIncludeSpecsBeforeSubstitution;
|
|
41241
41269
|
}
|
|
41242
41270
|
if (excludeSpecs) {
|
|
41243
|
-
|
|
41271
|
+
validatedExcludeSpecsBeforeSubstitution = validateSpecs(
|
|
41244
41272
|
excludeSpecs,
|
|
41245
41273
|
errors,
|
|
41246
41274
|
/*disallowTrailingRecursion*/
|
|
@@ -41248,14 +41276,26 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
|
|
|
41248
41276
|
sourceFile,
|
|
41249
41277
|
"exclude"
|
|
41250
41278
|
);
|
|
41279
|
+
validatedExcludeSpecs = getSubstitutedStringArrayWithConfigDirTemplate(
|
|
41280
|
+
validatedExcludeSpecsBeforeSubstitution,
|
|
41281
|
+
basePathForFileNames
|
|
41282
|
+
) || validatedExcludeSpecsBeforeSubstitution;
|
|
41251
41283
|
}
|
|
41284
|
+
const validatedFilesSpecBeforeSubstitution = filter(filesSpecs, isString);
|
|
41285
|
+
const validatedFilesSpec = getSubstitutedStringArrayWithConfigDirTemplate(
|
|
41286
|
+
validatedFilesSpecBeforeSubstitution,
|
|
41287
|
+
basePathForFileNames
|
|
41288
|
+
) || validatedFilesSpecBeforeSubstitution;
|
|
41252
41289
|
return {
|
|
41253
41290
|
filesSpecs,
|
|
41254
41291
|
includeSpecs,
|
|
41255
41292
|
excludeSpecs,
|
|
41256
|
-
validatedFilesSpec
|
|
41293
|
+
validatedFilesSpec,
|
|
41257
41294
|
validatedIncludeSpecs,
|
|
41258
41295
|
validatedExcludeSpecs,
|
|
41296
|
+
validatedFilesSpecBeforeSubstitution,
|
|
41297
|
+
validatedIncludeSpecsBeforeSubstitution,
|
|
41298
|
+
validatedExcludeSpecsBeforeSubstitution,
|
|
41259
41299
|
pathPatterns: void 0,
|
|
41260
41300
|
// Initialized on first use
|
|
41261
41301
|
isDefaultIncludeSpec
|
|
@@ -41314,6 +41354,81 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
|
|
|
41314
41354
|
}
|
|
41315
41355
|
}
|
|
41316
41356
|
}
|
|
41357
|
+
function handleWatchOptionsConfigDirTemplateSubstitution(watchOptions, basePath) {
|
|
41358
|
+
return handleOptionConfigDirTemplateSubstitution(watchOptions, configDirTemplateSubstitutionWatchOptions, basePath);
|
|
41359
|
+
}
|
|
41360
|
+
function handleOptionConfigDirTemplateSubstitution(options, optionDeclarations2, basePath) {
|
|
41361
|
+
if (!options)
|
|
41362
|
+
return options;
|
|
41363
|
+
let result;
|
|
41364
|
+
for (const option of optionDeclarations2) {
|
|
41365
|
+
if (options[option.name] !== void 0) {
|
|
41366
|
+
const value = options[option.name];
|
|
41367
|
+
switch (option.type) {
|
|
41368
|
+
case "string":
|
|
41369
|
+
Debug.assert(option.isFilePath);
|
|
41370
|
+
if (startsWithConfigDirTemplate(value)) {
|
|
41371
|
+
setOptionValue(option, getSubstitutedPathWithConfigDirTemplate(value, basePath));
|
|
41372
|
+
}
|
|
41373
|
+
break;
|
|
41374
|
+
case "list":
|
|
41375
|
+
Debug.assert(option.element.isFilePath);
|
|
41376
|
+
const listResult = getSubstitutedStringArrayWithConfigDirTemplate(value, basePath);
|
|
41377
|
+
if (listResult)
|
|
41378
|
+
setOptionValue(option, listResult);
|
|
41379
|
+
break;
|
|
41380
|
+
case "object":
|
|
41381
|
+
Debug.assert(option.name === "paths");
|
|
41382
|
+
const objectResult = getSubstitutedMapLikeOfStringArrayWithConfigDirTemplate(value, basePath);
|
|
41383
|
+
if (objectResult)
|
|
41384
|
+
setOptionValue(option, objectResult);
|
|
41385
|
+
break;
|
|
41386
|
+
default:
|
|
41387
|
+
Debug.fail("option type not supported");
|
|
41388
|
+
}
|
|
41389
|
+
}
|
|
41390
|
+
}
|
|
41391
|
+
return result || options;
|
|
41392
|
+
function setOptionValue(option, value) {
|
|
41393
|
+
(result ?? (result = assign({}, options)))[option.name] = value;
|
|
41394
|
+
}
|
|
41395
|
+
}
|
|
41396
|
+
var configDirTemplate = `\${configDir}`;
|
|
41397
|
+
function startsWithConfigDirTemplate(value) {
|
|
41398
|
+
return isString(value) && startsWith(
|
|
41399
|
+
value,
|
|
41400
|
+
configDirTemplate,
|
|
41401
|
+
/*ignoreCase*/
|
|
41402
|
+
true
|
|
41403
|
+
);
|
|
41404
|
+
}
|
|
41405
|
+
function getSubstitutedPathWithConfigDirTemplate(value, basePath) {
|
|
41406
|
+
return getNormalizedAbsolutePath(value.replace(configDirTemplate, "./"), basePath);
|
|
41407
|
+
}
|
|
41408
|
+
function getSubstitutedStringArrayWithConfigDirTemplate(list, basePath) {
|
|
41409
|
+
if (!list)
|
|
41410
|
+
return list;
|
|
41411
|
+
let result;
|
|
41412
|
+
list.forEach((element, index) => {
|
|
41413
|
+
if (!startsWithConfigDirTemplate(element))
|
|
41414
|
+
return;
|
|
41415
|
+
(result ?? (result = list.slice()))[index] = getSubstitutedPathWithConfigDirTemplate(element, basePath);
|
|
41416
|
+
});
|
|
41417
|
+
return result;
|
|
41418
|
+
}
|
|
41419
|
+
function getSubstitutedMapLikeOfStringArrayWithConfigDirTemplate(mapLike, basePath) {
|
|
41420
|
+
let result;
|
|
41421
|
+
const ownKeys = getOwnKeys(mapLike);
|
|
41422
|
+
ownKeys.forEach((key) => {
|
|
41423
|
+
if (!isArray(mapLike[key]))
|
|
41424
|
+
return;
|
|
41425
|
+
const subStitution = getSubstitutedStringArrayWithConfigDirTemplate(mapLike[key], basePath);
|
|
41426
|
+
if (!subStitution)
|
|
41427
|
+
return;
|
|
41428
|
+
(result ?? (result = assign({}, mapLike)))[key] = subStitution;
|
|
41429
|
+
});
|
|
41430
|
+
return result;
|
|
41431
|
+
}
|
|
41317
41432
|
function isErrorNoInputFiles(error2) {
|
|
41318
41433
|
return error2.code === Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2.code;
|
|
41319
41434
|
}
|
|
@@ -41363,11 +41478,11 @@ function parseConfig(json, sourceFile, host, basePath, configFileName, resolutio
|
|
|
41363
41478
|
} else {
|
|
41364
41479
|
ownConfig.extendedConfigPath.forEach((extendedConfigPath) => applyExtendedConfig(result, extendedConfigPath));
|
|
41365
41480
|
}
|
|
41366
|
-
if (
|
|
41481
|
+
if (result.include)
|
|
41367
41482
|
ownConfig.raw.include = result.include;
|
|
41368
|
-
if (
|
|
41483
|
+
if (result.exclude)
|
|
41369
41484
|
ownConfig.raw.exclude = result.exclude;
|
|
41370
|
-
if (
|
|
41485
|
+
if (result.files)
|
|
41371
41486
|
ownConfig.raw.files = result.files;
|
|
41372
41487
|
if (ownConfig.raw.compileOnSave === void 0 && result.compileOnSave)
|
|
41373
41488
|
ownConfig.raw.compileOnSave = result.compileOnSave;
|
|
@@ -41383,8 +41498,10 @@ function parseConfig(json, sourceFile, host, basePath, configFileName, resolutio
|
|
|
41383
41498
|
const extendsRaw = extendedConfig.raw;
|
|
41384
41499
|
let relativeDifference;
|
|
41385
41500
|
const setPropertyInResultIfNotUndefined = (propertyName) => {
|
|
41501
|
+
if (ownConfig.raw[propertyName])
|
|
41502
|
+
return;
|
|
41386
41503
|
if (extendsRaw[propertyName]) {
|
|
41387
|
-
result[propertyName] = map(extendsRaw[propertyName], (path) => isRootedDiskPath(path) ? path : combinePaths(
|
|
41504
|
+
result[propertyName] = map(extendsRaw[propertyName], (path) => startsWithConfigDirTemplate(path) || isRootedDiskPath(path) ? path : combinePaths(
|
|
41388
41505
|
relativeDifference || (relativeDifference = convertToRelativePath(getDirectoryPath(extendedConfigPath), basePath, createGetCanonicalFileName(host.useCaseSensitiveFileNames))),
|
|
41389
41506
|
path
|
|
41390
41507
|
));
|
|
@@ -41662,7 +41779,8 @@ function convertJsonOption(opt, value, basePath, errors, propertyAssignment, val
|
|
|
41662
41779
|
}
|
|
41663
41780
|
function normalizeNonListOptionValue(option, basePath, value) {
|
|
41664
41781
|
if (option.isFilePath) {
|
|
41665
|
-
value =
|
|
41782
|
+
value = normalizeSlashes(value);
|
|
41783
|
+
value = !startsWithConfigDirTemplate(value) ? getNormalizedAbsolutePath(value, basePath) : value;
|
|
41666
41784
|
if (value === "") {
|
|
41667
41785
|
value = ".";
|
|
41668
41786
|
}
|
|
@@ -49707,7 +49825,6 @@ function createTypeChecker(host) {
|
|
|
49707
49825
|
};
|
|
49708
49826
|
var amalgamatedDuplicates;
|
|
49709
49827
|
var reverseMappedCache = /* @__PURE__ */ new Map();
|
|
49710
|
-
var homomorphicMappedTypeInferenceStack = [];
|
|
49711
49828
|
var ambientModulesCache;
|
|
49712
49829
|
var patternAmbientModules;
|
|
49713
49830
|
var patternAmbientModuleAugmentations;
|
|
@@ -49808,6 +49925,9 @@ function createTypeChecker(host) {
|
|
|
49808
49925
|
var potentialReflectCollisions = [];
|
|
49809
49926
|
var potentialUnusedRenamedBindingElementsInTypes = [];
|
|
49810
49927
|
var awaitedTypeStack = [];
|
|
49928
|
+
var reverseMappedSourceStack = [];
|
|
49929
|
+
var reverseMappedTargetStack = [];
|
|
49930
|
+
var reverseExpandingFlags = 0 /* None */;
|
|
49811
49931
|
var diagnostics = createDiagnosticCollection();
|
|
49812
49932
|
var suggestionDiagnostics = createDiagnosticCollection();
|
|
49813
49933
|
var typeofType = createTypeofType();
|
|
@@ -57891,7 +58011,7 @@ function createTypeChecker(host) {
|
|
|
57891
58011
|
result.aliasTypeArguments = length(args) ? args : void 0;
|
|
57892
58012
|
}
|
|
57893
58013
|
}
|
|
57894
|
-
result.objectFlags |= getObjectFlags(type) & 4096 /* JSLiteral
|
|
58014
|
+
result.objectFlags |= getPropagatingFlagsOfTypes([type]) | getObjectFlags(type) & (4096 /* JSLiteral */ | 16384 /* ArrayLiteral */ | 128 /* ObjectLiteral */);
|
|
57895
58015
|
if (result.symbol && result.symbol.flags & 32 /* Class */ && type === getDeclaredTypeOfClassOrInterface(result.symbol)) {
|
|
57896
58016
|
result.objectFlags |= 16777216 /* IsClassInstanceClone */;
|
|
57897
58017
|
}
|
|
@@ -59837,7 +59957,7 @@ function createTypeChecker(host) {
|
|
|
59837
59957
|
const modifiers = getMappedTypeModifiers(type.mappedType);
|
|
59838
59958
|
const readonlyMask = modifiers & 1 /* IncludeReadonly */ ? false : true;
|
|
59839
59959
|
const optionalMask = modifiers & 4 /* IncludeOptional */ ? 0 : 16777216 /* Optional */;
|
|
59840
|
-
const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType), readonlyMask && indexInfo.isReadonly)] : emptyArray;
|
|
59960
|
+
const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType) || unknownType, readonlyMask && indexInfo.isReadonly)] : emptyArray;
|
|
59841
59961
|
const members = createSymbolTable();
|
|
59842
59962
|
const limitedConstraint = getLimitedConstraint(type);
|
|
59843
59963
|
for (const prop of getPropertiesOfType(type.source)) {
|
|
@@ -69657,13 +69777,7 @@ function createTypeChecker(host) {
|
|
|
69657
69777
|
if (reverseMappedCache.has(cacheKey)) {
|
|
69658
69778
|
return reverseMappedCache.get(cacheKey);
|
|
69659
69779
|
}
|
|
69660
|
-
const recursionKey = source.id + "," + (target.target || target).id;
|
|
69661
|
-
if (contains(homomorphicMappedTypeInferenceStack, recursionKey)) {
|
|
69662
|
-
return void 0;
|
|
69663
|
-
}
|
|
69664
|
-
homomorphicMappedTypeInferenceStack.push(recursionKey);
|
|
69665
69780
|
const type = createReverseMappedType(source, target, constraint);
|
|
69666
|
-
homomorphicMappedTypeInferenceStack.pop();
|
|
69667
69781
|
reverseMappedCache.set(cacheKey, type);
|
|
69668
69782
|
return type;
|
|
69669
69783
|
}
|
|
@@ -69675,10 +69789,17 @@ function createTypeChecker(host) {
|
|
|
69675
69789
|
return void 0;
|
|
69676
69790
|
}
|
|
69677
69791
|
if (isArrayType(source)) {
|
|
69678
|
-
|
|
69792
|
+
const elementType = inferReverseMappedType(getTypeArguments(source)[0], target, constraint);
|
|
69793
|
+
if (!elementType) {
|
|
69794
|
+
return void 0;
|
|
69795
|
+
}
|
|
69796
|
+
return createArrayType(elementType, isReadonlyArrayType(source));
|
|
69679
69797
|
}
|
|
69680
69798
|
if (isTupleType(source)) {
|
|
69681
69799
|
const elementTypes = map(getElementTypes(source), (t) => inferReverseMappedType(t, target, constraint));
|
|
69800
|
+
if (!every(elementTypes, (t) => !!t)) {
|
|
69801
|
+
return void 0;
|
|
69802
|
+
}
|
|
69682
69803
|
const elementFlags = getMappedTypeModifiers(target) & 4 /* IncludeOptional */ ? sameMap(source.target.elementFlags, (f) => f & 2 /* Optional */ ? 1 /* Required */ : f) : source.target.elementFlags;
|
|
69683
69804
|
return createTupleType(elementTypes, elementFlags, source.target.readonly, source.target.labeledElementDeclarations);
|
|
69684
69805
|
}
|
|
@@ -69695,17 +69816,39 @@ function createTypeChecker(host) {
|
|
|
69695
69816
|
function getTypeOfReverseMappedSymbol(symbol) {
|
|
69696
69817
|
const links = getSymbolLinks(symbol);
|
|
69697
69818
|
if (!links.type) {
|
|
69698
|
-
links.type = inferReverseMappedType(symbol.links.propertyType, symbol.links.mappedType, symbol.links.constraintType);
|
|
69819
|
+
links.type = inferReverseMappedType(symbol.links.propertyType, symbol.links.mappedType, symbol.links.constraintType) || unknownType;
|
|
69699
69820
|
}
|
|
69700
69821
|
return links.type;
|
|
69701
69822
|
}
|
|
69702
|
-
function
|
|
69823
|
+
function inferReverseMappedTypeWorker(sourceType, target, constraint) {
|
|
69703
69824
|
const typeParameter = getIndexedAccessType(constraint.type, getTypeParameterFromMappedType(target));
|
|
69704
69825
|
const templateType = getTemplateTypeFromMappedType(target);
|
|
69705
69826
|
const inference = createInferenceInfo(typeParameter);
|
|
69706
69827
|
inferTypes([inference], sourceType, templateType);
|
|
69707
69828
|
return getTypeFromInference(inference) || unknownType;
|
|
69708
69829
|
}
|
|
69830
|
+
function inferReverseMappedType(source, target, constraint) {
|
|
69831
|
+
const cacheKey = source.id + "," + target.id + "," + constraint.id;
|
|
69832
|
+
if (reverseMappedCache.has(cacheKey)) {
|
|
69833
|
+
return reverseMappedCache.get(cacheKey) || unknownType;
|
|
69834
|
+
}
|
|
69835
|
+
reverseMappedSourceStack.push(source);
|
|
69836
|
+
reverseMappedTargetStack.push(target);
|
|
69837
|
+
const saveExpandingFlags = reverseExpandingFlags;
|
|
69838
|
+
if (isDeeplyNestedType(source, reverseMappedSourceStack, reverseMappedSourceStack.length, 2))
|
|
69839
|
+
reverseExpandingFlags |= 1 /* Source */;
|
|
69840
|
+
if (isDeeplyNestedType(target, reverseMappedTargetStack, reverseMappedTargetStack.length, 2))
|
|
69841
|
+
reverseExpandingFlags |= 2 /* Target */;
|
|
69842
|
+
let type;
|
|
69843
|
+
if (reverseExpandingFlags !== 3 /* Both */) {
|
|
69844
|
+
type = inferReverseMappedTypeWorker(source, target, constraint);
|
|
69845
|
+
}
|
|
69846
|
+
reverseMappedSourceStack.pop();
|
|
69847
|
+
reverseMappedTargetStack.pop();
|
|
69848
|
+
reverseExpandingFlags = saveExpandingFlags;
|
|
69849
|
+
reverseMappedCache.set(cacheKey, type);
|
|
69850
|
+
return type;
|
|
69851
|
+
}
|
|
69709
69852
|
function* getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties) {
|
|
69710
69853
|
const properties = getPropertiesOfType(target);
|
|
69711
69854
|
for (const targetProp of properties) {
|
|
@@ -128608,7 +128751,8 @@ function getMatchedFileSpec(program, fileName) {
|
|
|
128608
128751
|
return void 0;
|
|
128609
128752
|
const filePath = program.getCanonicalFileName(fileName);
|
|
128610
128753
|
const basePath = getDirectoryPath(getNormalizedAbsolutePath(configFile.fileName, program.getCurrentDirectory()));
|
|
128611
|
-
|
|
128754
|
+
const index = findIndex(configFile.configFileSpecs.validatedFilesSpec, (fileSpec) => program.getCanonicalFileName(getNormalizedAbsolutePath(fileSpec, basePath)) === filePath);
|
|
128755
|
+
return index !== -1 ? configFile.configFileSpecs.validatedFilesSpecBeforeSubstitution[index] : void 0;
|
|
128612
128756
|
}
|
|
128613
128757
|
function getMatchedIncludeSpec(program, fileName) {
|
|
128614
128758
|
var _a, _b;
|
|
@@ -128620,12 +128764,13 @@ function getMatchedIncludeSpec(program, fileName) {
|
|
|
128620
128764
|
const isJsonFile = fileExtensionIs(fileName, ".json" /* Json */);
|
|
128621
128765
|
const basePath = getDirectoryPath(getNormalizedAbsolutePath(configFile.fileName, program.getCurrentDirectory()));
|
|
128622
128766
|
const useCaseSensitiveFileNames2 = program.useCaseSensitiveFileNames();
|
|
128623
|
-
|
|
128767
|
+
const index = findIndex((_b = configFile == null ? void 0 : configFile.configFileSpecs) == null ? void 0 : _b.validatedIncludeSpecs, (includeSpec) => {
|
|
128624
128768
|
if (isJsonFile && !endsWith(includeSpec, ".json" /* Json */))
|
|
128625
128769
|
return false;
|
|
128626
128770
|
const pattern = getPatternFromSpec(includeSpec, basePath, "files");
|
|
128627
128771
|
return !!pattern && getRegexFromPattern(`(${pattern})$`, useCaseSensitiveFileNames2).test(fileName);
|
|
128628
128772
|
});
|
|
128773
|
+
return index !== -1 ? configFile.configFileSpecs.validatedIncludeSpecsBeforeSubstitution[index] : void 0;
|
|
128629
128774
|
}
|
|
128630
128775
|
function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) {
|
|
128631
128776
|
var _a, _b;
|
|
@@ -176028,6 +176173,8 @@ __export(ts_exports2, {
|
|
|
176028
176173
|
computedOptions: () => computedOptions,
|
|
176029
176174
|
concatenate: () => concatenate,
|
|
176030
176175
|
concatenateDiagnosticMessageChains: () => concatenateDiagnosticMessageChains,
|
|
176176
|
+
configDirTemplateSubstitutionOptions: () => configDirTemplateSubstitutionOptions,
|
|
176177
|
+
configDirTemplateSubstitutionWatchOptions: () => configDirTemplateSubstitutionWatchOptions,
|
|
176031
176178
|
consumesNodeCoreModules: () => consumesNodeCoreModules,
|
|
176032
176179
|
contains: () => contains,
|
|
176033
176180
|
containsIgnoredPath: () => containsIgnoredPath,
|
|
@@ -176798,6 +176945,7 @@ __export(ts_exports2, {
|
|
|
176798
176945
|
groupBy: () => groupBy,
|
|
176799
176946
|
guessIndentation: () => guessIndentation,
|
|
176800
176947
|
handleNoEmitOptions: () => handleNoEmitOptions,
|
|
176948
|
+
handleWatchOptionsConfigDirTemplateSubstitution: () => handleWatchOptionsConfigDirTemplateSubstitution,
|
|
176801
176949
|
hasAbstractModifier: () => hasAbstractModifier,
|
|
176802
176950
|
hasAccessorModifier: () => hasAccessorModifier,
|
|
176803
176951
|
hasAmbientModifier: () => hasAmbientModifier,
|
|
@@ -183023,7 +183171,7 @@ var _ProjectService = class _ProjectService {
|
|
|
183023
183171
|
});
|
|
183024
183172
|
},
|
|
183025
183173
|
flags,
|
|
183026
|
-
this.getWatchOptionsFromProjectWatchOptions(config.parsedCommandLine.watchOptions),
|
|
183174
|
+
this.getWatchOptionsFromProjectWatchOptions(config.parsedCommandLine.watchOptions, getDirectoryPath(configFileName)),
|
|
183027
183175
|
WatchType.WildcardDirectory,
|
|
183028
183176
|
configFileName
|
|
183029
183177
|
);
|
|
@@ -183313,7 +183461,7 @@ var _ProjectService = class _ProjectService {
|
|
|
183313
183461
|
configFileName,
|
|
183314
183462
|
(_fileName, eventKind) => this.onConfigFileChanged(canonicalConfigFilePath, eventKind),
|
|
183315
183463
|
2e3 /* High */,
|
|
183316
|
-
this.getWatchOptionsFromProjectWatchOptions((_b = (_a = configFileExistenceInfo == null ? void 0 : configFileExistenceInfo.config) == null ? void 0 : _a.parsedCommandLine) == null ? void 0 : _b.watchOptions),
|
|
183464
|
+
this.getWatchOptionsFromProjectWatchOptions((_b = (_a = configFileExistenceInfo == null ? void 0 : configFileExistenceInfo.config) == null ? void 0 : _a.parsedCommandLine) == null ? void 0 : _b.watchOptions, getDirectoryPath(configFileName)),
|
|
183317
183465
|
WatchType.ConfigFile,
|
|
183318
183466
|
forProject
|
|
183319
183467
|
);
|
|
@@ -183742,15 +183890,16 @@ var _ProjectService = class _ProjectService {
|
|
|
183742
183890
|
const configFileErrors = configFile.parseDiagnostics;
|
|
183743
183891
|
if (!isString(configFileContent))
|
|
183744
183892
|
configFileErrors.push(configFileContent);
|
|
183893
|
+
const configDir = getDirectoryPath(configFilename);
|
|
183745
183894
|
const parsedCommandLine = parseJsonSourceFileConfigFileContent(
|
|
183746
183895
|
configFile,
|
|
183747
183896
|
cachedDirectoryStructureHost,
|
|
183748
|
-
|
|
183897
|
+
configDir,
|
|
183749
183898
|
/*existingOptions*/
|
|
183750
|
-
|
|
183899
|
+
void 0,
|
|
183751
183900
|
configFilename,
|
|
183752
183901
|
/*resolutionStack*/
|
|
183753
|
-
|
|
183902
|
+
void 0,
|
|
183754
183903
|
this.hostConfiguration.extraFileExtensions,
|
|
183755
183904
|
this.extendedConfigCache
|
|
183756
183905
|
);
|
|
@@ -183780,10 +183929,11 @@ var _ProjectService = class _ProjectService {
|
|
|
183780
183929
|
// Old options
|
|
183781
183930
|
this.getWatchOptionsFromProjectWatchOptions(
|
|
183782
183931
|
/*projectOptions*/
|
|
183783
|
-
void 0
|
|
183932
|
+
void 0,
|
|
183933
|
+
configDir
|
|
183784
183934
|
),
|
|
183785
183935
|
// New options
|
|
183786
|
-
this.getWatchOptionsFromProjectWatchOptions(parsedCommandLine.watchOptions)
|
|
183936
|
+
this.getWatchOptionsFromProjectWatchOptions(parsedCommandLine.watchOptions, configDir)
|
|
183787
183937
|
)) {
|
|
183788
183938
|
(_c = configFileExistenceInfo.watcher) == null ? void 0 : _c.close();
|
|
183789
183939
|
configFileExistenceInfo.watcher = void 0;
|
|
@@ -184551,18 +184701,25 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184551
184701
|
this.logger.info("Host file extension mappings updated");
|
|
184552
184702
|
}
|
|
184553
184703
|
if (args.watchOptions) {
|
|
184554
|
-
|
|
184704
|
+
const watchOptions = (_a = convertWatchOptions(args.watchOptions)) == null ? void 0 : _a.watchOptions;
|
|
184705
|
+
const substitution = handleWatchOptionsConfigDirTemplateSubstitution(watchOptions, this.currentDirectory);
|
|
184706
|
+
this.hostConfiguration.watchOptions = substitution;
|
|
184707
|
+
this.hostConfiguration.beforeSubstitution = substitution === watchOptions ? void 0 : watchOptions;
|
|
184555
184708
|
this.logger.info(`Host watch options changed to ${JSON.stringify(this.hostConfiguration.watchOptions)}, it will be take effect for next watches.`);
|
|
184556
184709
|
}
|
|
184557
184710
|
}
|
|
184558
184711
|
}
|
|
184559
184712
|
/** @internal */
|
|
184560
184713
|
getWatchOptions(project) {
|
|
184561
|
-
return this.getWatchOptionsFromProjectWatchOptions(project.getWatchOptions());
|
|
184714
|
+
return this.getWatchOptionsFromProjectWatchOptions(project.getWatchOptions(), project.getCurrentDirectory());
|
|
184562
184715
|
}
|
|
184563
184716
|
/** @internal */
|
|
184564
|
-
getWatchOptionsFromProjectWatchOptions(projectOptions) {
|
|
184565
|
-
|
|
184717
|
+
getWatchOptionsFromProjectWatchOptions(projectOptions, basePath) {
|
|
184718
|
+
const hostWatchOptions = !this.hostConfiguration.beforeSubstitution ? this.hostConfiguration.watchOptions : handleWatchOptionsConfigDirTemplateSubstitution(
|
|
184719
|
+
this.hostConfiguration.beforeSubstitution,
|
|
184720
|
+
basePath
|
|
184721
|
+
);
|
|
184722
|
+
return projectOptions && hostWatchOptions ? { ...hostWatchOptions, ...projectOptions } : projectOptions || hostWatchOptions;
|
|
184566
184723
|
}
|
|
184567
184724
|
closeLog() {
|
|
184568
184725
|
this.logger.close();
|
|
@@ -190410,6 +190567,8 @@ if (typeof console !== "undefined") {
|
|
|
190410
190567
|
computedOptions,
|
|
190411
190568
|
concatenate,
|
|
190412
190569
|
concatenateDiagnosticMessageChains,
|
|
190570
|
+
configDirTemplateSubstitutionOptions,
|
|
190571
|
+
configDirTemplateSubstitutionWatchOptions,
|
|
190413
190572
|
consumesNodeCoreModules,
|
|
190414
190573
|
contains,
|
|
190415
190574
|
containsIgnoredPath,
|
|
@@ -191180,6 +191339,7 @@ if (typeof console !== "undefined") {
|
|
|
191180
191339
|
groupBy,
|
|
191181
191340
|
guessIndentation,
|
|
191182
191341
|
handleNoEmitOptions,
|
|
191342
|
+
handleWatchOptionsConfigDirTemplateSubstitution,
|
|
191183
191343
|
hasAbstractModifier,
|
|
191184
191344
|
hasAccessorModifier,
|
|
191185
191345
|
hasAmbientModifier,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.5.0-dev.
|
|
5
|
+
"version": "5.5.0-dev.20240417",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -111,5 +111,5 @@
|
|
|
111
111
|
"node": "20.1.0",
|
|
112
112
|
"npm": "8.19.4"
|
|
113
113
|
},
|
|
114
|
-
"gitHead": "
|
|
114
|
+
"gitHead": "cbae6cf9f4f98cb97dd2eedfc3d0faa5c523759a"
|
|
115
115
|
}
|