MCPcopy Create free account
hub / github.com/microsoft/typescript-go / isTypeParameterAtTopLevel

Method isTypeParameterAtTopLevel

internal/checker/inference.go:1459–1465  ·  view source on GitHub ↗
(t *Type, tp *Type, depth int)

Source from the content-addressed store, hash-verified

1457}
1458
1459func (c *Checker) isTypeParameterAtTopLevel(t *Type, tp *Type, depth int) bool {
1460 return t == tp ||
1461 t.flags&TypeFlagsUnionOrIntersection != 0 && core.Some(t.Types(), func(t *Type) bool { return c.isTypeParameterAtTopLevel(t, tp, depth) }) ||
1462 depth < 3 && t.flags&TypeFlagsConditional != 0 &&
1463 (c.isTypeParameterAtTopLevel(c.getTrueTypeFromConditionalType(t), tp, depth+1) ||
1464 c.isTypeParameterAtTopLevel(c.getFalseTypeFromConditionalType(t), tp, depth+1))
1465}
1466
1467func (c *Checker) isTypeParameterAtTopLevelInReturnType(signature *Signature, typeParameter *Type) bool {
1468 typePredicate := c.getTypePredicateOfSignature(signature)

Callers 2

inferFromTypesMethod · 0.95

Calls 4

SomeFunction · 0.92
TypesMethod · 0.45

Tested by

no test coverage detected