Brand Type Lost During Schema Transformation in TypeScript
Hi, brand type lost during transform. Am I using it wrong or is this a bug?
import { Schema } from "@effect/schema";
const UserId = Schema.String.pipe(Schema.brand('UserId'));
const User = Schema.Struct({
id: UserId,
});
const Wrapper = Schema.Struct({
payload: User,
});
const UserFromWrapper = Wrapper.pipe(
Schema.transform(User, {
decode: ({ payload }) => payload,
// compile error: payload.id is string and not a branded type
encode: (payload) => ({ payload })
})
);