@typescript-deploys/pr-build 5.1.0-pr-53098-13 → 5.1.0-pr-50951-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +88 -67
- package/lib/tsserver.js +88 -77
- package/lib/tsserverlibrary.d.ts +1 -1
- package/lib/tsserverlibrary.js +89 -77
- package/lib/typescript.d.ts +1 -1
- package/lib/typescript.js +89 -76
- package/lib/typingsInstaller.js +39 -23
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -23,7 +23,7 @@ var __export = (target, all) => {
|
|
|
23
23
|
|
|
24
24
|
// src/compiler/corePublic.ts
|
|
25
25
|
var versionMajorMinor = "5.1";
|
|
26
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
26
|
+
var version = `${versionMajorMinor}.0-insiders.20230313`;
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -1306,7 +1306,7 @@ function trimEndImpl(s) {
|
|
|
1306
1306
|
return s.slice(0, end + 1);
|
|
1307
1307
|
}
|
|
1308
1308
|
function isNodeLikeSystem() {
|
|
1309
|
-
return typeof process !== "undefined" && process.nextTick && !process.browser && typeof module === "object";
|
|
1309
|
+
return typeof process !== "undefined" && !!process.nextTick && !process.browser && typeof module === "object";
|
|
1310
1310
|
}
|
|
1311
1311
|
|
|
1312
1312
|
// src/compiler/debug.ts
|
|
@@ -4914,7 +4914,7 @@ var sys = (() => {
|
|
|
4914
4914
|
getAccessibleSortedChildDirectories: (path) => getAccessibleFileSystemEntries(path).directories,
|
|
4915
4915
|
realpath,
|
|
4916
4916
|
tscWatchFile: process.env.TSC_WATCHFILE,
|
|
4917
|
-
useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER,
|
|
4917
|
+
useNonPollingWatchers: !!process.env.TSC_NONPOLLING_WATCHER,
|
|
4918
4918
|
tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
|
|
4919
4919
|
inodeWatching: isLinuxOrMacOs,
|
|
4920
4920
|
sysLog
|
|
@@ -5000,8 +5000,10 @@ var sys = (() => {
|
|
|
5000
5000
|
process.stdout.write("\x1Bc");
|
|
5001
5001
|
},
|
|
5002
5002
|
setBlocking: () => {
|
|
5003
|
-
|
|
5004
|
-
|
|
5003
|
+
var _a2;
|
|
5004
|
+
const handle = (_a2 = process.stdout) == null ? void 0 : _a2._handle;
|
|
5005
|
+
if (handle && handle.setBlocking) {
|
|
5006
|
+
handle.setBlocking(true);
|
|
5005
5007
|
}
|
|
5006
5008
|
},
|
|
5007
5009
|
bufferFrom,
|
|
@@ -10279,32 +10281,36 @@ function getModifiers(node) {
|
|
|
10279
10281
|
return filter(node.modifiers, isModifier);
|
|
10280
10282
|
}
|
|
10281
10283
|
}
|
|
10282
|
-
function getJSDocParameterTagsWorker(
|
|
10283
|
-
|
|
10284
|
-
|
|
10285
|
-
|
|
10286
|
-
|
|
10287
|
-
|
|
10288
|
-
|
|
10289
|
-
|
|
10290
|
-
|
|
10291
|
-
|
|
10292
|
-
|
|
10293
|
-
|
|
10284
|
+
function getJSDocParameterTagsWorker(node, noCache) {
|
|
10285
|
+
const declaration = getRootDeclaration(node);
|
|
10286
|
+
if (isParameter(declaration)) {
|
|
10287
|
+
const name = node.name;
|
|
10288
|
+
const signatureDeclaration = declaration.parent;
|
|
10289
|
+
const jsDocParameterTags = filter(getJSDocTagsWorker(signatureDeclaration, noCache), isJSDocParameterTag);
|
|
10290
|
+
if (length(jsDocParameterTags) === 0) {
|
|
10291
|
+
return emptyArray;
|
|
10292
|
+
}
|
|
10293
|
+
if (isIdentifier(name)) {
|
|
10294
|
+
return filter(jsDocParameterTags, (tag) => isIdentifier(tag.name) && tag.name.escapedText === name.escapedText);
|
|
10295
|
+
}
|
|
10296
|
+
const i = signatureDeclaration.parameters.indexOf(declaration);
|
|
10297
|
+
Debug.assert(i > -1, "Parameters should always be in their parents' parameter list");
|
|
10298
|
+
if (i < length(jsDocParameterTags)) {
|
|
10299
|
+
return [jsDocParameterTags[i]];
|
|
10294
10300
|
}
|
|
10295
10301
|
}
|
|
10296
10302
|
return emptyArray;
|
|
10297
10303
|
}
|
|
10298
|
-
function getJSDocParameterTags(
|
|
10304
|
+
function getJSDocParameterTags(node) {
|
|
10299
10305
|
return getJSDocParameterTagsWorker(
|
|
10300
|
-
|
|
10306
|
+
node,
|
|
10301
10307
|
/*noCache*/
|
|
10302
10308
|
false
|
|
10303
10309
|
);
|
|
10304
10310
|
}
|
|
10305
|
-
function getJSDocParameterTagsNoCache(
|
|
10311
|
+
function getJSDocParameterTagsNoCache(node) {
|
|
10306
10312
|
return getJSDocParameterTagsWorker(
|
|
10307
|
-
|
|
10313
|
+
node,
|
|
10308
10314
|
/*noCache*/
|
|
10309
10315
|
true
|
|
10310
10316
|
);
|
|
@@ -13732,7 +13738,7 @@ function getJSDocCommentsAndTags(hostNode, noCache) {
|
|
|
13732
13738
|
if (hasJSDocNodes(node)) {
|
|
13733
13739
|
result = addRange(result, filterOwnedJSDocTags(hostNode, last(node.jsDoc)));
|
|
13734
13740
|
}
|
|
13735
|
-
if (node.kind === 167 /* Parameter */) {
|
|
13741
|
+
if (node.kind === 167 /* Parameter */ || node.kind === 206 /* BindingElement */) {
|
|
13736
13742
|
result = addRange(result, (noCache ? getJSDocParameterTagsNoCache : getJSDocParameterTags)(node));
|
|
13737
13743
|
break;
|
|
13738
13744
|
}
|
|
@@ -36574,6 +36580,10 @@ function getOriginalAndResolvedFileName(fileName, host, traceEnabled) {
|
|
|
36574
36580
|
originalPath: pathsAreEqual ? void 0 : fileName
|
|
36575
36581
|
};
|
|
36576
36582
|
}
|
|
36583
|
+
function getCandidateFromTypeRoot(typeRoot, typeReferenceDirectiveName, moduleResolutionState) {
|
|
36584
|
+
const nameForLookup = endsWith(typeRoot, "/node_modules/@types") || endsWith(typeRoot, "/node_modules/@types/") ? mangleScopedPackageNameWithTrace(typeReferenceDirectiveName, moduleResolutionState) : typeReferenceDirectiveName;
|
|
36585
|
+
return combinePaths(typeRoot, nameForLookup);
|
|
36586
|
+
}
|
|
36577
36587
|
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache, resolutionMode) {
|
|
36578
36588
|
Debug.assert(typeof typeReferenceDirectiveName === "string", "Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.");
|
|
36579
36589
|
const traceEnabled = isTraceEnabled(options, host);
|
|
@@ -36692,7 +36702,7 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
36692
36702
|
trace(host, Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(", "));
|
|
36693
36703
|
}
|
|
36694
36704
|
return firstDefined(typeRoots, (typeRoot) => {
|
|
36695
|
-
const candidate =
|
|
36705
|
+
const candidate = getCandidateFromTypeRoot(typeRoot, typeReferenceDirectiveName, moduleResolutionState);
|
|
36696
36706
|
const directoryExists = directoryProbablyExists(typeRoot, host);
|
|
36697
36707
|
if (!directoryExists && traceEnabled) {
|
|
36698
36708
|
trace(host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot);
|
|
@@ -38678,7 +38688,7 @@ function resolveFromTypeRoot(moduleName, state) {
|
|
|
38678
38688
|
if (!state.compilerOptions.typeRoots)
|
|
38679
38689
|
return;
|
|
38680
38690
|
for (const typeRoot of state.compilerOptions.typeRoots) {
|
|
38681
|
-
const candidate =
|
|
38691
|
+
const candidate = getCandidateFromTypeRoot(typeRoot, moduleName, state);
|
|
38682
38692
|
const directoryExists = directoryProbablyExists(typeRoot, state.host);
|
|
38683
38693
|
if (!directoryExists && state.traceEnabled) {
|
|
38684
38694
|
trace(state.host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot);
|
|
@@ -42675,7 +42685,6 @@ function createTypeChecker(host) {
|
|
|
42675
42685
|
var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
|
|
42676
42686
|
var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
|
|
42677
42687
|
var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
|
|
42678
|
-
var defaultIndexFlags = keyofStringsOnly ? 1 /* StringsOnly */ : 0 /* None */;
|
|
42679
42688
|
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
|
|
42680
42689
|
var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
|
|
42681
42690
|
var checkBinaryExpression = createCheckBinaryExpression();
|
|
@@ -53944,13 +53953,6 @@ function createTypeChecker(host) {
|
|
|
53944
53953
|
function isConflictingPrivateProperty(prop) {
|
|
53945
53954
|
return !prop.valueDeclaration && !!(getCheckFlags(prop) & 1024 /* ContainsPrivate */);
|
|
53946
53955
|
}
|
|
53947
|
-
function isGenericReducibleType(type) {
|
|
53948
|
-
return !!(type.flags & 1048576 /* Union */ && type.objectFlags & 16777216 /* ContainsIntersections */ && some(type.types, isGenericReducibleType) || type.flags & 2097152 /* Intersection */ && isReducibleIntersection(type));
|
|
53949
|
-
}
|
|
53950
|
-
function isReducibleIntersection(type) {
|
|
53951
|
-
const uniqueFilled = type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
|
|
53952
|
-
return getReducedType(uniqueFilled) !== uniqueFilled;
|
|
53953
|
-
}
|
|
53954
53956
|
function elaborateNeverIntersection(errorInfo, type) {
|
|
53955
53957
|
if (type.flags & 2097152 /* Intersection */ && getObjectFlags(type) & 33554432 /* IsNeverIntersection */) {
|
|
53956
53958
|
const neverProp = find(getPropertiesOfUnionOrIntersectionType(type), isDiscriminantWithNeverType);
|
|
@@ -56320,10 +56322,10 @@ function createTypeChecker(host) {
|
|
|
56320
56322
|
}
|
|
56321
56323
|
return links.resolvedType;
|
|
56322
56324
|
}
|
|
56323
|
-
function createIndexType(type,
|
|
56325
|
+
function createIndexType(type, stringsOnly) {
|
|
56324
56326
|
const result = createType(4194304 /* Index */);
|
|
56325
56327
|
result.type = type;
|
|
56326
|
-
result.
|
|
56328
|
+
result.stringsOnly = stringsOnly;
|
|
56327
56329
|
return result;
|
|
56328
56330
|
}
|
|
56329
56331
|
function createOriginIndexType(type) {
|
|
@@ -56331,23 +56333,31 @@ function createTypeChecker(host) {
|
|
|
56331
56333
|
result.type = type;
|
|
56332
56334
|
return result;
|
|
56333
56335
|
}
|
|
56334
|
-
function getIndexTypeForGenericType(type,
|
|
56335
|
-
return
|
|
56336
|
+
function getIndexTypeForGenericType(type, stringsOnly) {
|
|
56337
|
+
return stringsOnly ? type.resolvedStringIndexType || (type.resolvedStringIndexType = createIndexType(
|
|
56338
|
+
type,
|
|
56339
|
+
/*stringsOnly*/
|
|
56340
|
+
true
|
|
56341
|
+
)) : type.resolvedIndexType || (type.resolvedIndexType = createIndexType(
|
|
56342
|
+
type,
|
|
56343
|
+
/*stringsOnly*/
|
|
56344
|
+
false
|
|
56345
|
+
));
|
|
56336
56346
|
}
|
|
56337
|
-
function getIndexTypeForMappedType(type,
|
|
56347
|
+
function getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) {
|
|
56338
56348
|
const typeParameter = getTypeParameterFromMappedType(type);
|
|
56339
56349
|
const constraintType = getConstraintTypeFromMappedType(type);
|
|
56340
56350
|
const nameType = getNameTypeFromMappedType(type.target || type);
|
|
56341
|
-
if (!nameType && !
|
|
56351
|
+
if (!nameType && !noIndexSignatures) {
|
|
56342
56352
|
return constraintType;
|
|
56343
56353
|
}
|
|
56344
56354
|
const keyTypes = [];
|
|
56345
56355
|
if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
|
|
56346
56356
|
if (!isGenericIndexType(constraintType)) {
|
|
56347
56357
|
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
56348
|
-
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */,
|
|
56358
|
+
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, stringsOnly, addMemberForKeyType);
|
|
56349
56359
|
} else {
|
|
56350
|
-
return getIndexTypeForGenericType(type,
|
|
56360
|
+
return getIndexTypeForGenericType(type, stringsOnly);
|
|
56351
56361
|
}
|
|
56352
56362
|
} else {
|
|
56353
56363
|
forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
|
|
@@ -56355,7 +56365,7 @@ function createTypeChecker(host) {
|
|
|
56355
56365
|
if (isGenericIndexType(constraintType)) {
|
|
56356
56366
|
forEachType(constraintType, addMemberForKeyType);
|
|
56357
56367
|
}
|
|
56358
|
-
const result =
|
|
56368
|
+
const result = noIndexSignatures ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
|
|
56359
56369
|
if (result.flags & 1048576 /* Union */ && constraintType.flags & 1048576 /* Union */ && getTypeListId(result.types) === getTypeListId(constraintType.types)) {
|
|
56360
56370
|
return constraintType;
|
|
56361
56371
|
}
|
|
@@ -56408,15 +56418,19 @@ function createTypeChecker(host) {
|
|
|
56408
56418
|
origin
|
|
56409
56419
|
);
|
|
56410
56420
|
}
|
|
56411
|
-
function
|
|
56412
|
-
|
|
56421
|
+
function isPossiblyReducibleByInstantiation(type) {
|
|
56422
|
+
const uniqueFilled = getUniqueLiteralFilledInstantiation(type);
|
|
56423
|
+
return getReducedType(uniqueFilled) !== uniqueFilled;
|
|
56413
56424
|
}
|
|
56414
|
-
function
|
|
56425
|
+
function shouldDeferIndexType(type) {
|
|
56426
|
+
return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) || type.flags & 1048576 /* Union */ && some(type.types, isPossiblyReducibleByInstantiation) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
|
|
56427
|
+
}
|
|
56428
|
+
function getIndexType(type, stringsOnly = keyofStringsOnly, noIndexSignatures) {
|
|
56415
56429
|
type = getReducedType(type);
|
|
56416
|
-
return shouldDeferIndexType(type
|
|
56430
|
+
return shouldDeferIndexType(type) ? getIndexTypeForGenericType(type, stringsOnly) : type.flags & 1048576 /* Union */ ? getIntersectionType(map(type.types, (t) => getIndexType(t, stringsOnly, noIndexSignatures))) : type.flags & 2097152 /* Intersection */ ? getUnionType(map(type.types, (t) => getIndexType(t, stringsOnly, noIndexSignatures))) : getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) : type === wildcardType ? wildcardType : type.flags & 2 /* Unknown */ ? neverType : type.flags & (1 /* Any */ | 131072 /* Never */) ? keyofConstraintType : getLiteralTypeFromProperties(
|
|
56417
56431
|
type,
|
|
56418
|
-
(
|
|
56419
|
-
|
|
56432
|
+
(noIndexSignatures ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (stringsOnly ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */),
|
|
56433
|
+
stringsOnly === keyofStringsOnly && !noIndexSignatures
|
|
56420
56434
|
);
|
|
56421
56435
|
}
|
|
56422
56436
|
function getExtractStringType(type) {
|
|
@@ -56956,13 +56970,12 @@ function createTypeChecker(host) {
|
|
|
56956
56970
|
if (objectType === wildcardType || indexType === wildcardType) {
|
|
56957
56971
|
return wildcardType;
|
|
56958
56972
|
}
|
|
56959
|
-
objectType = getReducedType(objectType);
|
|
56960
56973
|
if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
|
|
56961
56974
|
indexType = stringType;
|
|
56962
56975
|
}
|
|
56963
56976
|
if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32 /* ExpressionPosition */)
|
|
56964
56977
|
accessFlags |= 1 /* IncludeUndefined */;
|
|
56965
|
-
if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 197 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength))
|
|
56978
|
+
if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 197 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) {
|
|
56966
56979
|
if (objectType.flags & 3 /* AnyOrUnknown */) {
|
|
56967
56980
|
return objectType;
|
|
56968
56981
|
}
|
|
@@ -58148,6 +58161,9 @@ function createTypeChecker(host) {
|
|
|
58148
58161
|
}
|
|
58149
58162
|
return type;
|
|
58150
58163
|
}
|
|
58164
|
+
function getUniqueLiteralFilledInstantiation(type) {
|
|
58165
|
+
return type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
|
|
58166
|
+
}
|
|
58151
58167
|
function getPermissiveInstantiation(type) {
|
|
58152
58168
|
return type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
|
|
58153
58169
|
}
|
|
@@ -58639,20 +58655,8 @@ function createTypeChecker(host) {
|
|
|
58639
58655
|
return result;
|
|
58640
58656
|
}
|
|
58641
58657
|
const moreThanOneRealChildren = length(validChildren) > 1;
|
|
58642
|
-
|
|
58643
|
-
|
|
58644
|
-
const iterableType = getGlobalIterableType(
|
|
58645
|
-
/*reportErrors*/
|
|
58646
|
-
false
|
|
58647
|
-
);
|
|
58648
|
-
if (iterableType !== emptyGenericType) {
|
|
58649
|
-
const anyIterable = createIterableType(anyType);
|
|
58650
|
-
arrayLikeTargetParts = filterType(childrenTargetType, (t) => isTypeAssignableTo(t, anyIterable));
|
|
58651
|
-
nonArrayLikeTargetParts = filterType(childrenTargetType, (t) => !isTypeAssignableTo(t, anyIterable));
|
|
58652
|
-
} else {
|
|
58653
|
-
arrayLikeTargetParts = filterType(childrenTargetType, isArrayOrTupleLikeType);
|
|
58654
|
-
nonArrayLikeTargetParts = filterType(childrenTargetType, (t) => !isArrayOrTupleLikeType(t));
|
|
58655
|
-
}
|
|
58658
|
+
const arrayLikeTargetParts = filterType(childrenTargetType, isAssignableToAvailableAnyIterable);
|
|
58659
|
+
const nonArrayLikeTargetParts = filterType(childrenTargetType, (t) => !isAssignableToAvailableAnyIterable(t));
|
|
58656
58660
|
if (moreThanOneRealChildren) {
|
|
58657
58661
|
if (arrayLikeTargetParts !== neverType) {
|
|
58658
58662
|
const realSource = createTupleType(checkJsxChildren(containingElement, 0 /* Normal */));
|
|
@@ -60342,7 +60346,7 @@ function createTypeChecker(host) {
|
|
|
60342
60346
|
} else {
|
|
60343
60347
|
const constraint = getSimplifiedTypeOrConstraint(targetType);
|
|
60344
60348
|
if (constraint) {
|
|
60345
|
-
if (isRelatedTo(source2, getIndexType(constraint, target2.
|
|
60349
|
+
if (isRelatedTo(source2, getIndexType(constraint, target2.stringsOnly), 2 /* Target */, reportErrors2) === -1 /* True */) {
|
|
60346
60350
|
return -1 /* True */;
|
|
60347
60351
|
}
|
|
60348
60352
|
} else if (isGenericMappedType(targetType)) {
|
|
@@ -60423,7 +60427,13 @@ function createTypeChecker(host) {
|
|
|
60423
60427
|
}
|
|
60424
60428
|
if (!isGenericMappedType(source2)) {
|
|
60425
60429
|
const targetKeys = keysRemapped ? getNameTypeFromMappedType(target2) : getConstraintTypeFromMappedType(target2);
|
|
60426
|
-
const sourceKeys = getIndexType(
|
|
60430
|
+
const sourceKeys = getIndexType(
|
|
60431
|
+
source2,
|
|
60432
|
+
/*stringsOnly*/
|
|
60433
|
+
void 0,
|
|
60434
|
+
/*noIndexSignatures*/
|
|
60435
|
+
true
|
|
60436
|
+
);
|
|
60427
60437
|
const includeOptional = modifiers & 4 /* IncludeOptional */;
|
|
60428
60438
|
const filteredByApplicability = includeOptional ? intersectTypes(targetKeys, sourceKeys) : void 0;
|
|
60429
60439
|
if (includeOptional ? !(filteredByApplicability.flags & 131072 /* Never */) : isRelatedTo(targetKeys, sourceKeys, 3 /* Both */)) {
|
|
@@ -61932,6 +61942,13 @@ function createTypeChecker(host) {
|
|
|
61932
61942
|
function isArrayOrTupleLikeType(type) {
|
|
61933
61943
|
return isArrayLikeType(type) || isTupleLikeType(type);
|
|
61934
61944
|
}
|
|
61945
|
+
function isAssignableToAvailableAnyIterable(type) {
|
|
61946
|
+
const anyIterable = getGlobalIterableType(
|
|
61947
|
+
/*reportErrors*/
|
|
61948
|
+
false
|
|
61949
|
+
) !== emptyGenericType && createIterableType(anyType);
|
|
61950
|
+
return anyIterable ? isTypeAssignableTo(type, anyIterable) : isArrayOrTupleLikeType(type);
|
|
61951
|
+
}
|
|
61935
61952
|
function getTupleElementType(type, index) {
|
|
61936
61953
|
const propType = getTypeOfPropertyOfType(type, "" + index);
|
|
61937
61954
|
if (propType) {
|
|
@@ -66685,7 +66702,7 @@ function createTypeChecker(host) {
|
|
|
66685
66702
|
return void 0;
|
|
66686
66703
|
}
|
|
66687
66704
|
function getContextualTypeForElementExpression(arrayContextualType, index) {
|
|
66688
|
-
return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
|
|
66705
|
+
return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(filterType(arrayContextualType, (t) => !!getIndexTypeOfType(t, numberType) || isAssignableToAvailableAnyIterable(t)), "" + index) || mapType(
|
|
66689
66706
|
arrayContextualType,
|
|
66690
66707
|
(t) => isTupleType(t) ? getElementTypeOfSliceOfTupleType(
|
|
66691
66708
|
t,
|
|
@@ -74656,7 +74673,11 @@ function createTypeChecker(host) {
|
|
|
74656
74673
|
}
|
|
74657
74674
|
const objectType = type.objectType;
|
|
74658
74675
|
const indexType = type.indexType;
|
|
74659
|
-
if (isTypeAssignableTo(indexType, getIndexType(
|
|
74676
|
+
if (isTypeAssignableTo(indexType, getIndexType(
|
|
74677
|
+
objectType,
|
|
74678
|
+
/*stringsOnly*/
|
|
74679
|
+
false
|
|
74680
|
+
))) {
|
|
74660
74681
|
if (accessNode.kind === 210 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
|
|
74661
74682
|
error(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
74662
74683
|
}
|