Incompatibility Between `Schema.Struct.make` and `Data.struct` in Effect 3.16.16
Hi, is it expected that
I was surprised by this, it feels like a bug. I'm using
See this test failing on an assertion using the
Schema.Struct.makeSchema.Struct.make is not compatible with Data.structData.struct?I was surprised by this, it feels like a bug. I'm using
effect@3.16.16effect@3.16.16.See this test failing on an assertion using the
Equal.equalsEqual.equals trait:import { Data, Schema, Option } from 'effect';
import { AssertionError } from 'node:assert'
export const UserData = Schema.Struct({
apiKey: Schema.Option(Schema.String),
baseURL: Schema.Option(Schema.String),
}).annotations({
identifier: 'UserData',
});
if (import.meta.vitest) {
const { it } = await import('@effect/vitest');
const { assertEquals, throws } = await import('@effect/vitest/utils');
it('`Schema.Struct.make` is not compatible with `Data.struct`', () => {
const actual = UserData.make({
apiKey: Option.some('api_key'),
baseURL: Option.none(),
});
const expected = Data.struct({
apiKey: Option.some('api_key'),
baseURL: Option.none(),
});
throws(
// AssertionError: `Values have same structure but are not reference-equal`
() => assertEquals(actual, expected),
new AssertionError({
actual: actual,
expected: expected,
operator: 'deepStrictEqual',
}),
);
assertEquals(Data.struct(actual), expected);
})
}import { Data, Schema, Option } from 'effect';
import { AssertionError } from 'node:assert'
export const UserData = Schema.Struct({
apiKey: Schema.Option(Schema.String),
baseURL: Schema.Option(Schema.String),
}).annotations({
identifier: 'UserData',
});
if (import.meta.vitest) {
const { it } = await import('@effect/vitest');
const { assertEquals, throws } = await import('@effect/vitest/utils');
it('`Schema.Struct.make` is not compatible with `Data.struct`', () => {
const actual = UserData.make({
apiKey: Option.some('api_key'),
baseURL: Option.none(),
});
const expected = Data.struct({
apiKey: Option.some('api_key'),
baseURL: Option.none(),
});
throws(
// AssertionError: `Values have same structure but are not reference-equal`
() => assertEquals(actual, expected),
new AssertionError({
actual: actual,
expected: expected,
operator: 'deepStrictEqual',
}),
);
assertEquals(Data.struct(actual), expected);
})
}