Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global type config #631

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Global type config #631

wants to merge 1 commit into from

Conversation

koskimas
Copy link
Member

@koskimas koskimas commented Aug 3, 2023

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.

@vercel
Copy link

vercel bot commented Aug 3, 2023

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

@igalklebanov igalklebanov added enhancement New feature or request typescript Related to Typescript labels Aug 3, 2023
@koskimas koskimas force-pushed the master branch 2 times, most recently from 6790982 to 3a9d03f Compare September 28, 2023 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request typescript Related to Typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants