I have the following code:
export const getTagsByType = <Data extends { keywords?: { tags: { name: string, type: string }[] } }>(type: string, rawData: Data) => {
return rawData.keywords?.tags.filter((tag) => tag.type === type).map(tag => tag.name);
}
export const buildLoadedData = () => {
const rawDTMData = window.DATA;
return {
"loaded_content":getTagsByType("generic", rawDTMData).toString(),
}
}
However, buildLoadedData
returns before the function executes for some reason. What do I do here so that loaded_content actually has some content?