From 2a5783397eccd4927742dd95508938b7c7f20fb2 Mon Sep 17 00:00:00 2001 From: Tony <68118705+Legend-Master@users.noreply.github.com> Date: Wed, 9 Sep 2026 19:31:52 +0800 Subject: [PATCH] refactor(example): use tsconfig and change entries to ts (#3575) --- examples/api/index.html | 2 +- examples/api/src/{main.js => main.ts} | 2 +- examples/api/{jsconfig.json => tsconfig.json} | 6 ++++-- examples/api/{vite.config.js => vite.config.ts} | 0 4 files changed, 6 insertions(+), 4 deletions(-) rename examples/api/src/{main.js => main.ts} (87%) rename examples/api/{jsconfig.json => tsconfig.json} (84%) rename examples/api/{vite.config.js => vite.config.ts} (100%) diff --git a/examples/api/index.html b/examples/api/index.html index 2cd1bfe5f..acd46f195 100644 --- a/examples/api/index.html +++ b/examples/api/index.html @@ -12,6 +12,6 @@
- + diff --git a/examples/api/src/main.js b/examples/api/src/main.ts similarity index 87% rename from examples/api/src/main.js rename to examples/api/src/main.ts index 5b7473f64..c0e0e5f1d 100644 --- a/examples/api/src/main.js +++ b/examples/api/src/main.ts @@ -8,7 +8,7 @@ import App from './App.svelte' import { mount } from 'svelte' const app = mount(App, { - target: document.querySelector('#app') + target: document.querySelector('#app')! }) export default app diff --git a/examples/api/jsconfig.json b/examples/api/tsconfig.json similarity index 84% rename from examples/api/jsconfig.json rename to examples/api/tsconfig.json index 5696a2de7..c315e05d3 100644 --- a/examples/api/jsconfig.json +++ b/examples/api/tsconfig.json @@ -3,6 +3,7 @@ "moduleResolution": "bundler", "target": "ESNext", "module": "ESNext", + "noEmit": true, /** * svelte-preprocess cannot figure out whether you have * a value or a type, so tell TypeScript to enforce using @@ -22,11 +23,12 @@ * Typecheck JS in `.svelte` and `.js` files by default. * Disable this if you'd like to use dynamic types. */ - "checkJs": true + "checkJs": true, + "types": ["vite/client", "svelte"] }, /** * Use global.d.ts instead of compilerOptions.types * to avoid limiting type declarations. */ - "include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"] + "include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.ts", "src/**/*.svelte"] } diff --git a/examples/api/vite.config.js b/examples/api/vite.config.ts similarity index 100% rename from examples/api/vite.config.js rename to examples/api/vite.config.ts