3 ms·
RE: JSON: I've started tagging my JSON blobs as `unknown` and then using type guards (typeof, instanceof, field access existence checks, Array.isArray checks, u
by MaulingMonkey 7y ago
RE: JSON: I've started tagging my JSON blobs as `unknown` and then using type guards (typeof, instanceof, field access existence checks, Array.isArray checks, user defined type guards[1], etc.) my way to inferring the shape of that JSON blob is as expected, and it seems to work pretty well.
[1] https://www.typescriptlang.org/docs/handbook/advanced-types.html#user-defined-type-guards https://www.typescriptlang.org/docs/handbook/advanced-types....