-
-
Notifications
You must be signed in to change notification settings - Fork 610
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
We use bigserial in Postgres for many primary keys. Typescript has a built in bigint type, but I can't use it with IdEntity:
export class Credential implements IdEntity<Credential> {
@PrimaryKey({ type: 'bigint' })
id!: bigint;
}gives
Type 'Credential' does not satisfy the constraint '{ id: string | number; }'.
Types of property 'id' are incompatible.
Type 'bigint' is not assignable to type 'string | number'.ts(2344)
Describe the solution you'd like
Maybe an approach like UuidEntity would work here? Maybe BigIntIdEntity? Or maybe it'd be simple enough to just have id in IdEntity defined as id: number | string | bigint;?
Describe alternatives you've considered
I'm relatively new to Mikro ORM, so I'm not sure what a good alternative would be. We need to be able to define the entity so the database handles it as well as not overflowing the number type if it gets large enough.
Additional context
None needed that I can tell.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request