Skip to content

Roninii/vue-typescript-cheatsheet

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

vue-typescript-cheatsheet

Cheatsheets for experienced Vue developers getting started with TypeScript

Recommended ts.config setup

note: strict:true stricter inference for data properties on this. If you do not use it, this will always be treated as any

// tsconfig.json
{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "strict": true,
    "moduleResolution": "node"
  }
}

Usage in .vue files

add lang="ts" to the script tag to declare TS as the lang used.

<script lang="ts">
  ...
</script>

use defineComponent to get type inference in Vue component options

import { defineComponent } from 'vue'

const Component = defineComponent({
  // type inference enabled
})

About

(seeking maintainers) Cheatsheets for experienced Vue developers getting started with TypeScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published