Effect CommunityEC
Effect Community2y ago
8 replies
Great Britton

Implementing a Service with Multiple Types of Input: Remote and Local Sources

when implementing a service, what is the correct way to allow for multiple types of input? ie for a remote source or a local source for the same service input?

interface ObjectProvider {
  get: Effect.Effect<
    never | FileSystem,
    never | HttpClientError | PlatformError,
    Record<string, unknown> | Record<string, unknown>[]
  >;
}

const ObjectProvider = Context.Tag<ObjectProvider>("@backend/ObjectProvider");


Was what I was thinking, but I receive this error at the ObjectProvider.of:

Type 'Effect<never, HttpClientError, Record<string, unknown>[]>' is not assignable to type 'Effect<FileSystem, HttpClientError | PlatformError, Record<string, unknown> | Record<string, unknown>[]>'.
Was this page helpful?