There is no TypeScript support for Inertia and Svelte currently, you will have to use regular JavaScript until support has been added. There is currently an issue opened for it.
Inertia Svelte - Could not find a declaration
import { createInertiaApp } from '@inertiajs/inertia-svelte'
createInertiaApp({
resolve: name => require(`./Pages/${name}.svelte`),
setup({ el, App, props }) {
new App({ target: el, props })
},
})
Could not find a declaration file for module '@inertiajs/inertia-svelte'. 'c:/Users/jdh/Documents/My Documents/Developement/laravel/Inertia/inertia-svelte/node_modules/@inertiajs/inertia-svelte/src/index.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/inertiajs__inertia-svelte` if it exists or add a new declaration (.d.ts) file containing `declare module '@inertiajs/inertia-svelte';`ts(7016)
I tried the first suggestion of npm i --save-dev @types/inertiajs__inertia-svelte with the return message of 404 Not Found - GET https://registry.npmjs.org/@types%2finertiajs__inertia-svelte - Not found, as well as the second suggestion to no avail.
Also when I run npm run dev no page is shown, but the browser just keep loading and return the error Unable to connect but I guess this has to do with the modules not being seen withing app.js.
Please help!
@Randy_Johnson, it has been a while since I messed with Svelte. But I believe it tries to use TypeScript if it finds a tsconfig.json file and if you're using .ts files. Might be other things that makes it think you're using TypeScript, but that's just at the top of my head.
Please or to participate in this conversation.