RobinBlomberg / kysely-codegen

Generate Kysely type definitions from your database.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug in runtime enums

mariandaniel24 opened this issue · comments

Hello, in regard to the implementation of runtime enums in #115 , I believe there is a bug with the generated keys.
So, given this SQL

CREATE TYPE risk_evaluation_status AS ENUM ('OK', 'CAN_USE', 'SHOULD_NOT_BE_USED');

When I generate types using kysely-codegen --camel-case --runtime-enums --dialect=postgres --out-file=generated/db-types.ts:

The output is:

// It generates this
export enum RiskEvaluationStatus {
	CANUSE = 'CAN_USE',
	OK = 'OK',
	SHOULDNOTBEUSED = 'SHOULD_NOT_BE_USED',
}

// It should actually generate
export enum RiskEvaluationStatus {
	CAN_USE = 'CAN_USE',
	OK = 'OK',
	SHOULD_NOT_BE_USED = 'SHOULD_NOT_BE_USED',
}

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar

Encountering the same issue.

Same here. If it's not intended, I'll hopefully create a PR.