Type Error with `Config.succeed` in `PgClient` Configuration

SOLVED
Hi! I'm encountering a type error when trying to use Config.string / Config.redacted/ Config.succeed in a PgClient configuration:
Type 'Config<string>' is not assignable to type 'string'.ts(2322)
PgClient.d.ts(58, 14): The expected type comes from property 'database' which is declared here on type 'PgClientConfig'


Here’s the relevant code snippet:
import Pg from '@effect/sql-pg'
import { Config } from 'effect'

const PgLive = Pg.PgClient.layer({
  database: Config.string('DB_DATABASE'),
  host: Config.string('DB_HOST'),
  username: Config.string('DB_USERNAME'),
  password: Config.redacted('DB_PASSWORD'),
  ssl: Config.succeed(true),
});

Dependencies:
- @effect/sql: ^0.25.0
- @effect/sql-pg: ^0.26.0
- effect: ^3.12.0
- typescript: 5.7.2
Was this page helpful?