2026-11-07 19:56 UTC
Replies (3)
-
@kkj@lemmy.dbzer0.com 2026-11-07 23:47
So, an equivalent to C#'s Type? or Python’s Optional[Type]? That’s still a lot better than nothing. You aren’t going to get an array when you asked for a float, for example.
-
@wucking_feardo@lemmy.world 2026-11-08 06:34
I don’t know shit about your codebase. But it sounds like you aren’t abstracting your API calls property. Ideally you have an API Client that consumes those blobs and converts them to some generically typed return value. On top of that you have your actual API, which accepts actions and returns actual objects/collections, or just fucking fails and bubbles up as a generic error because something’s gone fucking wrong.
-
@bitfucker@programming.dev 2026-11-08 15:36
You may need a tagged type. It is done on our code base such that currency of one type can’t be operated on currency of another type. The basic is that TAG !== TAG because even if the underlying type is the same (number), they are of different types on the type system. See also type-fest library that provide a ton more helper type like that