Effect CommunityEC
Effect Communityβ€’3y agoβ€’
24 replies
Magnus

Understanding and Troubleshooting Platform Library Usage

I'm trying to understand how to use platform library. I used it in the way I thought I should but I get an error complaining about missing [EffectTypeId]. Still newbie to effect-ts so I can't understand why I get this error.

The code:
import * as FileSystem from "@effect/platform/FileSystem"
import * as Context from "@effect/data/Context"
import { pipe } from "@effect/data/Function"
import { flatMap } from "@effect/io/Effect"

const FileSystemContext = Context.Tag<FileSystem.FileSystem>()

const enc = new TextEncoder()
export const filsystemOutput = (path: string, data: Uint8Array) => pipe(
  FileSystemContext,
  flatMap(fs =>
    fs.writeFile(path, enc.encode(data))
  )
)
image.png
Was this page helpful?