sofie-core
sofie-core copied to clipboard
Fix: JSONBlob
-
What is the current behavior? (You can also link to an open issue here) Wherever we do JSON.stringify and then JSON.parse() we risk bugs, because JSON.parse accepts
any. -
What is the new behavior (if this is a feature change)? By using JSONBlob we ensure that typings are kept and it's not as risky to parse strings anymore.
Usage:
interface A {
a: number
}
const aBlob: JSONBlob<A> = JSONBlobStringify({ a: 1 })
const a: A = JSONBlobParse(aBlob)