mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Remove special any assignability for numeric index signatures (#41660)
* Only enable special assignability rule on string index signatures to 'any'. * Accepted baselines. * Added test. * Accepted baselines. * Renamed test files. * Add non-erroring version of bclas'subClassThisTypeAssignable01.ts' * Accepted baselines. Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
This commit is contained in:
1 parent
2c5cee59f0
commit
df5ffc0ea1
20 files changed
+392
-36
No files matched your search
@@ -18948,7 +18948,7 @@ namespace ts {
|
||||
return indexTypesIdenticalTo(source, target, kind);
|
||||
}
|
||||
const targetType = getIndexTypeOfType(target, kind);
|
||||
if (!targetType || targetType.flags & TypeFlags.Any && !sourceIsPrimitive) {
|
||||
if (!targetType || targetType.flags & TypeFlags.Any && !sourceIsPrimitive && kind === IndexKind.String) {
|
||||
// Index signature of type any permits assignment from everything but primitives
|
||||
return Ternary.True;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user