Consider this simple nested data structure:
interface Inner {
foo: string
}
interface Outer {
bar: Inner
}
A value of type Outer
can be losslessly converted to and from JSON. However, assigning it to a variable of type Jsonifiable
won’t compile with TS 5.5.2 and [email protected] Playground link:
declare const outer: Outer
let jsonifiable: Jsonifiable = outer
// ^ Type 'Outer' is not assignable to type 'Jsonifiable'.
// Type 'Outer' is not assignable to type '{ [x: string]: Jsonifiable | undefined; }'.
// Index signature for type 'string' is missing in type 'Outer'.(2322)
I believe the assignment should be valid.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too