Skip to content

Commit

Permalink
docs: explain how to add ambient typings (#8558)
Browse files Browse the repository at this point in the history
* docs: explain how to add ambient typings

closes #8527

* Update packages/kit/types/ambient.d.ts

Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
  • Loading branch information
dummdidumm and Rich-Harris authored Jan 17, 2023
1 parent 1f3e1f1 commit 0523ab9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/curvy-chefs-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

docs: explain how to add ambient typings
5 changes: 4 additions & 1 deletion packages/kit/types/ambient.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
* }
* }
*
* export default undefined;
* export {};
* ```
*
* The `export {}` line exists because without it, the file would be treated as an _ambient module_ which prevents you from adding `import` declarations.
* If you need to add ambient `declare module` declarations, do so in a separate file like `src/ambient.d.ts`.
*
* By populating these interfaces, you will gain type safety when using `event.locals`, `event.platform`, and `data` from `load` functions.
*/
declare namespace App {
Expand Down

0 comments on commit 0523ab9

Please sign in to comment.