Skip to content

Latest commit

 

History

History
65 lines (53 loc) · 1.56 KB

generic-effect-services.md

File metadata and controls

65 lines (53 loc) · 1.56 KB

genericEffectServices

Prevents services with type parameters that cannot be discriminated at runtime

Property Value
Category Correctness
Default severity warning
Fixable No
Effect versions v3
Diagnostic codes TS377043
Language Service name genericEffectServices
Oxlint name effecttsgo/generic-effect-services

Preview

import { Effect } from "effect"

export class Preview<_A> extends Effect.Service<Preview<any>>()("Preview", {
/**
             ^^^^^^^ effecttsgo(generic-effect-services): Effect Services with type parameters are not supported because they cannot be properly discriminated at runtime, which may cause unexpected behavior.
*/
  succeed: {}
}) {}

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": {
          "genericEffectServices": "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/generic-effect-services": "warn"
  }
}