creating a type based on the input
export function getType(cols: Column[] | undefined){
if (!cols) return z.object({});
const schema = {};
cols.forEach((col) => {
schema[col.id] = z.string();
});
return z.object(schema);
}export function getType(cols: Column[] | undefined){
if (!cols) return z.object({});
const schema = {};
cols.forEach((col) => {
schema[col.id] = z.string();
});
return z.object(schema);
}im getting this error on schema[col.id]
Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
No index signature with a parameter of type 'string' was found on type '{}'.Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
No index signature with a parameter of type 'string' was found on type '{}'.