Don't try to add an implicit undefined for mapped properties outside of strictNullChecks (#60393)

This commit is contained in:
Mateusz Burzyński
2024-12-19 20:47:26 +01:00
committed by GitHub
parent 0dda037f9f
commit 12e205b1e9
17 changed files with 721 additions and 1 deletions

View File

@@ -6267,7 +6267,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
return true;
}
if (requiresAddingUndefined && annotationType) {
annotationType = getOptionalType(annotationType, !isParameter(node));
annotationType = addOptionality(annotationType, !isParameter(node));
}
return !!annotationType && typeNodeIsEquivalentToType(node, type, annotationType) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type);
},