Skip to content

Commit

Permalink
fix type
Browse files Browse the repository at this point in the history
  • Loading branch information
patroza committed Nov 11, 2023
1 parent ba0f738 commit 7c09ea8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/light-olives-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@effect-app/infra": patch
---

fix type
8 changes: 4 additions & 4 deletions packages/infra/_src/services/RepositoryBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function makeRepo<
const mkStore = makeStore<PM>()(name, schema, mapTo)

function make<R = never, E = never, R2 = never>(
args: Evt extends {} ? {
args: [Evt] extends [object] ? {
publishEvents: (evt: NonEmptyReadonlyArray<Evt>) => Effect<R2, never, void>
makeInitial?: Effect<R, E, readonly T[]>
config?: Omit<StoreConfig<PM>, "partitionValue"> & {
Expand Down Expand Up @@ -325,7 +325,7 @@ export const RepositoryBaseImpl = <Service>() => {
mapTo: (e: E, etag: string | undefined) => PM
): (abstract new() => Repository<T, PM, Evt, ItemType>) & Tag<Service, Service> & {
make<R = never, E = never, R2 = never>(
args: Evt extends {} ? {
args: [Evt] extends [object] ? {
publishEvents: (evt: NonEmptyReadonlyArray<Evt>) => Effect<R2, never, void>
makeInitial?: Effect<R, E, readonly T[]>
config?: Omit<StoreConfig<PM>, "partitionValue"> & {
Expand Down Expand Up @@ -375,7 +375,7 @@ export const RepositoryDefaultImpl = <Service>() => {
map: <B>(f: (a: Service) => B) => Effect<Service, never, B>
repo: Repository<T, PM, Evt, ItemType> // just a helper to type the constructor
}
& (Evt extends object ? {
& ([Evt] extends [object] ? {
make<R = never, E = never, R2 = never>(
args: {
publishEvents: (evt: NonEmptyReadonlyArray<Evt>) => Effect<R2, never, void>
Expand Down Expand Up @@ -417,7 +417,7 @@ export const RepositoryDefaultImpl = <Service>() => {
{
return class extends RepositoryBaseImpl<Service>()<PM, Evt>()(itemType, schema, mapFrom, mapTo) {
static toLayer<R = never, E = never, R2 = never>(
args: Evt extends {} ? {
args: [Evt] extends [object] ? {
publishEvents: (evt: NonEmptyReadonlyArray<Evt>) => Effect<R2, never, void>
makeInitial?: Effect<R, E, readonly T[]>
config?: Omit<StoreConfig<PM>, "partitionValue"> & {
Expand Down

0 comments on commit 7c09ea8

Please sign in to comment.