Created
December 8, 2025 08:03
-
-
Save oussamahamdaoui/3792b7c79c0f0d4e3d693ff1a12d3293 to your computer and use it in GitHub Desktop.
Svelte isSnippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // THIS IS A HACK, USE ON YOUR OWN RISK | |
| <script module lang="ts"> | |
| import type { Snippet } from 'svelte'; | |
| const EmptySnippetKey = Object.getOwnPropertyNames(EmptySnippet).join(''); | |
| export function isSnippet<P extends unknown[] = []>(t: any): t is Snippet<P> { | |
| return Object.getOwnPropertyNames(t).join('') == EmptySnippetKey; | |
| } | |
| </script> | |
| {#snippet EmptySnippet()}{/snippet} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment