My problem is quite common, but the solutions found on stackoverflow are not suitable for my specific case.
I have a collection of objects that I need to manipulate, save, and load as json files. Here's an example of the interface:
type jsonValue = string | number | jsonValue[] | json | undefined;
interface json {
[index: string]: jsonValue
}
interface I_Foo extends json {
p1: string;
p2: number;
}
When trying to implement this, I encounter the following error:
An interface can only extend an object type or intersection of object types with statically known members.
How should I approach this issue? It is important that all interfaces adhere to the json format for seamless code iteration and serialization. At the same time, I need to define specific interfaces for each object.
Edit: Just to clarify, I require a solution to create an interface with any number of properties that align with json standards, which can then be implemented by a class for effective usage.