schemaStructWithTag

August 4, 2026 ยท View on GitHub

Suggests using Schema.TaggedStruct instead of Schema.Struct with _tag field

PropertyValue
CategoryStyle
Default severitysuggestion
FixableYes
Effect versionsv3, v4
Diagnostic codesTS377036
Language Service nameschemaStructWithTag
Oxlint nameeffecttsgo/schema-struct-with-tag

Preview

import * as Schema from "effect/Schema"

export const preview = Schema.Struct({
/**
                       ^^^^^^^^^^^^^^^ effecttsgo(schema-struct-with-tag): This `Schema.Struct` includes a `_tag` field. `Schema.TaggedStruct` is the tagged-struct form for this pattern and makes the tag optional in the constructor.
*/
  _tag: Schema.Literal("User"),
/**
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
  name: Schema.String
/**
^^^^^^^^^^^^^^^^^^^^^
*/
})
/**
^^
*/

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": {
          "schemaStructWithTag": "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/schema-struct-with-tag": "warn"
  }
}