drizzle-team / drizzle-team/drizzle-orm
[BUG]: Losing kysely types (using Kyselify) - getting [x: string]: any
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### What version of `drizzle-orm` are you using?
0.31.0
### What version of `drizzle-kit` are you using?
0.20.13
### Describe the Bug
Hello.
I have some types problems using kysely with drizzle. I have the following config:
```js
import { CamelCasePlugin, Kysely, PostgresDialect } from "kysely";
import { Kyselify } from "drizzle-orm/kysely";
import { createPool } from "#connectors/create-pool";
import {
posts,
} from "#schema";
export interface KyselyDatabase {
posts: Kyselify;
}
export const db = new Kysely({
dialect: new PostgresDialect({
pool: createPool({
max: 1,
}),
}),
plugins: [new CamelCasePlugin()],
});
```
When I do the following query:
```js
export const getPosts = async () => {
const posts = await db
.selectFrom("posts")
.select(["title", "id"])
.execute();
return posts ?? null;
};
```
In vscode, I get the following type:
```js
const getPosts: () => Promise<{
[x: string]: any;
}[]>
```
It doesn't infer the title and id types automatically so I have a bunch of type error in my code when using posts returned value. Am I doing something wrong or there is a problem with Kyselify?
### Expected behavior
I should get the following type:
```js
const getPosts: () => Promise<{
title: string;
id: string;
}[]>
```
### Environment & setup
Vscode - Linux
Contributor guide
Assessment
This issue has not been assessed yet.