Using Quasar’s Built‑In TypeScript Support to Catch Errors Early
Learn how Quasar’s built‑in TypeScript extension catches errors early, shows them in dev and build, and what trade‑offs to consider.
25 Feb 2026, 07:49 UTC

When a Vue.js project grows, plain JavaScript can let subtle bugs slip into components, services, or Quasar plugin usage. The moment a typo or mismatched property reaches production, debugging becomes costly and confidence erodes. Quasar Framework addresses this by bundling a TypeScript extension that plugs directly into its CLI, giving you static type checks without manual webpack tweaks.
Why TypeScript matters in a Quasar project
Quasar provides a rich set of components, directives, and the $q instance. When these APIs are consumed in plain JavaScript, the editor can only guess at the correct shape, and the runtime will surface errors only when the faulty code executes. Adding TypeScript turns those guesses into contracts: props, emits, and plugin return types are verified at compile time, and the development server shows mismatches instantly.
Adding TypeScript with the Quasar extension
Start from a fresh Quasar CLI project (v2.0+ required). In your terminal, run:
# Create a new Quasar app (choose Vue 3 when prompted)
quasar create my-app
cd my-app
# Add the official TypeScript extension
quasar ext add @quasar/quasar-app-extension-typescript
The extension creates a tsconfig.json in the project root with sensible defaults (strict mode enabled, Vue‑3 JSX support, etc.). You can verify its presence:
ls -la tsconfig.json
No special permissions are needed; the commands run as your regular user. If the extension fails to add, ensure you have Quasar CLI ≥2.0 (quasar -v) and that the project uses Vue 3.
Seeing type errors during development
With the extension active, any .vue file can declare lang="ts" on its script block. The Quasar dev server runs vue-tsc in the background, pushing type errors to the terminal and to the browser overlay.
Create a simple component to illustrate:
Count: {{ count }}
Run the dev server:
quasar dev
You should see output similar to:
ERROR in src/components/Counter.vue:12:3
TS2322: Type 'string' is not assignable to type 'number'.
The browser overlay will also highlight the same line. This immediate feedback prevents the mistake from propagating further.
Type‑checking in the production build
Quasar’s build pipeline incorporates the same type‑checking step. Running:
quasar build
will fail with a non‑zero exit code if any TypeScript error exists, displaying the same messages you saw in dev. This guarantees that only type‑safe code reaches the distributable dist/ folder.
Trade‑offs and limitations
- The extension requires Quasar CLI v2+ and a Vue 3 project; migrating from Quasar v1 or Vue 2 needs manual tsconfig and webpack adjustments.
- Enabling strict mode may expose existing JavaScript‑only code that lacks type definitions, prompting you to install
@typespackages or write declaration files before the build succeeds. - Build times increase slightly due to the extra
vue-tscpass, though the impact is usually modest for medium‑sized apps.
To check that the build respects type safety, intentionally introduce a type error as shown above, run quasar build, and verify that the command exits with an error and does not produce a dist/ folder (or produces it only after the error is fixed).
Actionable next steps
- Upgrade to Quasar CLI v2 if you haven’t already (
npm i -g @quasar/cli@latest). - Add the TypeScript extension to an existing project with
quasar ext add @quasar/quasar-app-extension-typescript. - Convert a few critical components to
lang="ts"and fix any reported type mismatches. - Commit the generated
tsconfig.jsonand make the type‑check step part of your CI pipeline (e.g., runquasar buildon pull requests).
By leveraging Quasar’s native TypeScript integration, you shift error detection from runtime to compile time, making your Vue.js codebase more reliable and easier to maintain.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.