Skip to content

Standard Schema matcher incompatible with Effect #9098

@samhh

Description

@samhh

Describe the bug

Effect's Schema implements Standard Schema interop as a class atop its own constructs, causing Vitest's internal isStandardSchema type guard to fail.

I'm assuming it's the typeof obj === 'object' given both the fact that Schema uses a class under the hood and the fact that interop can be achieved by spreading Effect's output, as per the repro.

Reproduction

import { Schema } from 'effect';
import { describe, expect, it } from 'vitest';

describe('repro', () => {
  it('fails', () => {
    expect('foo').toEqual(
      expect.schemaMatching(Schema.standardSchemaV1(Schema.String)),
    );
  });

  it('succeeds', () => {
    expect('foo').toEqual(
      expect.schemaMatching({ ...Schema.standardSchemaV1(Schema.String) }),
    );
  });
});

System Info

System:
    OS: macOS 26.1
    CPU: (12) arm64 Apple M2 Pro
    Memory: 842.14 MB / 32.00 GB
    Shell: 4.1.2 - /Users/sam/.nix-profile/bin/fish
  Binaries:
    Node: 22.21.1 - /nix/store/icgwxxfs13q1y864dd9ln86scp5659mw-nodejs-22.21.1/bin/node
    npm: 10.9.4 - /nix/store/icgwxxfs13q1y864dd9ln86scp5659mw-nodejs-22.21.1/bin/npm
    pnpm: 10.15.0 - /nix/store/zxr2z04s11vsmdx5ybdnyld2kllvlq61-pnpm-10.20.0/bin/pnpm
  Browsers:
    Firefox Developer Edition: 144.0
    Safari: 26.1

Used Package Manager

pnpm

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions