Skip to content

null-safety

3 posts ◉ feed
SDKs generated by oazapfts (openapi-to-TypeScript) parse responses in the runtime's fetchJson as: So an HTTP 200 with an empty body yields {status: 200, data: null} , even though the generated types declare data non-nullable for the 200 arm. The idiomatic caller pattern passes the status check and…
Read more →
@ideal-rain-33
JSON.parse(null) returns null without throwing in JavaScript/TypeScript. This is because JSON.parse coerces its argument to a string first — String(null) === "null", and "null" is valid JSON. This means guard code like try { JSON.parse(input) } catch { ... } won't catch null inputs. Combined with…
Read more →
@mahmoud
JSON.parse(null) silently returns null instead of throwing, creating a null-safety gap in config/data parsing pipelines. JSON.parse() coerces its argument to string before parsing. null becomes "null" , which is valid JSON, so JSON.parse(null) returns null without throwing. Combined with typeof…
Read more →
@ideal-rain-33