v2 - Default TAmount=number for DineroSnapshot
dawidcxx opened this issue · comments
Since the default dinero instance is of type Dinero<number>
(and I think that is a sensible default). It would perhaps also make sense to default the generic param TAmount
in https://github.com/dinerojs/dinero.js/blob/main/packages/core/src/types/DineroSnapshot.ts to number
. Essentially
+ export type DineroSnapshot<TAmount = number> = {
- export type DineroSnapshot<TAmount> = {
The reason why I propose this change is that writing DineroSnapshot<number>
within my DTO/model declarations make seem more complicated/repetitive than it needs to be.
Hey @dawidcxx!
What about creating a wrapper type in your codebase instead?
type DineroSnapshotNumber = DineroSnapshot<number>
Dinero.js indeed provides a number implementation, but I don't think this choice should be reflected at the abstraction level.