(t *Type)
| 20974 | } |
| 20975 | |
| 20976 | func (c *Checker) getArrayMemberCallSignatures(t *Type) []*Signature { |
| 20977 | // Check if union is exclusively instantiations of a member of the global Array or ReadonlyArray type. |
| 20978 | var memberName string |
| 20979 | for i, t := range t.Types() { |
| 20980 | if t.objectFlags&ObjectFlagsInstantiated == 0 || t.symbol == nil || t.symbol.Parent == nil || !c.isArrayOrTupleSymbol(t.symbol.Parent) { |
| 20981 | return nil |
| 20982 | } |
| 20983 | if i == 0 { |
| 20984 | memberName = t.symbol.Name |
| 20985 | } else if memberName != t.symbol.Name { |
| 20986 | return nil |
| 20987 | } |
| 20988 | } |
| 20989 | // Transform the type from `(A[] | B[])["member"]` to `(A | B)[]["member"]` (since we pretend array is covariant anyway). |
| 20990 | arrayArg := c.mapType(t, func(t *Type) *Type { |
| 20991 | return t.Mapper().Map(core.IfElse(c.isReadonlyArraySymbol(t.symbol.Parent), c.globalReadonlyArrayType, c.globalArrayType).AsInterfaceType().TypeParameters()[0]) |
| 20992 | }) |
| 20993 | arrayType := c.createArrayTypeEx(arrayArg, someType(t, func(t *Type) bool { |
| 20994 | return c.isReadonlyArraySymbol(t.symbol.Parent) |
| 20995 | })) |
| 20996 | return c.getSignaturesOfType(c.getTypeOfPropertyOfType(arrayType, memberName), SignatureKindCall) |
| 20997 | } |
| 20998 | |
| 20999 | func (c *Checker) isArrayOrTupleSymbol(symbol *ast.Symbol) bool { |
| 21000 | if symbol == nil || c.globalArrayType.symbol == nil || c.globalReadonlyArrayType.symbol == nil { |
no test coverage detected