preferTypedSchemaDecoder

August 6, 2026 ยท View on GitHub

Suggests typed Schema decoders when the input is assignable to the schema's Encoded type

PropertyValue
CategoryStyle
Default severitysuggestion
FixableYes
Effect versionsv4
Diagnostic codesTS377112
Language Service namepreferTypedSchemaDecoder
Oxlint nameeffecttsgo/prefer-typed-schema-decoder

Preview

import { Schema } from "effect"

const Person = Schema.Struct({ name: Schema.String })

export const person = Schema.decodeUnknownSync(Person)({ name: "Ada" })
/**
                             ^^^^^^^^^^^^^^^^^ effecttsgo(prefer-typed-schema-decoder): This input is already assignable to the schema's Encoded type. Use `decodeSync` to preserve compile-time type checking instead of discarding the input type through `decodeUnknownSync`.
*/

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": {
          "preferTypedSchemaDecoder": "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/prefer-typed-schema-decoder": "warn"
  }
}