Skip to content

Latest commit

 

History

History
65 lines (52 loc) · 1.62 KB

File metadata and controls

65 lines (52 loc) · 1.62 KB

unsafeEffectTypeAssertion

Detects unsafe type assertions that narrow Effect, Stream, or Layer error or requirements channels

Property Value
Category Effect-native
Default severity off
Fixable Yes
Effect versions v3, v4
Diagnostic codes TS377075
Language Service name unsafeEffectTypeAssertion
Oxlint name effecttsgo/unsafe-effect-type-assertion

Preview

import { Effect } from "effect"

declare const program: Effect.Effect<string, "boom", "service">

export const preview = program as Effect.Effect<string, never, never>
/**
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ effecttsgo(unsafe-effect-type-assertion): This type assertion unsafely narrows the error or requirements channels.
*/

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": {
          "unsafeEffectTypeAssertion": "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/unsafe-effect-type-assertion": "warn"
  }
}