github Effect-TS/tsgo @effect/tsgo@0.54.0

latest releases: @effect/tsgo@0.74.4, @effect/tsgo-win32-x64@0.74.4, @effect/tsgo-win32-arm64@0.74.4...
one month ago

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.

Don't miss a new tsgo release

NewReleases is sending notifications on new releases.