File tree 1 file changed +2
-2
lines changed
1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -9589,7 +9589,7 @@ namespace ts {
9589
9589
// When creating an optional property in strictNullChecks mode, if 'undefined' isn't assignable to the
9590
9590
// type, we include 'undefined' in the type. Similarly, when creating a non-optional property in strictNullChecks
9591
9591
// mode, if the underlying property is optional we remove 'undefined' from the type.
9592
- prop.type = strictNullChecks && isOptional && !isTypeAssignableTo(undefinedType, propType ) ? getOptionalType(propType) :
9592
+ prop.type = strictNullChecks && isOptional && !maybeTypeOfKind(propType, TypeFlags.Undefined | TypeFlags.Void ) ? getOptionalType(propType) :
9593
9593
strictNullChecks && !isOptional && modifiersProp && modifiersProp.flags & SymbolFlags.Optional ? getTypeWithFacts(propType, TypeFacts.NEUndefined) :
9594
9594
propType;
9595
9595
if (modifiersProp) {
@@ -13681,7 +13681,7 @@ namespace ts {
13681
13681
const templateMapper = combineTypeMappers(mapper, createTypeMapper([getTypeParameterFromMappedType(type)], [key]));
13682
13682
const propType = instantiateType(getTemplateTypeFromMappedType(<MappedType>type.target || type), templateMapper);
13683
13683
const modifiers = getMappedTypeModifiers(type);
13684
- return strictNullChecks && modifiers & MappedTypeModifiers.IncludeOptional && !isTypeAssignableTo(undefinedType, propType ) ? getOptionalType(propType) :
13684
+ return strictNullChecks && modifiers & MappedTypeModifiers.IncludeOptional && !maybeTypeOfKind(propType, TypeFlags.Undefined | TypeFlags.Void ) ? getOptionalType(propType) :
13685
13685
strictNullChecks && modifiers & MappedTypeModifiers.ExcludeOptional && isOptional ? getTypeWithFacts(propType, TypeFacts.NEUndefined) :
13686
13686
propType;
13687
13687
}
You can’t perform that action at this time.
0 commit comments