kysely icon indicating copy to clipboard operation
kysely copied to clipboard

Global type config

Open koskimas opened this issue 2 years ago • 1 comments

Adding global user-overridable type config.

This will allow users to use interface merging to configure internal Kysely types like the type that's used for the bigint DB data type. By default, Kysely uses annoyingly wide types like bigint | string | number since, on the type level, we don't know which dialect is being used and what data type mappings the user has installed in the driver.

The users can do something like this:

declare global {
  interface KyselyTypeConfig {
    bigIntType: number
  }
}

After doing this, for example the count function will return a number instead of the default bigint | string | number.

koskimas avatar Aug 03 '23 14:08 koskimas

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
kysely ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 3, 2023 2:11pm

vercel[bot] avatar Aug 03 '23 14:08 vercel[bot]