Suggests using Schema.TaggedStruct instead of Schema.Struct with _tag field
| Property | Value |
|---|---|
| Category | Style |
| Default severity | suggestion |
| Fixable | Yes |
| Effect versions | v3, v4 |
| Diagnostic codes | TS377036 |
| Language Service name | schemaStructWithTag |
| Oxlint name | effecttsgo/schema-struct-with-tag |
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
/**
^^^^^^^^^^^^^^^^^^^^^
*/
})
/**
^^
*/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/schema-struct-with-tag": "warn"
}
}
{ "$schema": "./node_modules/@effect/tsgo/schema.json", "compilerOptions": { "plugins": [ { "name": "@effect/language-service", "diagnosticSeverity": { "schemaStructWithTag": "warning" } } ] } }