File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -11206,7 +11206,11 @@ namespace ts {
11206
11206
return mapType(mappedTypeVariable, t => {
11207
11207
if (t.flags & (TypeFlags.AnyOrUnknown | TypeFlags.InstantiableNonPrimitive | TypeFlags.Object | TypeFlags.Intersection) && t !== wildcardType && t !== errorType) {
11208
11208
const replacementMapper = createReplacementMapper(typeVariable, t, mapper);
11209
- return isArrayType(t) ? instantiateMappedArrayType(t, type, replacementMapper) :
11209
+ // The first rule exists such that `Readonly<any>` is simply `any`, which is what most people think it will resolve to.
11210
+ // Without the extra special callout, it actually instantiates to `{readonly [index: string]: any}` which has a bunch of
11211
+ // assignability quirks to do with index signatures - most notably it no longer provides _every possible explicit property_.
11212
+ return isTypeAny(t) && getTemplateTypeFromMappedType(type) === getIndexedAccessType(typeVariable, getTypeParameterFromMappedType(type)) ? t :
11213
+ isArrayType(t) ? instantiateMappedArrayType(t, type, replacementMapper) :
11210
11214
isTupleType(t) ? instantiateMappedTupleType(t, type, replacementMapper) :
11211
11215
instantiateAnonymousType(type, replacementMapper);
11212
11216
}
You can’t perform that action at this time.
0 commit comments