Svelte Notes Sample App Ts screenshot

Svelte Notes Sample App Ts

Author Avatar Theme by Cvetkovskin
Updated: 11 Aug 2021
13 Stars

A sample app made using the Svelte framework and TypeScript

Categories

Overview:

This article discusses a template for developing with Svelte and TypeScript in Vite. It mentions that this template is a good starting point for beginners and provides capabilities on par with other Vite templates. It also explains that the template can be easily migrated to SvelteKit if needed. The article addresses technical considerations such as the routing solution and compiler options.

Features:

  • Svelte + TypeScript + Vite Template: A template for developing with Svelte, TypeScript, and Vite.
  • Good Starting Point: Provides capabilities comparable to other create-vite templates, making it suitable for beginners.
  • Easy Migration: The template is structured similarly to SvelteKit, making it easy to migrate to SvelteKit if needed.
  • Flexible Type Acceptance: Uses global.d.ts instead of compilerOptions.types to accept type information from the entire workspace.
  • VS Code Integration: Includes a .vscode/extensions.json file to prompt the user to install recommended extensions upon opening the project.
  • JavaScript Compatibility: Allows the use of JavaScript syntax in .svelte files and supports a mixed codebase if relevant.
  • HMR State Preservation: Explains that HMR state preservation has been disabled by default due to unexpected behavior and suggests using external stores for retaining important component state.

Installation:

To install the Svelte + TypeScript + Vite template, follow these steps:

  1. Clone the repository to your local machine:
git clone [repository-url]
  1. Navigate to the project directory:
cd [project-directory]
  1. Install the dependencies using npm:
npm install
  1. Start the development server:
npm run dev
  1. Open the project in your preferred IDE, such as VS Code.

Summary:

The Svelte + TypeScript + Vite template is a useful starting point for developers who want to work with Svelte, TypeScript, and Vite. It provides capabilities on par with other create-vite templates and offers an easy migration path to SvelteKit if needed. The template includes features such as flexible type acceptance, VS Code integration, and support for JavaScript syntax in .svelte files. HMR state preservation is disabled by default due to unexpected behavior, and developers are encouraged to use external stores for retaining important component state.