jawj / zapatos

Zero-abstraction Postgres for TypeScript: a non-ORM database library
https://jawj.github.io/zapatos/
Other
1.3k stars 46 forks source link

`numeric` and `money` should only allow `${number}` like `Int8String` #151

Open felixfbecker opened 1 year ago

felixfbecker commented 1 year ago

money currently accepts string | number in Insertables and returns string in Selectables. numeric, which is a fixed-decimal type just like money, currently only accepts number (resulting in potential loss of precision) and returns number in Selectables (which is incorrect).

These should both return a db.NumericString that is defined like below (just like Int8String already does) and both accept db.NumericString | number on input.

type NumericString = `${number}`