RobinBlomberg / kysely-codegen

Generate Kysely type definitions from your database.
MIT License
819 stars 73 forks source link

MySQL Json type issue #176

Open dotMortis opened 4 months ago

dotMortis commented 4 months ago

Can't access a key via the ref key combination. Type of available keys leads to never.

Here is an example:

import { Kysely } from 'kysely';
import { Json } from 'kysely-codegen';

// create a table with json values as it would be generated by codegen
type TestDB = {
    testTable: {
        testJsonColumn: Json;
    };
};
const db = {} as Kysely<TestDB>;
// query the json field
await db
    .selectFrom('testTable')
    .select(b => b.ref('testJsonColumn', '->$').key('someKey').as('myKey'))
    .execute();

image

Upvote & Fund

Fund with Polar