ivanhofer/typesafe-i18n-demo-sveltekit

Use `App.Session` type

Closed this issue · 2 comments

This is just a minor improvement. Newer SvelteKit projects provide a src/app.d.ts type definitions file. Instead of defining your own SessionPayload type in hooks.ts, you could extend App.Session in app.d.ts. For eample:

declare namespace App {
  interface Locals {}

  interface Platform {}

  interface Session {
    locale: Locales
  }

  interface Stuff {}
}

Thanks @svenjacobs, I already saw that SvelteKit updated the docs this week, but I haven't had time to update the example yet. I will do it in the next couple of days.

done!