TypeScript Svelte
SveltePageDataProps
Type$props()
+page.svelte
Usage
sectionSvelteChildrenProps
Type$props()
Usage
sectionSveltePageLayoutProps
Type$props()
+layout.svelte
Usage
section.md
filesmdsvex
is not a requirement but if you do use it, then this definition will certainly help to process
5.16.0
2.15.0
npm add -D @best-skn/svelte-types #or yarn add -D @best-skn/svelte-types #or pnpm add -D @best-skn/svelte-types #or bun add -D @best-skn/svelte-types
types
in the root location of your project, and create a file called svelte.d.ts
, then do thisimport "@best-skn/svelte-types";
tsconfig.json
if includes
property has **/*.ts
, **/*.tsx
, **/*.svelte
otherwise the type definition file may not workSveltePageDataProps
Type:SveltePageDataProps
inside +page.svelte
like this//* `+page.svelte` <script lang="ts"> import type { SveltePageDataProps } from "svelte"; import type { PageServerData } from "./$types"; let { data }: SveltePageDataProps<PageServerData> = $props(); </script>
SvelteChildrenProps
Type:SvelteChildrenProps
inside svelte components containing child components<script lang="ts"> import type { SvelteChildrenProps } from "svelte"; let { children }: SvelteChildrenProps = $props(); </script> <div> {@render children()} </div>
SveltePageLayoutProps
Type:SveltePageLayoutProps
inside +layout.svelte
like this//* `+layout.svelte` <script lang="ts"> import type { SveltePageLayoutProps } from "svelte"; let { children, data, row }: SveltePageLayoutProps<unknown> = $props(); </script> <div> <main> {@render children()} </main> </div>
Tanjila Hasan Trina
: The long lost love of my life. The course of nature separated us from our paths and put us in separate places far away from each other. But no matter how separated we are right now, each and every moment of mine is only dedicated to you. We may not see each other in this lifetime as it seems but I will find you again in the next life. I just want to say: ไธ็ใฏๆฎ้
ทใ ใใใงใๅใๆใใ
My Parents
: The greatest treasures of my life ever.
Copyright (C) 2024 SKN Shukhan
Licensed under the MIT License