Skip to content

Latest commit

 

History

History
65 lines (52 loc) · 1.73 KB

schema-class-missing-brand.md

File metadata and controls

65 lines (52 loc) · 1.73 KB

schemaClassMissingBrand

Warns when Schema classes, errors, or Opaque classes omit the brand type argument

Property Value
Category Correctness
Default severity suggestion
Fixable No
Effect versions v4
Diagnostic codes TS377141
Language Service name schemaClassMissingBrand
Oxlint name effecttsgo/schema-class-missing-brand

Preview

import { Schema } from "effect"

export class User extends Schema.Class<User>("User")({ name: Schema.String }) {}
/**
                                       ^^^^ effecttsgo(schema-class-missing-brand): Add `{ readonly brand: unique symbol }` as the second type argument. Without a brand, TypeScript may accept structurally compatible values where this class instance type is expected.
*/

export class StructuralUser extends Schema.Class<StructuralUser, {}>("StructuralUser")({ 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": {
          "schemaClassMissingBrand": "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-class-missing-brand": "warn"
  }
}