Skip to content

Commit da1a141

Browse files
make explanation clear, thank @DanielRosenwasser
1 parent e95fd6a commit da1a141

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/v2/guide/typescript.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,10 @@ var vm = new Vue({
140140
})
141141
```
142142

143-
## Annotating Return Type
143+
## Annotating Return Types
144144

145-
Vue's type definition is prone to [circular reference](https://github.com/Microsoft/TypeScript/issues/12846#issuecomment-270296195) of `this`.
146-
Annotating return type is highly recommended to avoid such error.
145+
Because of the circular nature of Vue's declaration files, TypeScript may have difficulties inferring the types of certain methods.
146+
For this reason, you may need to annotate the return type on methods like `render` and those in `computed`.
147147

148148
```ts
149149
import Vue, { VNode } from 'vue'
@@ -173,4 +173,5 @@ const Component = Vue.extend({
173173
})
174174
```
175175

176-
If you find type inference or member completion doesn't work, you can try annotating method return type.
176+
If you find type inference or member completion isn't working, annotating certain methods may help address these problems.
177+
Using the `--noImplicitAny` option will help find many of these unannotated methods.

0 commit comments

Comments
 (0)