mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 04:43:37 -05:00
Prevent merged class/namespace from overlapping with Record<string, unknown> (#47088)
This commit is contained in:
@@ -21036,9 +21036,14 @@ namespace ts {
|
||||
* with no call or construct signatures.
|
||||
*/
|
||||
function isObjectTypeWithInferableIndex(type: Type): boolean {
|
||||
return type.flags & TypeFlags.Intersection ? every((type as IntersectionType).types, isObjectTypeWithInferableIndex) :
|
||||
!!(type.symbol && (type.symbol.flags & (SymbolFlags.ObjectLiteral | SymbolFlags.TypeLiteral | SymbolFlags.Enum | SymbolFlags.ValueModule)) !== 0 &&
|
||||
!typeHasCallOrConstructSignatures(type)) || !!(getObjectFlags(type) & ObjectFlags.ReverseMapped && isObjectTypeWithInferableIndex((type as ReverseMappedType).source));
|
||||
return type.flags & TypeFlags.Intersection
|
||||
? every((type as IntersectionType).types, isObjectTypeWithInferableIndex)
|
||||
: !!(
|
||||
type.symbol
|
||||
&& (type.symbol.flags & (SymbolFlags.ObjectLiteral | SymbolFlags.TypeLiteral | SymbolFlags.Enum | SymbolFlags.ValueModule)) !== 0
|
||||
&& !(type.symbol.flags & SymbolFlags.Class)
|
||||
&& !typeHasCallOrConstructSignatures(type)
|
||||
) || !!(getObjectFlags(type) & ObjectFlags.ReverseMapped && isObjectTypeWithInferableIndex((type as ReverseMappedType).source));
|
||||
}
|
||||
|
||||
function createSymbolWithType(source: Symbol, type: Type | undefined) {
|
||||
|
||||
Reference in New Issue
Block a user