- Notifications
You must be signed in to change notification settings - Fork17
Cheatsheets for experienced Vue developers getting started with TypeScript
License
NotificationsYou must be signed in to change notification settings
typescript-cheatsheets/vue
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Cheatsheets for experienced Vue developers getting started with TypeScript
- Using theVue CLI , you can select theTypeScript plugin to be setup in a new a Vue project.
# 1. Install Vue CLI, if it's not already installednpm install --global @vue/cli# 2. Create a new project, then choose the "Manually select features" optionvue create<my-project-name>
- Vite is a new build tool by Evan You. It currently only works with Vue 3.x but supports TypeScript out-of-the-box.
⚠ Currently in beta. Do not use in production.
npm init vite-app<project-name>cd<project-name>npm installnpm run dev
note:
strict:truestricter inference for data properties onthis. If you do not use it,thiswill always be treated asany
// tsconfig.json{"compilerOptions": {"target":"esnext","module":"esnext","strict":true,"moduleResolution":"node" }}
Addlang="ts" to the script tag to declare TS as thelang used.
<scriptlang='ts'>...</script>
In Vue 2.x you need to define components withVue.component orVue.extend:
<scriptlang="ts">import Vue from "vue";export default Vue.extend({// type inference enabledname:"HelloWorld",props:{msg:String}});</script>
In Vue 3.x you can usedefineComponent to get type inference in Vue component options
import{defineComponent}from'vue';constComponent=defineComponent({// type inference enabled});
- Views on Vue podcast -https://devchat.tv/views-on-vue/vov-076-typescript-tell-all-with-jack-koppa/
About
Cheatsheets for experienced Vue developers getting started with TypeScript
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Contributors3
Uh oh!
There was an error while loading.Please reload this page.