Currently, I am involved in a project called JSON-Schema-faker, where we utilize the TypeScript interface shown below:
interface IGeneratorSchema {
faker?: any;
chance?: any;
}
to define objects like:
{
"faker": "name.findName"
}
or:
{
"chance": {
"bool": {
"likelihood": 100
}
}
}
Our next task involves incorporating support for new fields x-faker
and x-chance
, which essentially serve the same purpose as faker
and chance
. For example:
{
"x-faker": "name.findName"
}
or:
{
"x-chance": {
"bool": {
"likelihood": 100
}
}
}
I understand that I cannot simply add x-faker
or x-chance
directly to the TypeScript interface. So, how can I work around this limitation? My goal is to narrow down the accepted fields in TypeScript to only include: faker
, chance
, x-faker
, and x-chance
.