catchConditionalRefailToCatchIf
September 4, 2026 ยท View on GitHub
Suggests Effect.catchIf, Effect.catchCauseIf, or Effect.catchTag for conditional catch handlers that re-fail their untouched input
| Property | Value |
|---|---|
| Category | Style |
| Default severity | suggestion |
| Fixable | No |
| Effect versions | v4 |
| Diagnostic codes | TS377116 |
| Language Service name | catchConditionalRefailToCatchIf |
| Oxlint name | effecttsgo/catch-conditional-refail-to-catch-if |
Preview
import { Data, Effect } from "effect"
class NotFound extends Data.TaggedError("NotFound")<{}> {}
class DatabaseError extends Data.TaggedError("DatabaseError")<{}> {}
declare const program: Effect.Effect<string, NotFound | DatabaseError>
export const recovered = program.pipe(
Effect.catch((error) =>
/**
^^^^^^^^^^^^ effecttsgo(catch-conditional-refail-to-catch-if): `Effect.catchIf` expresses selective recovery more directly than `Effect.catch` with a conditional `Effect.fail` passthrough.
*/
error instanceof NotFound ? Effect.succeed("guest") : Effect.fail(error)
)
)
Language Service Configuration
See the Language Service setup guide for installation instructions.
{
"$schema": "./node_modules/@effect/tsgo/schema.json",
"compilerOptions": {
"plugins": [
{
"name": "@effect/language-service",
"diagnosticSeverity": {
"catchConditionalRefailToCatchIf": "warning"
}
}
]
}
}
Oxlint Configuration
See the Oxlint setup guide for installation and patching instructions.
{
"$schema": "./node_modules/@effect/tsgo/oxlint-schema.json",
"options": {
"typeAware": true
},
"plugins": ["effecttsgo"],
"rules": {
"effecttsgo/catch-conditional-refail-to-catch-if": "warn"
}
}