(t *Type, depth int)
| 13575 | } |
| 13576 | |
| 13577 | func (c *Checker) isConstTypeVariable(t *Type, depth int) bool { |
| 13578 | if depth >= 5 || t == nil { |
| 13579 | return false |
| 13580 | } |
| 13581 | switch { |
| 13582 | case t.flags&TypeFlagsTypeParameter != 0: |
| 13583 | return t.symbol != nil && core.Some(t.symbol.Declarations, func(d *ast.Node) bool { return ast.HasSyntacticModifier(d, ast.ModifierFlagsConst) }) |
| 13584 | case t.flags&TypeFlagsUnionOrIntersection != 0: |
| 13585 | return core.Some(t.Types(), func(s *Type) bool { return c.isConstTypeVariable(s, depth) }) |
| 13586 | case t.flags&TypeFlagsIndexedAccess != 0: |
| 13587 | return c.isConstTypeVariable(t.AsIndexedAccessType().objectType, depth+1) |
| 13588 | case t.flags&TypeFlagsConditional != 0: |
| 13589 | return c.isConstTypeVariable(c.getConstraintOfConditionalType(t), depth+1) |
| 13590 | case t.flags&TypeFlagsSubstitution != 0: |
| 13591 | return c.isConstTypeVariable(t.AsSubstitutionType().baseType, depth) |
| 13592 | case t.objectFlags&ObjectFlagsMapped != 0: |
| 13593 | typeVariable := c.getHomomorphicTypeVariable(t) |
| 13594 | return typeVariable != nil && c.isConstTypeVariable(typeVariable, depth) |
| 13595 | case c.isGenericTupleType(t): |
| 13596 | for i, s := range c.getElementTypes(t) { |
| 13597 | if t.TargetTupleType().elementInfos[i].flags&ElementFlagsVariadic != 0 && c.isConstTypeVariable(s, depth) { |
| 13598 | return true |
| 13599 | } |
| 13600 | } |
| 13601 | } |
| 13602 | return false |
| 13603 | } |
| 13604 | |
| 13605 | func (c *Checker) checkPropertyAssignment(node *ast.Node, checkMode CheckMode) *Type { |
| 13606 | // Do not use hasDynamicName here, because that returns false for well known symbols. |
no test coverage detected