I have an interface FilterData
, which looks like the following:
export interface FilterData {
variables?: string[];
processDefinitionKey?: string;
}
In a request to the server, I receive the object filterSettings
which is of a type FilterData
, and I need to iterate over it.
This is what I'm doing right now:
for (const key in filterSettings) {
filterString += `${key}_eq_${filterSettings[key]},`;
}
But I receive the following error:
Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'FilterData'. No index signature with a parameter of type 'string' was found on type 'FilterData'.ts(7053)
I read here that the interface doesn't exist on the runtime, but I have no idea about what workaround could be. How I can iterate over the interface object?
const key in filterSettings
, at runtime, does not useFilterData
but just the object properties offilterSettings
. It should work (and does in my little scratch file). – fjc