npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@best-skn/svelte-types

v1.1.1

Published

A Simple Type Definition Extension Library For Svelte Kit (Svelte 5)

Downloads

194

Readme

SKN Svelte Kit (Svelte 5) Type Extension Library

TypeScript Svelte

NPM Version MIT License

 

Introduction:

This is a simple TypeScript Type Extension Library for Svelte Kit (Svelte 5)

I made this library so that I can use it in all of my Svelte Kit (Svelte 5) projects without writing the same codes over and over again

 

Details:

SveltePageDataProps Type

  • Provides page server data type for svelte rune $props()
  • This type is intended to be used only in +page.svelte
  • For usage instruction, see Usage section

SvelteChildrenProps Type

  • Provides svelte children type for svelte components having svelte rune $props()
  • This type is intended to be used for components containing child components
  • For usage instruction, see Usage section

SveltePageLayoutProps Type

  • Provides page layout data type for svelte rune $props()
  • This type is intended to be used only in +layout.svelte
  • For usage instruction, see Usage section

Special Markdown Definition

  • This library contains a markdown definition to support mdsvex in .md files
  • mdsvex is not a requirement but if you do use it, then this definition will certainly help to process

 

Use Case:

  • Svelte Kit

 

Requirements:

This library has peer dependency for Svelte of minimum 5.16.0. It may or may not work on 6.x

This library is intended to be used in Svelte Kit of minimum 2.15.0. It may or may not work on 3.x

 

Usage:

To install the package, type the following in console

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

Create a directory called types in the root location of your project, and create a file called svelte.d.ts, then do this

import "@best-skn/svelte-types";

Check your tsconfig.json if includes property has **/*.ts, **/*.tsx, **/*.svelte otherwise the type definition file may not work

Now Inside your Svelte Kit (Svelte 5) Project, use the package like this (Just an example)

SveltePageDataProps Type:

Import & use 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:

Import & use 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:

Import & use 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>

 

Dedicated To:

  • 👩‍⚕️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.

 

License:

Copyright (C) 2024 SKN Shukhan

Licensed under the MIT License