From 9996adf0b91d9526183bc2c80619a8a1d42f6df1 Mon Sep 17 00:00:00 2001 From: Yusuf Kandemir Date: Thu, 19 Sep 2024 13:53:23 +0300 Subject: [PATCH] docs(app-vite): improve supporting TS page --- .../pages/quasar-cli-vite/supporting-ts.md | 82 +++++++++---------- 1 file changed, 37 insertions(+), 45 deletions(-) diff --git a/docs/src/pages/quasar-cli-vite/supporting-ts.md b/docs/src/pages/quasar-cli-vite/supporting-ts.md index f1f39ae9c72..457e411f0a9 100644 --- a/docs/src/pages/quasar-cli-vite/supporting-ts.md +++ b/docs/src/pages/quasar-cli-vite/supporting-ts.md @@ -5,15 +5,28 @@ related: - /quasar-cli-vite/quasar-config-file --- -The Typescript support is not added by default to your project (unless you selected TS when you created your project folder), but it can be easily integrated by following the guide on this page. +If you didn't select TypeScript support when creating your project, you can still add it later. This guide will show you how to add TypeScript support to your existing JavaScript-based Quasar project. ::: tip -The following steps are only required when you **have not** selected TypeScript support when creating a fresh Quasar project. If you selected the TS option on project creation, TypeScript support is already enabled. +If you selected TypeScript support when creating your project, you can skip this guide. ::: ## Installation of TypeScript Support -Create `/tsconfig.json` file at the root of you project with this content: +Install the `typescript` package: + +```tabs +<<| bash Yarn |>> +$ yarn add --dev typescript +<<| bash NPM |>> +$ npm install --save-dev typescript +<<| bash PNPM |>> +$ pnpm add -D typescript +<<| bash Bun |>> +$ bun add --dev typescript +``` + +Then, create `/tsconfig.json` file at the root of you project with this content: ```json { @@ -33,35 +46,18 @@ Create `/tsconfig.json` file at the root of you project with this content: } ``` -Then install the `typescript` package: - -```tabs -<<| bash Yarn |>> -$ yarn add --dev typescript -<<| bash NPM |>> -$ npm install --save-dev typescript -<<| bash PNPM |>> -$ pnpm add -D typescript -<<| bash Bun |>> -$ bun add --dev typescript -``` - Now you can start using TypeScript into your project. Note that some IDEs might require a restart for the new setup to fully kick in. ::: tip -Remember that you must change the extension of your JavaScript files to `.ts` to be allowed to write TypeScript code inside them. To write TS code into your components, instead, change the script opening tag like so `