Warns when object literals are checked as Schema class instances without the class prototype
| Property | Value |
|---|---|
| Category | Correctness |
| Default severity | warning |
| Fixable | No |
| Effect versions | v3, v4 |
| Diagnostic codes | TS377149 |
| Language Service name | schemaClassObjectLiteral |
| Oxlint name | effecttsgo/schema-class-object-literal |
import { Schema } from "effect"
export class User extends Schema.Class<User, { readonly brand: unique symbol }>("User")({ name: Schema.String }) {}
export const user = User.make({ name: "a" })
export const copy: User = { ...user }
/**
^^^^^^^^^^^ effecttsgo(schema-class-object-literal): This object literal is checked as an instance of Schema class 'User' but has no class prototype. instanceof checks, methods, and Schema encoding can fail. Use 'User.make(...)' or 'new User(...)' instead.
*/
export const renamed = User.make({ ...user, name: "b" })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-class-object-literal": "warn"
}
}
{ "$schema": "./node_modules/@effect/tsgo/schema.json", "compilerOptions": { "plugins": [ { "name": "@effect/language-service", "diagnosticSeverity": { "schemaClassObjectLiteral": "warning" } } ] } }