Warns when catch callbacks return unknown instead of typed errors
| Property | Value |
|---|---|
| Category | Anti-pattern |
| Default severity | warning |
| Fixable | No |
| Effect versions | v3, v4 |
| Diagnostic codes | TS377021 |
| Language Service name | unknownInEffectCatch |
| Oxlint name | effecttsgo/unknown-in-effect-catch |
import { Effect } from "effect"
export const preview = Effect.tryPromise({
/**
^^^^^^^^^^^^^^^^^ effecttsgo(unknown-in-effect-catch): The `catch` callback in `Effect.tryPromise` returns `unknown`, so the Effect error type stays untyped. A specific typed error preserves error-channel information, for example by narrowing the value or wrapping it in `Data.TaggedError`.
*/
try: async () => 1,
catch: (error) => error
})See the Language Service setup guide for installation instructions.
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/unknown-in-effect-catch": "warn"
}
}
{ "$schema": "./node_modules/@effect/tsgo/schema.json", "compilerOptions": { "plugins": [ { "name": "@effect/language-service", "diagnosticSeverity": { "unknownInEffectCatch": "warning" } } ] } }