Resolving Type Error in Effect Context with Token Cache Function

getting a type error thats preventing a function that creates a cache from being used as the Type in an Effect.context...

// token-cache.live.ts
// Effect.Effect<Cache.Cache<string, TokenCacheError, AuthTokens>, never, EnvService | StorageService>
export const makeService = Effect.map(makeCache, (cache) => cache);

// token-cache.ts
export class TokenCache extends Effect.Tag("TokenCache")<
  TokenCache,
  Effect.Effect.Success<typeof makeService>
>() {
  static readonly Live = Layer.effect(this, makeService);

  static readonly Layer = Layer.provide(
    this.Live,
    Layer.mergeAll(StorageService.Layer, EnvService.Layer),
  );
}


getting the following type error...is there a way around this or is it just easier to use Context.Tag? moreso just curious as to the considerations around the type error thats evidently specific to caches by the looks?

'extends' clause of exported class 'TokenCache' has or is using private name 'CacheTypeId'
Was this page helpful?