I'm running into this TS error in a SvelteKit project. I suspect the issue is that the .find that is returning the typed data may also return undefined, but I don't know how to handle this issue in a way that works with TS.
The code:
// Content
let {title, panelTitle, panelContent, background} = data.content.find(
(content) => content.language === $page.params.lang
);
The TS error:
Property 'title' does not exist on type '{ language: string; title: string; panelContent: string; panelTitle: string; background?: string | undefined; } | undefined'.ts(2339
Thanks for any insights you can provide!