Skip to content

Commit ccf5e62

Browse files
src: update sources to use typescript
Signed-off-by: Arnav Gupta <arnav@codingblocks.com>
1 parent 7ba3693 commit ccf5e62

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

app/components/Counter.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</Page>
1717
</template>
1818

19-
<script>
19+
<script lang="ts">
2020
import { mapActions } from 'vuex';
2121
2222
export default {

app/components/HelloWorld.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</Page>
1616
</template>
1717

18-
<script>
18+
<script lang="ts">
1919
export default {
2020
data () {
2121
return {

app/router/index.js renamed to app/router/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import VueRouter from 'vue-router';
33

44
Vue.use(VueRouter);
55

6-
import Home from '../components/Home';
7-
import HelloWorld from '../components/HelloWorld';
8-
import Counter from '../components/Counter';
6+
import Home from '../components/Home.vue';
7+
import HelloWorld from '../components/HelloWorld.vue';
8+
import Counter from '../components/Counter.vue';
99

1010
const router = new VueRouter({
1111
routes: [

app/store/index.js renamed to app/store/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import counter from './modules/counter';
55

66
Vue.use(Vuex);
77

8+
declare var process: {env: {[s: string]: string}};
89
const debug = process.env.NODE_ENV !== 'production';
910

1011
const store = new Vuex.Store({

app/store/modules/counter.js renamed to app/store/modules/counter.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
import {MutationTree, ActionTree} from 'vuex'
12
const state = {
23
count: 0,
34
};
45

5-
const mutations = {
6+
const mutations = <MutationTree<typeof state>>{
67
decrement (state) {
78
state.count--;
89
},
@@ -11,7 +12,7 @@ const mutations = {
1112
},
1213
};
1314

14-
const actions = {
15+
const actions = <ActionTree<typeof state, any>>{
1516
increment: ({commit}) => commit('increment'),
1617
decrement: ({commit}) => commit('decrement'),
1718
};

0 commit comments

Comments
 (0)