|
|
|
|
|
by Waterluvian
2314 days ago
|
|
I think you used the wrong tool or misunderstood how to utilize typescript. If you want guarantees of data integrity from external sources, try something like Json Schema. Or even without that, your data should be entering the system as type 'unknown'. There's then a validator function that takes in unknown and outputs the intended type. From there onwards, integrity is guaranteed by typescript, but only if you have the discipline to use it consistently. Otherwise, yeah, don't bother. |
|
Anyway, we're going back to simple JSON objects. Typescript is clearly not helping in our case, and the whole process with parsing all incoming objects is fairly cumbersome without adding much value.