View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0005844 | Taler | wallet-core | public | 2019-08-18 21:07 | 2022-12-05 09:09 |
Reporter | Florian Dold | Assigned To | Florian Dold | ||
Priority | low | Severity | tweak | Reproducibility | have not tried |
Status | closed | Resolution | fixed | ||
Product Version | git (master) | ||||
Target Version | 0.9 | Fixed in Version | 0.9 | ||
Summary | 0005844: use wrapper types instead of raw strings | ||||
Description | Instead of using e.g. contractHash: string we should have wrapper types for everything. As TS doesn't support nominal typing (but only structural typing), we need to name the member of the wrapper structure according to its type. Thus the above becomes contractHash: HashCode which is just an alias for contractHash: { sha512Hash: string } To implement this without having to duplicate all structs, the JSON validator (checkable.ts) needs to support wrapping parsed JSON in these wrappers. | ||||
Tags | No tags attached. | ||||
|
Instead of wrapper types, we can use flavors, which are compile-time only: interface Flavoring<FlavorT> { _type?: FlavorT; } export type Flavor<T, FlavorT> = T & Flavoring<FlavorT>; (via https://spin.atomicobject.com/2018/01/15/typescript-flexible-nominal-typing/) This allows implicit conversions between the "unflavored" type and flavored type, but prevents mixups between different flavored types. |
Date Modified | Username | Field | Change |
---|---|---|---|
2019-08-18 21:07 | Florian Dold | New Issue | |
2019-08-18 21:07 | Florian Dold | Status | new => assigned |
2019-08-18 21:07 | Florian Dold | Assigned To | => Florian Dold |
2020-09-04 12:16 | Florian Dold | Priority | normal => low |
2020-09-05 13:53 | Christian Grothoff | Severity | minor => tweak |
2020-09-08 18:12 | Florian Dold | Note Added: 0016932 | |
2020-09-09 09:30 | Florian Dold | Category | wallet (WebExtensions) => wallet (TS core) |
2022-08-25 20:41 | Christian Grothoff | Status | assigned => resolved |
2022-08-25 20:41 | Christian Grothoff | Resolution | open => fixed |
2022-08-25 20:41 | Christian Grothoff | Fixed in Version | => 0.9 |
2022-08-25 20:42 | Christian Grothoff | Product Version | => git (master) |
2022-08-25 20:42 | Christian Grothoff | Target Version | => 0.9 |
2022-11-04 20:53 | Christian Grothoff | Status | resolved => closed |
2023-04-13 20:36 | Florian Dold | Category | wallet (TS core) => wallet-core |