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)
});
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)
});