Effect.gen(function* () {
const [createdProduct] = yield* Effect.tryPromise<
Array<typeof Product.Type>,
Error
>({
try: () =>
// This is the part that errors, because the ID of the returned product is missing the branded type
database.drizzle
.insert(productsTable)
.values({
organizationId,
title: product.title,
description: product.description,
status: product.status,
})
.returning(),
catch: () => {
throw new Error();
},
});
return createdProduct;
}),`
Effect.gen(function* () {
const [createdProduct] = yield* Effect.tryPromise<
Array<typeof Product.Type>,
Error
>({
try: () =>
// This is the part that errors, because the ID of the returned product is missing the branded type
database.drizzle
.insert(productsTable)
.values({
organizationId,
title: product.title,
description: product.description,
status: product.status,
})
.returning(),
catch: () => {
throw new Error();
},
});
return createdProduct;
}),`