Level 102
Show what you have and the error
Hello, i'm trying to install typescript to my laravel 9 + inertia (vue3) app, but i cant do it in normal way.. Typescript is not recognized . Any guide or something?
I just installed Vue 3 / Inertia using the Breeze scaffolding and after a few simple changes, TypeScript seemed to work: https://laravel.com/docs/9.x/starter-kits#breeze-and-inertia
app.js and bootstrap.js to app.ts and bootstrap.ts (and the vite.config.js file too, if you like)app.blade.php change the vite directive to point to the ts file: @vite('resources/js/app.ts')
vite.config.ts change app.js to app.ts
In any Vue SFC, set the language to "ts" and start using TypeScript. For example, in Login.vue this worked for me:
<script setup lang="ts">
function sayHello(name:string): string {
return `Hello ${name}`;
}
</script>
For specific TS related config, you might have to use a tsconfig.json file.
Please or to participate in this conversation.