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

Function findUnhandledErrors

internal/rules/missing_effect_error.go:86–98  ·  view source on GitHub ↗

findUnhandledErrors returns the source error types that are not assignable to the target error type.

(tp *typeparser.TypeParser, c *checker.Checker, srcE, tgtE *checker.Type)

Source from the content-addressed store, hash-verified

84
85// findUnhandledErrors returns the source error types that are not assignable to the target error type.
86func findUnhandledErrors(tp *typeparser.TypeParser, c *checker.Checker, srcE, tgtE *checker.Type) []*checker.Type {
87 // Unroll source error union into individual members
88 srcMembers := tp.UnrollUnionMembers(srcE)
89
90 var unhandled []*checker.Type
91 for _, member := range srcMembers {
92 // Check if this specific member is assignable to target
93 if !checker.Checker_isTypeAssignableTo(c, member, tgtE) {
94 unhandled = append(unhandled, member)
95 }
96 }
97 return unhandled
98}
99
100// formatErrorTypes formats a slice of error types as a union string (e.g., "ErrorA | ErrorB").
101func formatErrorTypes(c *checker.Checker, types []*checker.Type) string {

Callers 1

Calls 1

UnrollUnionMembersMethod · 0.45

Tested by

no test coverage detected