Wanted a type safe get and set context in Svelte kit with reactivity across the page and component but scoped to per layout.
/context
folder as I did with src/lib/context/sample.ts/sample
folder you can access the value with magic of svelte import { PageCtx } from '$lib/context';
const pageCtx = new PageCtx("sample");
const title = pageCtx.get("title");
new PageCtx("correct-name")
get
or set
it will throw error pageCtx.get("correct-key")
$title=true
.set()
in +layout.svelte
it will throw error