You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I understand there's a generated $types file that can be consumed in +page.js in order to apply typings to my loader. Given the following:
+page.js
exportconstprerender=true/** @type {import('./$types').PageLoad} */exportfunctionload(){return{meta: {// custom outputtitle: 'This is my meta title'}}}
+layout.svelte
<script>import{page}from'$app/stores';</script><!-- ⚠️ No auto-completion --><p>{$page.data.meta.title}</p><slot/>
How do I apply type inference so that $page.data.meta.title can show me its type and auto-completion in +layout.svelte?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I understand there's a generated $types file that can be consumed in +page.js in order to apply typings to my loader. Given the following:
+page.js
+layout.svelte
How do I apply type inference so that
$page.data.meta.title
can show me its type and auto-completion in +layout.svelte?Related docs:
Probably relates to #647
Beta Was this translation helpful? Give feedback.
All reactions