Declaring types under 'kysely-codegen' module
Hey everyone, because I'm using Prisma to push schemas to my database (it's because my Zod Schemas) also getting generated from my Prisma schemas -- it's why I'm still using it incase you're wondering why I'm in this situation:
I have a
./types/kysely-codegen.d.ts
file which contains
in another file I have
BaseUser
gives me the error that 5 Replies
Not exactly related to how Kysely functions but if anyone can help it would be appreciated, this is what my tsconfig.json looks like
I know the
./types/kysely-codegen.d.ts
file works because if I change the name of BaseUser
to just User
it says Duplicate identifier 'User'.ts(2300)
so it must be a typescript thing that it's not aware that I am doing a module declare for it to know of the new types
a new day and somehow it works xD
hmm, is there anyway to configure kysely-codegen to retain the information that a field is optional or not?
For example, when I push this Prisma schema to the database kysely-codegen generates this from the above
the Selectable
of that is
I want it to know that updatedAt
is optional
updatedAt: Date | null?;
nevermind, found a easy solutionNullable means optional. Kysely automatically makes nullable fields optional in inserts and updates
You can use
Insertable
and Updateable
to get those types.
In SQL, when something is "missing" in selects, you get a nullOh WOW!
I see what you mean! that's amazing
❤️ Kysely, thank you very much for that insight koskimas