Overview:
This product is a template that helps developers get started with developing using Vue 3 and Typescript in Vite. It provides recommendations for the IDE setup, including using VSCode and Vetur or Volar for proper IDE support. It also explains how to enable type support for .vue imports in TypeScript.
Features:
- Vue 3 + Typescript + Vite: This template combines the power of Vue 3, Typescript, and Vite to provide a robust development environment.
- Recommended IDE Setup: The product suggests using VSCode as the IDE and enabling vetur.experimental.templateInterpolationService in the settings. Alternatively, it recommends using Volar instead of Vetur for better IDE support for the <script setup> syntax.
- Type Support For .vue Imports in TS: TypeScript cannot handle type information for .vue imports by default. This product provides instructions on how to shim .vue imports to be a generic Vue component type. It also explains how to get actual prop types in .vue imports for props validation.
Installation:
To install the template, follow these steps:
- Set up the recommended IDE by installing VSCode and Vetur or Volar.
- Enable vetur.experimental.templateInterpolationService in the VSCode settings.
- If using <script setup>, install and use Volar instead of Vetur for better IDE support.
- If you want actual prop types in .vue imports, follow the instructions based on the IDE you are using:
- If using Volar, switch the TS Plugin on/off from the VSCode command palette.
- If using Vetur, install and add @vuedx/typescript-plugin-vue to the plugins section in tsconfig.json. Delete src/shims-vue.d.ts as it is no longer needed. Open src/main.ts in VSCode and search for “Select TypeScript version” in the command palette. Choose “Use workspace version.”
Summary:
This product is a template designed to help developers start developing with Vue 3 and Typescript in Vite. It provides recommendations for IDE setup and offers instructions on enabling type support for .vue imports in TypeScript. With its features, developers can set up a robust development environment and benefit from improved IDE support and prop type validation.