Issue with Generic Method in Layer Implementation

Hi all,

Could somebody explain to me why it is not possible to have a Layer implementation with a generic method?

Example code:

import { Effect } from "effect";

interface ExampleImplementation {
  foo: string,
  bar: number,
  method: <T>(a: T) => T,
}

export class Example extends Effect.Service<ExampleImplementation>()("Example", {
    succeed: {
        foo: "foo",
        bar: 42,
        method: <T>(a: T) => a,
    },
    accessors: true,
}) {}

Effect.gen(function* () {
    const foo = yield* Example.foo; 
    // string

    const bar = yield* Example.bar; 
    // number

    const result = yield* Example.method(true);
  // Expect boolean, but... 
    // Property 'method' does not exist on type 'typeof Example'.(2339)
});


Live example: https://effect.website/play#aa58eb848ff2
Was this page helpful?