Resolving Type Mismatch in Config Module with Effect

Hi all, I'm trying to create a strongly-typed config module to load my environment variables with Effect, but I'm getting a lint error in my wrapper function when I try to do this:

import { Config, Effect } from "effect";

const appConfig = Config.all({
  host: Config.string("HOST").pipe(Config.withDefault("localhost")),
  port: Config.number("PORT").pipe(Config.withDefault(8080)),
});

const config = Config.all({
  app: appConfig,
});

type ConfigType = Config.Config<typeof config>;

// function to load the configuration
async function loadConfig(): Promise<ConfigType> {
  return await Effect.runPromise(config); // lint error under 'return'
}

const cfg = await loadConfig();
console.log(cfg);
console.log(cfg.app.port);

The lint error is a type mismatch (type ConfigType is missing the following properties from type config).

Not even sure what to ask. Should I be returning my config using Effect's Config object or am I on the right track?
Was this page helpful?