How to use platform/FileSystem
I am attempting to use platform-node/FileSystem. I copied pasted an example file in VSCode:
import * as FS from '@effect/platform-node/FileSystem'
import * as Node from '@effect/platform-node/Runtime'
import * as NodeContext from '@effect/platform-node/NodeContext'
import { Effect } from 'effect'
const main = Effect.gen(function* () {
const fs = yield* (FS.FileSystem)
yield* (fs.makeDirectory('output'))
yield* (fs.writeFileString('output/fs-write-file.txt', 'Hello World!'))
console.log('Wrote file (output/fs-write-file.txt)')
})
Node.runMain(
main.pipe(
Effect.provide(NodeContext.layer),
Effect.tapErrorCause(Effect.log))
)
I get this error: Tag<...., ....> not assignable to Effect<..., ..., ...>.
This is a brand new clean project. The code is cut and pasted from: https://github.com/Effect-TS/examples/blob/main/node-scripts/src/fs-write-file.ts
I am confused. What is going on? Thanks.
import * as FS from '@effect/platform-node/FileSystem'
import * as Node from '@effect/platform-node/Runtime'
import * as NodeContext from '@effect/platform-node/NodeContext'
import { Effect } from 'effect'
const main = Effect.gen(function* () {
const fs = yield* (FS.FileSystem)
yield* (fs.makeDirectory('output'))
yield* (fs.writeFileString('output/fs-write-file.txt', 'Hello World!'))
console.log('Wrote file (output/fs-write-file.txt)')
})
Node.runMain(
main.pipe(
Effect.provide(NodeContext.layer),
Effect.tapErrorCause(Effect.log))
)
I get this error: Tag<...., ....> not assignable to Effect<..., ..., ...>.
This is a brand new clean project. The code is cut and pasted from: https://github.com/Effect-TS/examples/blob/main/node-scripts/src/fs-write-file.ts
I am confused. What is going on? Thanks.

GitHub
A repository of examples showing how to use Effect - Effect-TS/examples
