MCPcopy Create free account
hub / github.com/Effect-TS/tsgo / IsPipeableType

Method IsPipeableType

internal/typeparser/pipeable.go:10–25  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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, ...)).
10func (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.

Callers 4

ServiceTypeMethod · 0.95
ContextTagMethod · 0.95
runTogglePipeStyleFunction · 0.80
isPipeableAtIndexFunction · 0.80

Calls 1

CachedFunction · 0.85

Tested by

no test coverage detected