typescript 4.9.0-dev.20220831 → 4.9.0-dev.20220903
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 +38 -35
- package/lib/tsserver.js +46 -44
- package/lib/tsserverlibrary.d.ts +0 -1
- package/lib/tsserverlibrary.js +45 -43
- package/lib/typescript.js +38 -36
- package/lib/typescriptServices.js +38 -36
- package/lib/typingsInstaller.js +38 -36
- 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.9";
|
|
72
|
-
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.
|
|
72
|
+
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220903");
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -36780,7 +36780,7 @@ var ts;
|
|
|
36780
36780
|
var _a, _b;
|
|
36781
36781
|
if (path === undefined)
|
|
36782
36782
|
return path;
|
|
36783
|
-
return ts.
|
|
36783
|
+
return ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
36784
36784
|
}
|
|
36785
36785
|
function combineDirectoryPath(root, dir) {
|
|
36786
36786
|
return ts.ensureTrailingDirectorySeparator(ts.combinePaths(root, dir));
|
|
@@ -36795,7 +36795,7 @@ var ts;
|
|
|
36795
36795
|
if ((extensions === Extensions.TypeScript || extensions === Extensions.JavaScript || extensions === Extensions.Json)
|
|
36796
36796
|
&& (state.compilerOptions.declarationDir || state.compilerOptions.outDir)
|
|
36797
36797
|
&& finalPath.indexOf("/node_modules/") === -1
|
|
36798
|
-
&& (state.compilerOptions.configFile ? ts.
|
|
36798
|
+
&& (state.compilerOptions.configFile ? ts.containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames()) : true)) {
|
|
36799
36799
|
var getCanonicalFileName = ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames });
|
|
36800
36800
|
var commonSourceDirGuesses = [];
|
|
36801
36801
|
if (state.compilerOptions.rootDir || (state.compilerOptions.composite && state.compilerOptions.configFilePath)) {
|
|
@@ -36825,7 +36825,7 @@ var ts;
|
|
|
36825
36825
|
var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
|
|
36826
36826
|
for (var _e = 0, candidateDirectories_1 = candidateDirectories; _e < candidateDirectories_1.length; _e++) {
|
|
36827
36827
|
var candidateDir = candidateDirectories_1[_e];
|
|
36828
|
-
if (ts.
|
|
36828
|
+
if (ts.containsPath(candidateDir, finalPath, !useCaseSensitiveFileNames())) {
|
|
36829
36829
|
var pathFragment = finalPath.slice(candidateDir.length + 1);
|
|
36830
36830
|
var possibleInputBase = ts.combinePaths(commonSourceDirGuess, pathFragment);
|
|
36831
36831
|
var jsAndDtsExtensions = [".mjs", ".cjs", ".js", ".json", ".d.mts", ".d.cts", ".d.ts"];
|
|
@@ -51995,7 +51995,7 @@ var ts;
|
|
|
51995
51995
|
return includes & 8388608 ? wildcardType : anyType;
|
|
51996
51996
|
}
|
|
51997
51997
|
if (!strictNullChecks && includes & 98304) {
|
|
51998
|
-
return includes & 32768 ? undefinedType : nullType;
|
|
51998
|
+
return includes & 16777216 ? neverType : includes & 32768 ? undefinedType : nullType;
|
|
51999
51999
|
}
|
|
52000
52000
|
if (includes & 4 && includes & (128 | 134217728 | 268435456) ||
|
|
52001
52001
|
includes & 8 && includes & 256 ||
|
|
@@ -52630,7 +52630,7 @@ var ts;
|
|
|
52630
52630
|
type;
|
|
52631
52631
|
}
|
|
52632
52632
|
function distributeIndexOverObjectType(objectType, indexType, writing) {
|
|
52633
|
-
if (objectType.flags &
|
|
52633
|
+
if (objectType.flags & 1048576 || objectType.flags & 2097152 && !shouldDeferIndexType(objectType)) {
|
|
52634
52634
|
var types = ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType), writing); });
|
|
52635
52635
|
return objectType.flags & 2097152 || writing ? getIntersectionType(types) : getUnionType(types);
|
|
52636
52636
|
}
|
|
@@ -54762,7 +54762,7 @@ var ts;
|
|
|
54762
54762
|
if (reduced !== type) {
|
|
54763
54763
|
return reduced;
|
|
54764
54764
|
}
|
|
54765
|
-
if (type.flags & 2097152) {
|
|
54765
|
+
if (type.flags & 2097152 && ts.some(type.types, isEmptyAnonymousObjectType)) {
|
|
54766
54766
|
var normalizedTypes = ts.sameMap(type.types, function (t) { return getNormalizedType(t, writing); });
|
|
54767
54767
|
if (normalizedTypes !== type.types) {
|
|
54768
54768
|
return getIntersectionType(normalizedTypes);
|
|
@@ -60174,7 +60174,7 @@ var ts;
|
|
|
60174
60174
|
var narrowedPropType = narrowType(propType);
|
|
60175
60175
|
return filterType(type, function (t) {
|
|
60176
60176
|
var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
|
|
60177
|
-
return !(narrowedPropType.flags & 131072) &&
|
|
60177
|
+
return !(narrowedPropType.flags & 131072) && areTypesComparable(narrowedPropType, discriminantType);
|
|
60178
60178
|
});
|
|
60179
60179
|
}
|
|
60180
60180
|
function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) {
|
|
@@ -60223,7 +60223,7 @@ var ts;
|
|
|
60223
60223
|
}
|
|
60224
60224
|
function narrowByInKeyword(type, name, assumeTrue) {
|
|
60225
60225
|
if (type.flags & 1048576
|
|
60226
|
-
|| type.flags & 524288 && declaredType !== type
|
|
60226
|
+
|| type.flags & 524288 && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type))
|
|
60227
60227
|
|| ts.isThisTypeParameter(type)
|
|
60228
60228
|
|| type.flags & 2097152 && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) {
|
|
60229
60229
|
return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
|
|
@@ -60343,14 +60343,18 @@ var ts;
|
|
|
60343
60343
|
assumeTrue = !assumeTrue;
|
|
60344
60344
|
}
|
|
60345
60345
|
var valueType = getTypeOfExpression(value);
|
|
60346
|
-
if ((type.flags & 2)
|
|
60346
|
+
if (((type.flags & 2) || isEmptyAnonymousObjectType(type) && !(valueType.flags & 98304)) &&
|
|
60347
|
+
assumeTrue &&
|
|
60348
|
+
(operator === 36 || operator === 37)) {
|
|
60347
60349
|
if (valueType.flags & (131068 | 67108864)) {
|
|
60348
60350
|
return valueType;
|
|
60349
60351
|
}
|
|
60350
60352
|
if (valueType.flags & 524288) {
|
|
60351
60353
|
return nonPrimitiveType;
|
|
60352
60354
|
}
|
|
60353
|
-
|
|
60355
|
+
if (type.flags & 2) {
|
|
60356
|
+
return type;
|
|
60357
|
+
}
|
|
60354
60358
|
}
|
|
60355
60359
|
if (valueType.flags & 98304) {
|
|
60356
60360
|
if (!strictNullChecks) {
|
|
@@ -60381,11 +60385,18 @@ var ts;
|
|
|
60381
60385
|
}
|
|
60382
60386
|
var target = getReferenceCandidate(typeOfExpr.expression);
|
|
60383
60387
|
if (!isMatchingReference(reference, target)) {
|
|
60388
|
+
var propertyAccess = getDiscriminantPropertyAccess(typeOfExpr.expression, type);
|
|
60389
|
+
if (propertyAccess) {
|
|
60390
|
+
return narrowTypeByDiscriminant(type, propertyAccess, function (t) { return narrowTypeByLiteralExpression(t, literal, assumeTrue); });
|
|
60391
|
+
}
|
|
60384
60392
|
if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
|
|
60385
60393
|
return getAdjustedTypeWithFacts(type, 2097152);
|
|
60386
60394
|
}
|
|
60387
60395
|
return type;
|
|
60388
60396
|
}
|
|
60397
|
+
return narrowTypeByLiteralExpression(type, literal, assumeTrue);
|
|
60398
|
+
}
|
|
60399
|
+
function narrowTypeByLiteralExpression(type, literal, assumeTrue) {
|
|
60389
60400
|
return assumeTrue ?
|
|
60390
60401
|
narrowTypeByTypeName(type, literal.text) :
|
|
60391
60402
|
getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768);
|
|
@@ -62693,6 +62704,7 @@ var ts;
|
|
|
62693
62704
|
}
|
|
62694
62705
|
function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) {
|
|
62695
62706
|
var attributes = openingLikeElement.attributes;
|
|
62707
|
+
var attributesType = getContextualType(attributes, 0);
|
|
62696
62708
|
var allAttributesTable = strictNullChecks ? ts.createSymbolTable() : undefined;
|
|
62697
62709
|
var attributesTable = ts.createSymbolTable();
|
|
62698
62710
|
var spread = emptyJsxObjectType;
|
|
@@ -62720,6 +62732,12 @@ var ts;
|
|
|
62720
62732
|
if (attributeDecl.name.escapedText === jsxChildrenPropertyName) {
|
|
62721
62733
|
explicitlySpecifyChildrenAttribute = true;
|
|
62722
62734
|
}
|
|
62735
|
+
if (attributesType) {
|
|
62736
|
+
var prop = getPropertyOfType(attributesType, member.escapedName);
|
|
62737
|
+
if (prop && prop.declarations && isDeprecatedSymbol(prop)) {
|
|
62738
|
+
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
62739
|
+
}
|
|
62740
|
+
}
|
|
62723
62741
|
}
|
|
62724
62742
|
else {
|
|
62725
62743
|
ts.Debug.assert(attributeDecl.kind === 289);
|
|
@@ -99887,10 +99905,12 @@ var ts;
|
|
|
99887
99905
|
if (options.preserveConstEnums === false) {
|
|
99888
99906
|
createDiagnosticForOptionName(ts.Diagnostics.Option_preserveConstEnums_cannot_be_disabled_when_isolatedModules_is_enabled, "preserveConstEnums", "isolatedModules");
|
|
99889
99907
|
}
|
|
99890
|
-
var
|
|
99891
|
-
|
|
99892
|
-
|
|
99893
|
-
|
|
99908
|
+
for (var _a = 0, files_5 = files; _a < files_5.length; _a++) {
|
|
99909
|
+
var file = files_5[_a];
|
|
99910
|
+
if (!ts.isExternalModule(file) && !ts.isSourceFileJS(file) && !file.isDeclarationFile && file.scriptKind !== 6) {
|
|
99911
|
+
var span = ts.getErrorSpanForNode(file, file);
|
|
99912
|
+
programDiagnostics.add(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(file.fileName)));
|
|
99913
|
+
}
|
|
99894
99914
|
}
|
|
99895
99915
|
}
|
|
99896
99916
|
else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 && options.module === ts.ModuleKind.None) {
|
|
@@ -105875,9 +105895,7 @@ var ts;
|
|
|
105875
105895
|
}
|
|
105876
105896
|
}
|
|
105877
105897
|
}
|
|
105878
|
-
var seenRefs = buildInfoPath ? new ts.Set() : undefined;
|
|
105879
105898
|
var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
|
|
105880
|
-
seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
|
|
105881
105899
|
var pseudoUpToDate = false;
|
|
105882
105900
|
var usesPrepend = false;
|
|
105883
105901
|
var upstreamChangedProject;
|
|
@@ -105888,7 +105906,7 @@ var ts;
|
|
|
105888
105906
|
if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
|
|
105889
105907
|
continue;
|
|
105890
105908
|
}
|
|
105891
|
-
if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry,
|
|
105909
|
+
if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, resolvedRefPath)) {
|
|
105892
105910
|
return {
|
|
105893
105911
|
type: ts.UpToDateStatusType.OutOfDateWithUpstream,
|
|
105894
105912
|
outOfDateOutputFileName: buildInfoPath,
|
|
@@ -105939,24 +105957,9 @@ var ts;
|
|
|
105939
105957
|
oldestOutputFileName: oldestOutputFileName
|
|
105940
105958
|
};
|
|
105941
105959
|
}
|
|
105942
|
-
function hasSameBuildInfo(state, buildInfoCacheEntry,
|
|
105943
|
-
if (seenRefs.has(resolvedRefPath))
|
|
105944
|
-
return false;
|
|
105945
|
-
seenRefs.add(resolvedRefPath);
|
|
105960
|
+
function hasSameBuildInfo(state, buildInfoCacheEntry, resolvedRefPath) {
|
|
105946
105961
|
var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
|
|
105947
|
-
|
|
105948
|
-
return true;
|
|
105949
|
-
if (resolvedConfig.projectReferences) {
|
|
105950
|
-
for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
|
|
105951
|
-
var ref = _a[_i];
|
|
105952
|
-
var resolvedRef = ts.resolveProjectReferencePath(ref);
|
|
105953
|
-
var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
|
|
105954
|
-
var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
|
|
105955
|
-
if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
|
|
105956
|
-
return true;
|
|
105957
|
-
}
|
|
105958
|
-
}
|
|
105959
|
-
return false;
|
|
105962
|
+
return refBuildInfo.path === buildInfoCacheEntry.path;
|
|
105960
105963
|
}
|
|
105961
105964
|
function getUpToDateStatus(state, project, resolvedPath) {
|
|
105962
105965
|
if (project === undefined) {
|
package/lib/tsserver.js
CHANGED
|
@@ -109,7 +109,7 @@ var ts;
|
|
|
109
109
|
// The following is baselined as a literal template type without intervention
|
|
110
110
|
/** The version of the TypeScript compiler release */
|
|
111
111
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
112
|
-
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.
|
|
112
|
+
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220903");
|
|
113
113
|
/* @internal */
|
|
114
114
|
var Comparison;
|
|
115
115
|
(function (Comparison) {
|
|
@@ -44881,7 +44881,7 @@ var ts;
|
|
|
44881
44881
|
var _a, _b;
|
|
44882
44882
|
if (path === undefined)
|
|
44883
44883
|
return path;
|
|
44884
|
-
return ts.
|
|
44884
|
+
return ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
44885
44885
|
}
|
|
44886
44886
|
function combineDirectoryPath(root, dir) {
|
|
44887
44887
|
return ts.ensureTrailingDirectorySeparator(ts.combinePaths(root, dir));
|
|
@@ -44901,7 +44901,7 @@ var ts;
|
|
|
44901
44901
|
if ((extensions === Extensions.TypeScript || extensions === Extensions.JavaScript || extensions === Extensions.Json)
|
|
44902
44902
|
&& (state.compilerOptions.declarationDir || state.compilerOptions.outDir)
|
|
44903
44903
|
&& finalPath.indexOf("/node_modules/") === -1
|
|
44904
|
-
&& (state.compilerOptions.configFile ? ts.
|
|
44904
|
+
&& (state.compilerOptions.configFile ? ts.containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames()) : true)) {
|
|
44905
44905
|
// So that all means we'll only try these guesses for files outside `node_modules` in a directory where the `package.json` and `tsconfig.json` are siblings.
|
|
44906
44906
|
// Even with all that, we still don't know if the root of the output file structure will be (relative to the package file)
|
|
44907
44907
|
// `.`, `./src` or any other deeper directory structure. (If project references are used, it's definitely `.` by fiat, so that should be pretty common.)
|
|
@@ -44957,7 +44957,7 @@ var ts;
|
|
|
44957
44957
|
var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
|
|
44958
44958
|
for (var _e = 0, candidateDirectories_1 = candidateDirectories; _e < candidateDirectories_1.length; _e++) {
|
|
44959
44959
|
var candidateDir = candidateDirectories_1[_e];
|
|
44960
|
-
if (ts.
|
|
44960
|
+
if (ts.containsPath(candidateDir, finalPath, !useCaseSensitiveFileNames())) {
|
|
44961
44961
|
// The matched export is looking up something in either the out declaration or js dir, now map the written path back into the source dir and source extension
|
|
44962
44962
|
var pathFragment = finalPath.slice(candidateDir.length + 1); // +1 to also remove directory seperator
|
|
44963
44963
|
var possibleInputBase = ts.combinePaths(commonSourceDirGuess, pathFragment);
|
|
@@ -62527,7 +62527,7 @@ var ts;
|
|
|
62527
62527
|
return includes & 8388608 /* TypeFlags.IncludesWildcard */ ? wildcardType : anyType;
|
|
62528
62528
|
}
|
|
62529
62529
|
if (!strictNullChecks && includes & 98304 /* TypeFlags.Nullable */) {
|
|
62530
|
-
return includes & 32768 /* TypeFlags.Undefined */ ? undefinedType : nullType;
|
|
62530
|
+
return includes & 16777216 /* TypeFlags.IncludesEmptyObject */ ? neverType : includes & 32768 /* TypeFlags.Undefined */ ? undefinedType : nullType;
|
|
62531
62531
|
}
|
|
62532
62532
|
if (includes & 4 /* TypeFlags.String */ && includes & (128 /* TypeFlags.StringLiteral */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */) ||
|
|
62533
62533
|
includes & 8 /* TypeFlags.Number */ && includes & 256 /* TypeFlags.NumberLiteral */ ||
|
|
@@ -63217,7 +63217,7 @@ var ts;
|
|
|
63217
63217
|
// (T | U)[K] -> T[K] | U[K] (reading)
|
|
63218
63218
|
// (T | U)[K] -> T[K] & U[K] (writing)
|
|
63219
63219
|
// (T & U)[K] -> T[K] & U[K]
|
|
63220
|
-
if (objectType.flags &
|
|
63220
|
+
if (objectType.flags & 1048576 /* TypeFlags.Union */ || objectType.flags & 2097152 /* TypeFlags.Intersection */ && !shouldDeferIndexType(objectType)) {
|
|
63221
63221
|
var types = ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType), writing); });
|
|
63222
63222
|
return objectType.flags & 2097152 /* TypeFlags.Intersection */ || writing ? getIntersectionType(types) : getUnionType(types);
|
|
63223
63223
|
}
|
|
@@ -65621,7 +65621,7 @@ var ts;
|
|
|
65621
65621
|
if (reduced !== type) {
|
|
65622
65622
|
return reduced;
|
|
65623
65623
|
}
|
|
65624
|
-
if (type.flags & 2097152 /* TypeFlags.Intersection */) {
|
|
65624
|
+
if (type.flags & 2097152 /* TypeFlags.Intersection */ && ts.some(type.types, isEmptyAnonymousObjectType)) {
|
|
65625
65625
|
var normalizedTypes = ts.sameMap(type.types, function (t) { return getNormalizedType(t, writing); });
|
|
65626
65626
|
if (normalizedTypes !== type.types) {
|
|
65627
65627
|
return getIntersectionType(normalizedTypes);
|
|
@@ -71919,7 +71919,7 @@ var ts;
|
|
|
71919
71919
|
var narrowedPropType = narrowType(propType);
|
|
71920
71920
|
return filterType(type, function (t) {
|
|
71921
71921
|
var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
|
|
71922
|
-
return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) &&
|
|
71922
|
+
return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType);
|
|
71923
71923
|
});
|
|
71924
71924
|
}
|
|
71925
71925
|
function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) {
|
|
@@ -71968,7 +71968,7 @@ var ts;
|
|
|
71968
71968
|
}
|
|
71969
71969
|
function narrowByInKeyword(type, name, assumeTrue) {
|
|
71970
71970
|
if (type.flags & 1048576 /* TypeFlags.Union */
|
|
71971
|
-
|| type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type
|
|
71971
|
+
|| type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type))
|
|
71972
71972
|
|| ts.isThisTypeParameter(type)
|
|
71973
71973
|
|| type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) {
|
|
71974
71974
|
return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
|
|
@@ -72101,14 +72101,18 @@ var ts;
|
|
|
72101
72101
|
assumeTrue = !assumeTrue;
|
|
72102
72102
|
}
|
|
72103
72103
|
var valueType = getTypeOfExpression(value);
|
|
72104
|
-
if ((type.flags & 2 /* TypeFlags.Unknown */)
|
|
72104
|
+
if (((type.flags & 2 /* TypeFlags.Unknown */) || isEmptyAnonymousObjectType(type) && !(valueType.flags & 98304 /* TypeFlags.Nullable */)) &&
|
|
72105
|
+
assumeTrue &&
|
|
72106
|
+
(operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */)) {
|
|
72105
72107
|
if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */)) {
|
|
72106
72108
|
return valueType;
|
|
72107
72109
|
}
|
|
72108
72110
|
if (valueType.flags & 524288 /* TypeFlags.Object */) {
|
|
72109
72111
|
return nonPrimitiveType;
|
|
72110
72112
|
}
|
|
72111
|
-
|
|
72113
|
+
if (type.flags & 2 /* TypeFlags.Unknown */) {
|
|
72114
|
+
return type;
|
|
72115
|
+
}
|
|
72112
72116
|
}
|
|
72113
72117
|
if (valueType.flags & 98304 /* TypeFlags.Nullable */) {
|
|
72114
72118
|
if (!strictNullChecks) {
|
|
@@ -72140,11 +72144,18 @@ var ts;
|
|
|
72140
72144
|
}
|
|
72141
72145
|
var target = getReferenceCandidate(typeOfExpr.expression);
|
|
72142
72146
|
if (!isMatchingReference(reference, target)) {
|
|
72147
|
+
var propertyAccess = getDiscriminantPropertyAccess(typeOfExpr.expression, type);
|
|
72148
|
+
if (propertyAccess) {
|
|
72149
|
+
return narrowTypeByDiscriminant(type, propertyAccess, function (t) { return narrowTypeByLiteralExpression(t, literal, assumeTrue); });
|
|
72150
|
+
}
|
|
72143
72151
|
if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
|
|
72144
72152
|
return getAdjustedTypeWithFacts(type, 2097152 /* TypeFacts.NEUndefinedOrNull */);
|
|
72145
72153
|
}
|
|
72146
72154
|
return type;
|
|
72147
72155
|
}
|
|
72156
|
+
return narrowTypeByLiteralExpression(type, literal, assumeTrue);
|
|
72157
|
+
}
|
|
72158
|
+
function narrowTypeByLiteralExpression(type, literal, assumeTrue) {
|
|
72148
72159
|
return assumeTrue ?
|
|
72149
72160
|
narrowTypeByTypeName(type, literal.text) :
|
|
72150
72161
|
getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768 /* TypeFacts.TypeofNEHostObject */);
|
|
@@ -74917,6 +74928,7 @@ var ts;
|
|
|
74917
74928
|
*/
|
|
74918
74929
|
function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) {
|
|
74919
74930
|
var attributes = openingLikeElement.attributes;
|
|
74931
|
+
var attributesType = getContextualType(attributes, 0 /* ContextFlags.None */);
|
|
74920
74932
|
var allAttributesTable = strictNullChecks ? ts.createSymbolTable() : undefined;
|
|
74921
74933
|
var attributesTable = ts.createSymbolTable();
|
|
74922
74934
|
var spread = emptyJsxObjectType;
|
|
@@ -74944,6 +74956,12 @@ var ts;
|
|
|
74944
74956
|
if (attributeDecl.name.escapedText === jsxChildrenPropertyName) {
|
|
74945
74957
|
explicitlySpecifyChildrenAttribute = true;
|
|
74946
74958
|
}
|
|
74959
|
+
if (attributesType) {
|
|
74960
|
+
var prop = getPropertyOfType(attributesType, member.escapedName);
|
|
74961
|
+
if (prop && prop.declarations && isDeprecatedSymbol(prop)) {
|
|
74962
|
+
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
74963
|
+
}
|
|
74964
|
+
}
|
|
74947
74965
|
}
|
|
74948
74966
|
else {
|
|
74949
74967
|
ts.Debug.assert(attributeDecl.kind === 289 /* SyntaxKind.JsxSpreadAttribute */);
|
|
@@ -120607,10 +120625,12 @@ var ts;
|
|
|
120607
120625
|
if (options.preserveConstEnums === false) {
|
|
120608
120626
|
createDiagnosticForOptionName(ts.Diagnostics.Option_preserveConstEnums_cannot_be_disabled_when_isolatedModules_is_enabled, "preserveConstEnums", "isolatedModules");
|
|
120609
120627
|
}
|
|
120610
|
-
var
|
|
120611
|
-
|
|
120612
|
-
|
|
120613
|
-
|
|
120628
|
+
for (var _a = 0, files_5 = files; _a < files_5.length; _a++) {
|
|
120629
|
+
var file = files_5[_a];
|
|
120630
|
+
if (!ts.isExternalModule(file) && !ts.isSourceFileJS(file) && !file.isDeclarationFile && file.scriptKind !== 6 /* ScriptKind.JSON */) {
|
|
120631
|
+
var span = ts.getErrorSpanForNode(file, file);
|
|
120632
|
+
programDiagnostics.add(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(file.fileName)));
|
|
120633
|
+
}
|
|
120614
120634
|
}
|
|
120615
120635
|
}
|
|
120616
120636
|
else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 /* ScriptTarget.ES2015 */ && options.module === ts.ModuleKind.None) {
|
|
@@ -127391,9 +127411,7 @@ var ts;
|
|
|
127391
127411
|
}
|
|
127392
127412
|
}
|
|
127393
127413
|
}
|
|
127394
|
-
var seenRefs = buildInfoPath ? new ts.Set() : undefined;
|
|
127395
127414
|
var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
|
|
127396
|
-
seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
|
|
127397
127415
|
/** Inputs are up-to-date, just need either timestamp update or bundle prepend manipulation to make it look up-to-date */
|
|
127398
127416
|
var pseudoUpToDate = false;
|
|
127399
127417
|
var usesPrepend = false;
|
|
@@ -127408,7 +127426,7 @@ var ts;
|
|
|
127408
127426
|
continue;
|
|
127409
127427
|
}
|
|
127410
127428
|
// Check if tsbuildinfo path is shared, then we need to rebuild
|
|
127411
|
-
if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry,
|
|
127429
|
+
if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, resolvedRefPath)) {
|
|
127412
127430
|
return {
|
|
127413
127431
|
type: ts.UpToDateStatusType.OutOfDateWithUpstream,
|
|
127414
127432
|
outOfDateOutputFileName: buildInfoPath,
|
|
@@ -127466,25 +127484,9 @@ var ts;
|
|
|
127466
127484
|
oldestOutputFileName: oldestOutputFileName
|
|
127467
127485
|
};
|
|
127468
127486
|
}
|
|
127469
|
-
function hasSameBuildInfo(state, buildInfoCacheEntry,
|
|
127470
|
-
if (seenRefs.has(resolvedRefPath))
|
|
127471
|
-
return false;
|
|
127472
|
-
seenRefs.add(resolvedRefPath);
|
|
127487
|
+
function hasSameBuildInfo(state, buildInfoCacheEntry, resolvedRefPath) {
|
|
127473
127488
|
var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
|
|
127474
|
-
|
|
127475
|
-
return true;
|
|
127476
|
-
if (resolvedConfig.projectReferences) {
|
|
127477
|
-
// Check references
|
|
127478
|
-
for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
|
|
127479
|
-
var ref = _a[_i];
|
|
127480
|
-
var resolvedRef = ts.resolveProjectReferencePath(ref);
|
|
127481
|
-
var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
|
|
127482
|
-
var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
|
|
127483
|
-
if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
|
|
127484
|
-
return true;
|
|
127485
|
-
}
|
|
127486
|
-
}
|
|
127487
|
-
return false;
|
|
127489
|
+
return refBuildInfo.path === buildInfoCacheEntry.path;
|
|
127488
127490
|
}
|
|
127489
127491
|
function getUpToDateStatus(state, project, resolvedPath) {
|
|
127490
127492
|
if (project === undefined) {
|
|
@@ -172211,13 +172213,13 @@ var ts;
|
|
|
172211
172213
|
return __generator(this, function (_a) {
|
|
172212
172214
|
switch (_a.label) {
|
|
172213
172215
|
case 0:
|
|
172214
|
-
ts.Debug.assertIsDefined(host.
|
|
172216
|
+
ts.Debug.assertIsDefined(host.importPlugin);
|
|
172215
172217
|
resolvedPath = ts.combinePaths(initialDir, "node_modules");
|
|
172216
172218
|
log("Dynamically importing ".concat(moduleName, " from ").concat(initialDir, " (resolved to ").concat(resolvedPath, ")"));
|
|
172217
172219
|
_a.label = 1;
|
|
172218
172220
|
case 1:
|
|
172219
172221
|
_a.trys.push([1, 3, , 4]);
|
|
172220
|
-
return [4 /*yield*/, host.
|
|
172222
|
+
return [4 /*yield*/, host.importPlugin(resolvedPath, moduleName)];
|
|
172221
172223
|
case 2:
|
|
172222
172224
|
result = _a.sent();
|
|
172223
172225
|
return [3 /*break*/, 4];
|
|
@@ -173296,7 +173298,7 @@ var ts;
|
|
|
173296
173298
|
};
|
|
173297
173299
|
Project.prototype.enableGlobalPlugins = function (options, pluginConfigOverrides) {
|
|
173298
173300
|
var host = this.projectService.host;
|
|
173299
|
-
if (!host.require && !host.
|
|
173301
|
+
if (!host.require && !host.importPlugin) {
|
|
173300
173302
|
this.projectService.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
|
|
173301
173303
|
return;
|
|
173302
173304
|
}
|
|
@@ -173353,7 +173355,7 @@ var ts;
|
|
|
173353
173355
|
return __generator(this, function (_a) {
|
|
173354
173356
|
switch (_a.label) {
|
|
173355
173357
|
case 0:
|
|
173356
|
-
ts.Debug.assertIsDefined(this.projectService.host.
|
|
173358
|
+
ts.Debug.assertIsDefined(this.projectService.host.importPlugin);
|
|
173357
173359
|
log = function (message) { return _this.projectService.logger.info(message); };
|
|
173358
173360
|
logError = function (message) {
|
|
173359
173361
|
(errorLogs !== null && errorLogs !== void 0 ? errorLogs : (errorLogs = [])).push(message);
|
|
@@ -174054,7 +174056,7 @@ var ts;
|
|
|
174054
174056
|
/*@internal*/
|
|
174055
174057
|
ConfiguredProject.prototype.enablePluginsWithOptions = function (options, pluginConfigOverrides) {
|
|
174056
174058
|
var host = this.projectService.host;
|
|
174057
|
-
if (!host.require && !host.
|
|
174059
|
+
if (!host.require && !host.importPlugin) {
|
|
174058
174060
|
this.projectService.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
|
|
174059
174061
|
return;
|
|
174060
174062
|
}
|
|
@@ -177498,7 +177500,7 @@ var ts;
|
|
|
177498
177500
|
/*@internal*/
|
|
177499
177501
|
ProjectService.prototype.requestEnablePlugin = function (project, pluginConfigEntry, searchPaths, pluginConfigOverrides) {
|
|
177500
177502
|
var _a;
|
|
177501
|
-
if (!this.host.
|
|
177503
|
+
if (!this.host.importPlugin && !this.host.require) {
|
|
177502
177504
|
this.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
|
|
177503
177505
|
return;
|
|
177504
177506
|
}
|
|
@@ -177508,7 +177510,7 @@ var ts;
|
|
|
177508
177510
|
return;
|
|
177509
177511
|
}
|
|
177510
177512
|
// If the host supports dynamic import, begin enabling the plugin asynchronously.
|
|
177511
|
-
if (this.host.
|
|
177513
|
+
if (this.host.importPlugin) {
|
|
177512
177514
|
var importPromise = project.beginEnablePluginAsync(pluginConfigEntry, searchPaths, pluginConfigOverrides);
|
|
177513
177515
|
(_a = this.pendingPluginEnablements) !== null && _a !== void 0 ? _a : (this.pendingPluginEnablements = new ts.Map());
|
|
177514
177516
|
var promises = this.pendingPluginEnablements.get(project);
|
|
@@ -181807,7 +181809,7 @@ var ts;
|
|
|
181807
181809
|
setImmediate: function (x) { return setTimeout(x, 0); },
|
|
181808
181810
|
clearImmediate: function (handle) { return clearTimeout(handle); },
|
|
181809
181811
|
/* eslint-enable no-restricted-globals */
|
|
181810
|
-
|
|
181812
|
+
importPlugin: function (initialDir, moduleName) { return __awaiter(_this, void 0, void 0, function () {
|
|
181811
181813
|
var packageRoot, packageJson, packageJsonResponse, e_1, browser, scriptPath, module_1, e_2;
|
|
181812
181814
|
return __generator(this, function (_a) {
|
|
181813
181815
|
switch (_a.label) {
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -7044,7 +7044,6 @@ declare namespace ts.server {
|
|
|
7044
7044
|
gc?(): void;
|
|
7045
7045
|
trace?(s: string): void;
|
|
7046
7046
|
require?(initialPath: string, moduleName: string): ModuleImportResult;
|
|
7047
|
-
importServicePlugin?(root: string, moduleName: string): Promise<ModuleImportResult>;
|
|
7048
7047
|
}
|
|
7049
7048
|
}
|
|
7050
7049
|
declare namespace ts.server {
|