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

PropertyValue
CategoryStyle
Default severitysuggestion
FixableNo
Effect versionsv4
Diagnostic codesTS377116
Language Service namecatchConditionalRefailToCatchIf
Oxlint nameeffecttsgo/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"
  }
}