Skip to content

Commit e25fca3

Browse files
authored
docs: separate props definition to make their types be inferable (#240)
1 parent 48059b8 commit e25fca3

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

example/App.vue

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,21 @@ import Component from '../lib/index'
1717
import Hello from './Hello.vue'
1818
import World from './World'
1919
20-
@Component({
20+
// We declare the props separately
21+
// to make props types inferable.
22+
const AppProps = Vue.extend({
2123
props: {
2224
propMessage: String
23-
},
25+
}
26+
})
27+
28+
@Component({
2429
components: {
2530
Hello,
2631
World
2732
}
2833
})
29-
export default class App extends Vue {
30-
// props have to be declared for typescript
31-
propMessage!: string
32-
34+
export default class App extends AppProps {
3335
// inital data
3436
msg: number = 123
3537

0 commit comments

Comments
 (0)