Skip to content

Commit 0ba995e

Browse files
sandersnktsn
authored andcommitted
Fix export default in index.d.ts (#1000)
* Fix export default in index.d.ts This breaks in Typescript 2.6 with the error "The expression of an export assignment must be an identifier or qualified name in an ambient context." This commit also adds a small test that uses the default export, since no test existed previously. * Remove mistakenly added emacs backup file * Do not export _default
1 parent 887f563 commit 0ba995e

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

types/index.d.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ export interface ModuleTree<R> {
121121
[key: string]: Module<any, R>;
122122
}
123123

124-
export default {
125-
Store,
126-
install
127-
};
124+
declare const _default: {
125+
Store: typeof Store;
126+
install: typeof install;
127+
}
128+
export default _default;

types/test/index.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,30 @@ namespace RootModule {
6666
});
6767
}
6868

69+
namespace RootDefaultModule {
70+
const store = new Vuex.default.Store({
71+
state: {
72+
value: 0
73+
},
74+
getters: {
75+
count: state => state.value,
76+
plus10: (_, { count }) => count + 10
77+
},
78+
actions: {
79+
foo ({ state, getters, dispatch, commit }, payload) {
80+
state.value;
81+
getters.count;
82+
dispatch("bar", {});
83+
commit("bar", {});
84+
}
85+
},
86+
mutations: {
87+
bar (state, payload) {}
88+
},
89+
strict: true
90+
});
91+
}
92+
6993
namespace NestedModules {
7094
interface RootState {
7195
a: {

0 commit comments

Comments
 (0)