IsPipeableType returns true if the type has a callable "pipe" property, indicating it supports the pipeable pattern (e.g., value.pipe(f1, f2, ...)).
(t *checker.Type, atLocation *ast.Node)
| 8 | // IsPipeableType returns true if the type has a callable "pipe" property, |
| 9 | // indicating it supports the pipeable pattern (e.g., value.pipe(f1, f2, ...)). |
| 10 | func (tp *TypeParser) IsPipeableType(t *checker.Type) bool { |
| 11 | if tp == nil || tp.checker == nil || t == nil { |
| 12 | return false |
| 13 | } |
| 14 | c := tp.checker |
| 15 | return Cached(&tp.links.IsPipeableType, t, func() bool { |
| 16 | pipeType := tp.GetTypeOfPropertyByName(t, "pipe") |
| 17 | if pipeType == nil { |
| 18 | return false |
| 19 | } |
| 20 | signatures := c.GetSignaturesOfType(pipeType, checker.SignatureKindCall) |
| 21 | return len(signatures) > 0 |
| 22 | }) |
| 23 | } |
| 24 | |
| 25 | // IsSafelyPipeableCallee returns true if a callee expression can be safely |
| 26 | // extracted into a pipe argument without losing `this` context. |
| 27 | // This is used by the missedPipeableOpportunity rule to determine which |
| 28 | // call expressions can be converted to pipe style. |
no test coverage detected