mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-26 00:36:29 -05:00
{ [P in K]: T } is related to { [x: string]: U } if T is related to U
This commit is contained in:
@@ -9614,6 +9614,11 @@ namespace ts {
|
||||
if (sourceInfo) {
|
||||
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors);
|
||||
}
|
||||
if (isGenericMappedType(source)) {
|
||||
// A generic mapped type { [P in K]: T } is related to an index signature { [x: string]: U }
|
||||
// if T is related to U.
|
||||
return kind === IndexKind.String && isRelatedTo(getTemplateTypeFromMappedType(<MappedType>source), targetInfo.type, reportErrors);
|
||||
}
|
||||
if (isObjectLiteralType(source)) {
|
||||
let related = Ternary.True;
|
||||
if (kind === IndexKind.String) {
|
||||
|
||||
Reference in New Issue
Block a user