Skip to content

Commit 11e60c5

Browse files
authored
Merge pull request #2 from Roninii/master
Just some basic things to get the ball rolling on this ⚽
2 parents 36f9a5a + 698e29a commit 11e60c5

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

README.md

+32
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,35 @@
33
Cheatsheets for experienced Vue developers getting started with TypeScript
44

55
- https://devchat.tv/views-on-vue/vov-076-typescript-tell-all-with-jack-koppa/
6+
7+
8+
## Recommended ts.config setup
9+
note: `strict:true` stricter inference for data properties on `this`. If you do not use it, `this` will always be treated as `any`
10+
```json
11+
// tsconfig.json
12+
{
13+
"compilerOptions": {
14+
"target": "esnext",
15+
"module": "esnext",
16+
"strict": true,
17+
"moduleResolution": "node"
18+
}
19+
}
20+
```
21+
22+
## Usage in .vue files
23+
add `lang="ts"` to the script tag to declare TS as the lang used.
24+
```html
25+
<script lang="ts">
26+
...
27+
</script>
28+
```
29+
30+
use `defineComponent` to get type inference in Vue component options
31+
```js
32+
import { defineComponent } from 'vue'
33+
34+
const Component = defineComponent({
35+
// type inference enabled
36+
})
37+
```

0 commit comments

Comments
 (0)