]>
Commit | Line | Data |
---|---|---|
e8fcef96 RBR |
1 | [forum](../README.md) / [Exports](../modules.md) / App |
2 | ||
3 | # Namespace: App | |
4 | ||
5 | It's possible to tell SvelteKit how to type objects inside your app by declaring the `App` namespace. By default, a new project will have a file called `src/app.d.ts` containing the following: | |
6 | ||
7 | ```ts | |
8 | /// <reference types="@sveltejs/kit" /> | |
9 | ||
10 | declare namespace App { | |
11 | interface Locals {} | |
12 | ||
13 | interface Platform {} | |
14 | ||
15 | interface Session {} | |
16 | ||
17 | interface Stuff {} | |
18 | } | |
19 | ``` | |
20 | ||
21 | By populating these interfaces, you will gain type safety when using `event.locals`, `event.platform`, `session` and `stuff`: | |
22 | ||
23 | ## Table of contents | |
24 | ||
25 | ### Interfaces | |
26 | ||
27 | - [Locals](../interfaces/App.Locals.md) | |
28 | - [Platform](../interfaces/App.Platform.md) | |
29 | - [Session](../interfaces/App.Session.md) | |
30 | - [Stuff](../interfaces/App.Stuff.md) |