mswjs / data

Data modeling and relation library for testing JavaScript applications.

Home Page:https://npm.im/@mswjs/data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`primaryKey` types does not support numbers

cloud-walker opened this issue · comments

Hello! I'm trying out the package for the first time, and I've noticed that the primaryKey type does not support numbers:

export type PrimaryKeyType = string

It is intentional? I need it to be number, as the real db my backend is using has numeric ids 😅

I'll be happy to open a PR if needed ❤️

Hi @cloud-walker thanks for opening the issue :).

I think that there is an issue there. here I guess getValue should return a type KeyType instead of PrimaryKeyType. An help will be great 🥳

Or we'd rather extend PrimaryKeyType to include a number and be a union type. I think KeyType represents an internal key for the model in a database, not the public primary key type.

I was thinking the same thing, I will open a PR and we will continue the discussion there