Skip to content

Commit 4c64c9d

Browse files
committed
chore: block controls visible #815
1 parent 92b2686 commit 4c64c9d

File tree

1 file changed

+71
-2
lines changed

1 file changed

+71
-2
lines changed

documentation/docs/98-reference/54-types.md

Lines changed: 71 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ To solve this problem, SvelteKit generates `.d.ts` files for each of your endpoi
2525

2626
```ts
2727
/// file: .svelte-kit/types/src/routes/[foo]/[bar]/[baz]/$types.d.ts
28-
/// link: false
28+
/// link: true
2929
import type * as Kit from '@sveltejs/kit';
3030

3131
type RouteParams = {
@@ -154,4 +154,73 @@ The `app.d.ts` file is home to the ambient types of your apps, i.e. types that a
154154

155155
Always part of this file is the `App` namespace. This namespace contains several types that influence the shape of certain SvelteKit features you interact with.
156156

157-
> TYPES: App
157+
## Error
158+
159+
Defines the common shape of expected and unexpected errors. Expected errors are thrown using the `error` function. Unexpected errors are handled by the `handleError` hooks which should return this shape.
160+
161+
<div class="ts-block">
162+
163+
```dts
164+
interface Error {/*…*/}
165+
```
166+
167+
<div class="ts-block-property">
168+
169+
```dts
170+
message: string;
171+
```
172+
173+
<div class="ts-block-property-details"></div>
174+
</div></div>
175+
176+
## Locals
177+
178+
The interface that defines `event.locals`, which can be accessed in server [hooks](/docs/kit/hooks) (`handle`, and `handleError`), server-only `load` functions, and `+server.js` files.
179+
180+
<div class="ts-block">
181+
182+
```dts
183+
interface Locals {}
184+
```
185+
186+
</div>
187+
188+
## PageData
189+
190+
Defines the common shape of the [$page.data store](/docs/kit/$app-stores#page) - that is, the data that is shared between all pages.
191+
The `Load` and `ServerLoad` functions in `./$types` will be narrowed accordingly.
192+
Use optional properties for data that is only present on specific pages. Do not add an index signature (`[key: string]: any`).
193+
194+
<div class="ts-block">
195+
196+
```dts
197+
interface PageData {}
198+
```
199+
200+
</div>
201+
202+
## PageState
203+
204+
The shape of the `$page.state` object, which can be manipulated using the [`pushState`](/docs/kit/$app-navigation#pushState) and [`replaceState`](/docs/kit/$app-navigation#replaceState) functions from `$app/navigation`.
205+
206+
<div class="ts-block">
207+
208+
```dts
209+
interface PageState {}
210+
```
211+
212+
</div>
213+
214+
## Platform
215+
216+
If your adapter provides [platform-specific context](/docs/kit/adapters#Platform-specific-context) via `event.platform`, you can specify it here.
217+
218+
<div class="ts-block">
219+
220+
```dts
221+
interface Platform {}
222+
```
223+
224+
</div>
225+
226+

0 commit comments

Comments
 (0)