@@ -343,12 +343,12 @@ namespace ts {
343
343
const strictFunctionTypes = getStrictOptionValue(compilerOptions, "strictFunctionTypes");
344
344
const strictBindCallApply = getStrictOptionValue(compilerOptions, "strictBindCallApply");
345
345
const strictPropertyInitialization = getStrictOptionValue(compilerOptions, "strictPropertyInitialization");
346
- const strictOptionalProperties = getStrictOptionValue(compilerOptions, "strictOptionalProperties");
347
346
const noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
348
347
const noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
349
348
const useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
350
349
const keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
351
350
const freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : ObjectFlags.FreshLiteral;
351
+ const exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
352
352
353
353
const checkBinaryExpression = createCheckBinaryExpression();
354
354
const emitResolver = createResolver();
@@ -739,7 +739,7 @@ namespace ts {
739
739
const undefinedType = createIntrinsicType(TypeFlags.Undefined, "undefined");
740
740
const undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(TypeFlags.Undefined, "undefined", ObjectFlags.ContainsWideningType);
741
741
const optionalType = createIntrinsicType(TypeFlags.Undefined, "undefined");
742
- const missingType = strictOptionalProperties ? createIntrinsicType(TypeFlags.Undefined, "undefined") : undefinedType;
742
+ const missingType = exactOptionalPropertyTypes ? createIntrinsicType(TypeFlags.Undefined, "undefined") : undefinedType;
743
743
const nullType = createIntrinsicType(TypeFlags.Null, "null");
744
744
const nullWideningType = strictNullChecks ? nullType : createIntrinsicType(TypeFlags.Null, "null", ObjectFlags.ContainsWideningType);
745
745
const stringType = createIntrinsicType(TypeFlags.String, "string");
@@ -13884,7 +13884,7 @@ namespace ts {
13884
13884
if (includes & TypeFlags.AnyOrUnknown) {
13885
13885
return includes & TypeFlags.Any ? includes & TypeFlags.IncludesWildcard ? wildcardType : anyType : unknownType;
13886
13886
}
13887
- if (strictOptionalProperties && includes & TypeFlags.Undefined) {
13887
+ if (exactOptionalPropertyTypes && includes & TypeFlags.Undefined) {
13888
13888
const missingIndex = binarySearch(typeSet, missingType, getTypeId, compareValues);
13889
13889
if (missingIndex >= 0 && containsType(typeSet, undefinedType)) {
13890
13890
orderedRemoveItemAt(typeSet, missingIndex);
@@ -20356,15 +20356,15 @@ namespace ts {
20356
20356
}
20357
20357
20358
20358
function removeMissingType(type: Type, isOptional: boolean) {
20359
- return strictOptionalProperties && isOptional ? removeType(type, missingType) : type;
20359
+ return exactOptionalPropertyTypes && isOptional ? removeType(type, missingType) : type;
20360
20360
}
20361
20361
20362
20362
function containsMissingType(type: Type) {
20363
- return strictOptionalProperties && (type === missingType || type.flags & TypeFlags.Union && containsType((type as UnionType).types, missingType));
20363
+ return exactOptionalPropertyTypes && (type === missingType || type.flags & TypeFlags.Union && containsType((type as UnionType).types, missingType));
20364
20364
}
20365
20365
20366
20366
function removeMissingOrUndefinedType(type: Type): Type {
20367
- return strictOptionalProperties ? removeType(type, missingType) : getTypeWithFacts(type, TypeFacts.NEUndefined);
20367
+ return exactOptionalPropertyTypes ? removeType(type, missingType) : getTypeWithFacts(type, TypeFacts.NEUndefined);
20368
20368
}
20369
20369
20370
20370
/**
@@ -21750,7 +21750,7 @@ namespace ts {
21750
21750
}
21751
21751
21752
21752
function isTypeOrBaseIdenticalTo(s: Type, t: Type) {
21753
- return strictOptionalProperties && t === missingType ? s === t :
21753
+ return exactOptionalPropertyTypes && t === missingType ? s === t :
21754
21754
(isTypeIdenticalTo(s, t) || !!(t.flags & TypeFlags.String && s.flags & TypeFlags.StringLiteral || t.flags & TypeFlags.Number && s.flags & TypeFlags.NumberLiteral));
21755
21755
}
21756
21756
@@ -26079,7 +26079,7 @@ namespace ts {
26079
26079
elementFlags.push(ElementFlags.Rest);
26080
26080
}
26081
26081
}
26082
- else if (strictOptionalProperties && e.kind === SyntaxKind.OmittedExpression) {
26082
+ else if (exactOptionalPropertyTypes && e.kind === SyntaxKind.OmittedExpression) {
26083
26083
hasOmittedExpression = true;
26084
26084
elementTypes.push(missingType);
26085
26085
elementFlags.push(ElementFlags.Optional);
0 commit comments