sveld
sveld
is a TypeScript definition generator specifically designed for Svelte components. It performs static analysis to extract and document various component features like props, events, slots, and $$restProps
. The tool supports JSDoc annotations for enhanced type definitions and can generate documentation in Markdown and JSON formats.
Purpose
The primary goal of sveld
is to simplify the process of making third-party Svelte component libraries compatible with the Svelte Language Server and TypeScript. This enables better developer tooling, such as intelligent code completion in IDEs like VSCode.
Target Audience
- Library Authors: Developers creating Svelte component libraries who want to provide TypeScript support and documentation with minimal effort.
- End Users: Developers using Svelte component libraries who benefit from TypeScript definitions and comprehensive documentation.
Key Features
- TypeScript Definitions: Generates
.d.ts
files compatible with Svelte 3.55+. - Documentation: Produces Markdown and JSON documentation for components.
- JSDoc Support: Allows explicit type definitions and descriptions via JSDoc annotations.
- Framework Support: Specifically tailored for Svelte, with no direct support for other frameworks mentioned.
Supported Metadata
- Props (with inferred or JSDoc-specified types)
- Slots (named and default)
- Dispatched and forwarded events
$$restProps
forwarding
Integration
- Works with Rollup via plugin.
- Can be used via CLI or programmatically in Node.js.
- Supports publishing TypeScript definitions alongside the library to NPM.
Progressive Enhancement
- Falls back to
any
for types that cannot be inferred. - JSDoc annotations allow for precise type definitions when needed.
For more details, visit the GitHub repository .
sveltesvelte-componentdocumentationdocgentypescript-definitionsjsdoc
Featured Stories
No featured articles here. Navigate to an article, then pick the Feature on menu button