mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-11 02:15:10 -05:00
Don't allow everything to be assignable to string within string mappings like Uppercase/Lowercase (#52734)
This commit is contained in:
@@ -23875,10 +23875,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
}
|
||||
|
||||
function isMemberOfStringMapping(source: Type, target: Type): boolean {
|
||||
if (target.flags & (TypeFlags.String | TypeFlags.Any)) {
|
||||
if (target.flags & TypeFlags.Any) {
|
||||
return true;
|
||||
}
|
||||
if (target.flags & TypeFlags.TemplateLiteral) {
|
||||
if (target.flags & (TypeFlags.String | TypeFlags.TemplateLiteral)) {
|
||||
return isTypeAssignableTo(source, target);
|
||||
}
|
||||
if (target.flags & TypeFlags.StringMapping) {
|
||||
|
||||
Reference in New Issue
Block a user