Skip to content

@effect/tsgo@0.54.0

Choose a tag to compare

@github-actions github-actions released this 19 Oct 15:59
· 168 commits to main since this release
174a282

Minor Changes

  • e00f33c: Add the schemaClassObjectLiteral diagnostic. It warns when an object literal is checked as a Schema class instance. A plain object has no class prototype, so instanceof, class methods, and Schema encoding fail at runtime. A Schema brand does not help, because a spread copies the brand property.

    class User extends Schema.Class<User, { readonly brand: unique symbol }>("User")({ name: Schema.String }) {}
    
    const copy: User = { ...user } // warning: build it with User.make({ ...user })
    const renamed = User.make({ ...user, name: "b" }) // ok

    In Effect v4, the rule skips objects nested inside a Schema constructor call, such as Parent.make({ child: { ...child } }), because v4 builds the nested class instance from the plain object.