Fix missing renamed compiler flags (#40606)

This commit is contained in:
Wenlu Wang
2020-09-17 13:41:02 +08:00
committed by GitHub
parent a5babe1c8f
commit f66c8e6a69
5 changed files with 39 additions and 19 deletions

View File

@@ -13922,7 +13922,7 @@ namespace ts {
}
const shouldIncludeUndefined =
compilerOptions.noUncheckedIndexSignatures &&
compilerOptions.noUncheckedIndexedAccess &&
(accessFlags & (AccessFlags.Writing | AccessFlags.ExpressionPosition)) === AccessFlags.ExpressionPosition;
// If the object type has a string index signature and no other members we know that the result will
@@ -20735,7 +20735,7 @@ namespace ts {
function includeUndefinedInIndexSignature(type: Type | undefined): Type | undefined {
if (!type) return type;
return compilerOptions.noUncheckedIndexSignatures ?
return compilerOptions.noUncheckedIndexedAccess ?
getUnionType([type, undefinedType]) :
type;
}
@@ -25478,7 +25478,7 @@ namespace ts {
error(node, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(apparentType));
}
propType = (compilerOptions.noUncheckedIndexSignatures && !isAssignmentTarget(node)) ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type;
propType = (compilerOptions.noUncheckedIndexedAccess && !isAssignmentTarget(node)) ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type;
}
else {
if (prop.valueDeclaration?.flags & NodeFlags.Deprecated && isUncalledFunctionReference(node, prop)) {
@@ -29445,7 +29445,7 @@ namespace ts {
// present (aka the tuple element property). This call also checks that the parentType is in
// fact an iterable or array (depending on target language).
const possiblyOutOfBoundsType = checkIteratedTypeOrElementType(IterationUse.Destructuring | IterationUse.PossiblyOutOfBounds, sourceType, undefinedType, node) || errorType;
let inBoundsType: Type | undefined = compilerOptions.noUncheckedIndexSignatures ? undefined: possiblyOutOfBoundsType;
let inBoundsType: Type | undefined = compilerOptions.noUncheckedIndexedAccess ? undefined: possiblyOutOfBoundsType;
for (let i = 0; i < elements.length; i++) {
let type = possiblyOutOfBoundsType;
if (node.elements[i].kind === SyntaxKind.SpreadElement) {
@@ -33709,7 +33709,7 @@ namespace ts {
const uplevelIteration = languageVersion >= ScriptTarget.ES2015;
const downlevelIteration = !uplevelIteration && compilerOptions.downlevelIteration;
const possibleOutOfBounds = compilerOptions.noUncheckedIndexSignatures && !!(use & IterationUse.PossiblyOutOfBounds);
const possibleOutOfBounds = compilerOptions.noUncheckedIndexedAccess && !!(use & IterationUse.PossiblyOutOfBounds);
// Get the iterated type of an `Iterable<T>` or `IterableIterator<T>` only in ES2015
// or higher, when inside of an async generator or for-await-if, or when
@@ -33804,7 +33804,7 @@ namespace ts {
const arrayElementType = getIndexTypeOfType(arrayType, IndexKind.Number);
if (hasStringConstituent && arrayElementType) {
// This is just an optimization for the case where arrayOrStringType is string | string[]
if (arrayElementType.flags & TypeFlags.StringLike && !compilerOptions.noUncheckedIndexSignatures) {
if (arrayElementType.flags & TypeFlags.StringLike && !compilerOptions.noUncheckedIndexedAccess) {
return stringType;
}