Error with 'this' Context in Effect TypeScript Code

I'm getting this error. Trying to follow this example https://github.com/Effect-TS/effect/blob/main/packages/platform/README.md#hello-world
// src/implementation.ts
import { HttpApiBuilder, HttpApiSwagger } from '@effect/platform'
import { BunHttpServer, BunRuntime } from '@effect/platform-bun'
import { Effect, Layer } from 'effect'
import { api } from './contract.ts'

// Implement the "Greetings" group
const GreetingsLive = HttpApiBuilder.group(api, 'Greetings', (handlers) =>
    handlers.handle('hello', () => Effect.succeed({ message: 'Hello from Effect on Cloudflare!' })),
)

// Create the final, implemented API Layer
export const MyApiLive = HttpApiBuilder.api(api).pipe(
    Layer.provide(HttpApiSwagger.layer()),
    Layer.provide(GreetingsLive),
)

// Set up the server using BunHttpServer on port 3000
const ServerLive = HttpApiBuilder.serve().pipe(
    Layer.provide(MyApiLive),
    Layer.provide(BunHttpServer.layer({ port: 3000 })),
)

// Launch the server
// Error v
Layer.launch(ServerLive).pipe(BunRuntime.runMain)


The 'this' context of type 'Effect<never, never, Api>' is not assignable to method's 'this' of type 'Effect<unknown, unknown, never>'.
Was this page helpful?