How to manage immutable nested data across Effects using a service in Effect Typescript

What's the best way to have some immutable nested data that you want to provide to a variety of Effects? I'm thinking of just creating a service with a nested object. Is that the best way to go about it? Like this?

Or maybe use schemas instead?

// Declaring a tag for a service that generates random numbers
class CanvasOptions extends Context.Tag("CanvasOptions")<
  CanvasOptions,
  {
    readonly someOption: {
      readonly someValue: number;
      readonly someValue2: number;
    };
    readonly someOption2: string;
  }
>() {}
Was this page helpful?