diff --git a/src/components/AddressForm.vue b/src/components/AddressForm.vue index 331518c..29135b8 100644 --- a/src/components/AddressForm.vue +++ b/src/components/AddressForm.vue @@ -18,7 +18,6 @@ import Component from 'vue-class-component'; import store from '@/store'; -import AddressEntry from '@/interface/AddressEntry'; import { loadDataSource } from '@/lib/datasource-utils'; import TypeaheadInput from './TypeaheadInput.vue'; diff --git a/src/components/Autocomplete.vue b/src/components/Autocomplete.vue index b617a51..c36b683 100644 --- a/src/components/Autocomplete.vue +++ b/src/components/Autocomplete.vue @@ -14,7 +14,6 @@ ul.typeahead-autocomplete(:style='style', v-if='hasData') import Vue from 'vue'; import Component from 'vue-class-component'; -import AddressEntry from '@/interface/AddressEntry'; import { addressToString, getDataItemKeys } from '@/lib/utils'; @Component({ diff --git a/src/components/TypeaheadInput.vue b/src/components/TypeaheadInput.vue index 3561bf9..d04c2b7 100644 --- a/src/components/TypeaheadInput.vue +++ b/src/components/TypeaheadInput.vue @@ -36,7 +36,6 @@ import Vue from 'vue'; import Component from 'vue-class-component'; -import AddressEntry from '@/interface/AddressEntry'; import { getPossibles } from '@/lib/datasource-utils'; import { getDataItemKeys } from '@/lib/utils'; import Autocomplete from './Autocomplete.vue'; diff --git a/src/interface/AddressEntry.ts b/src/global.d.ts similarity index 94% rename from src/interface/AddressEntry.ts rename to src/global.d.ts index bc0f103..3360416 100644 --- a/src/interface/AddressEntry.ts +++ b/src/global.d.ts @@ -37,5 +37,3 @@ interface AddressEntry { amphoe_code?: any; province_code?: any; } - -export default AddressEntry; diff --git a/src/index.ts b/src/index.ts index 4dabcd8..d656de1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,12 +1,19 @@ import AddressForm from '@/components/AddressForm.vue'; -import V from 'vue'; +import Vue from 'vue'; + +/* tslint:disable: no-namespace */ +declare global { + interface Window { + Vue: typeof Vue; + } +} /** * Install as Vue plugin. * - * @param {typeof V} Vue Vue instance. + * @param {typeof Vue} vue Vue instance. */ -function install(Vue: typeof V): void { +function install(vue: typeof Vue): void { Vue.component('address-form', AddressForm); } diff --git a/src/lib/datasource-utils/get-possibles.ts b/src/lib/datasource-utils/get-possibles.ts index 3709fcd..33a2d24 100644 --- a/src/lib/datasource-utils/get-possibles.ts +++ b/src/lib/datasource-utils/get-possibles.ts @@ -1,4 +1,3 @@ -import AddressEntry from '@/interface/AddressEntry'; import { calculateSimilarity } from '@/lib/utils'; import * as filter from 'array-filter'; diff --git a/src/lib/datasource-utils/load-data-source.ts b/src/lib/datasource-utils/load-data-source.ts index 70b626a..790404a 100644 --- a/src/lib/datasource-utils/load-data-source.ts +++ b/src/lib/datasource-utils/load-data-source.ts @@ -1,5 +1,4 @@ import database from '@/data/db.json'; -import AddressEntry from '@/interface/AddressEntry'; import preprocess from './preprocess'; /** diff --git a/src/lib/datasource-utils/preprocess.ts b/src/lib/datasource-utils/preprocess.ts index 419bb8f..9eede1d 100644 --- a/src/lib/datasource-utils/preprocess.ts +++ b/src/lib/datasource-utils/preprocess.ts @@ -1,5 +1,3 @@ -import AddressEntry from '@/interface/AddressEntry'; - /** * Preprocess data from JSON database. * diff --git a/src/lib/utils/address-to-string.ts b/src/lib/utils/address-to-string.ts index 429c27e..1cbc56a 100644 --- a/src/lib/utils/address-to-string.ts +++ b/src/lib/utils/address-to-string.ts @@ -1,4 +1,3 @@ -import AddressEntry from '@/interface/AddressEntry'; import highlightQuery from './highlight-query'; export const SEPARATOR: string = 'ยป'; diff --git a/src/lib/utils/calculate-similarity.ts b/src/lib/utils/calculate-similarity.ts index d3b6f21..81a89a3 100644 --- a/src/lib/utils/calculate-similarity.ts +++ b/src/lib/utils/calculate-similarity.ts @@ -1,4 +1,3 @@ -import AddressEntry from '@/interface/AddressEntry'; import * as stringSimilarity from 'string-similarity'; /** diff --git a/src/lib/utils/get-data-item-keys.ts b/src/lib/utils/get-data-item-keys.ts index c147c68..7022ff9 100644 --- a/src/lib/utils/get-data-item-keys.ts +++ b/src/lib/utils/get-data-item-keys.ts @@ -1,4 +1,3 @@ -import AddressEntry from '@/interface/AddressEntry'; import * as filter from 'array-filter'; /** diff --git a/src/store/actions.ts b/src/store/actions.ts index 6fbf2dc..98d47a2 100644 --- a/src/store/actions.ts +++ b/src/store/actions.ts @@ -1,4 +1,3 @@ -import AddressEntry from '@/interface/AddressEntry'; import { ActionContext, ActionTree } from 'vuex'; import { DATA_SOURCE } from './mutation-types'; import { State } from './state'; diff --git a/src/store/modules/input-module/actions.ts b/src/store/modules/input-module/actions.ts index d072a2f..9f7e553 100644 --- a/src/store/modules/input-module/actions.ts +++ b/src/store/modules/input-module/actions.ts @@ -1,6 +1,5 @@ import { ActionContext, ActionTree } from 'vuex'; -import AddressEntry from '@/interface/AddressEntry'; import { LIST, VALUE } from '@/store/mutation-types'; import { State as RootState } from '@/store/state'; import { InputState } from './state'; diff --git a/src/store/modules/input-module/getters.ts b/src/store/modules/input-module/getters.ts index 14e79d4..c83740c 100644 --- a/src/store/modules/input-module/getters.ts +++ b/src/store/modules/input-module/getters.ts @@ -1,6 +1,5 @@ import { GetterTree } from 'vuex'; -import AddressEntry from '@/interface/AddressEntry'; import { State as RootState } from '@/store/state'; import { InputState } from './state'; diff --git a/src/store/modules/input-module/mutations.ts b/src/store/modules/input-module/mutations.ts index 54de498..0ab601c 100644 --- a/src/store/modules/input-module/mutations.ts +++ b/src/store/modules/input-module/mutations.ts @@ -1,6 +1,5 @@ import { MutationTree } from 'vuex'; -import AddressEntry from '@/interface/AddressEntry'; import { LIST, VALUE } from '@/store/mutation-types'; import { InputState } from './state'; diff --git a/src/store/modules/input-module/state.ts b/src/store/modules/input-module/state.ts index e52d47c..24b6f9c 100644 --- a/src/store/modules/input-module/state.ts +++ b/src/store/modules/input-module/state.ts @@ -1,5 +1,3 @@ -import AddressEntry from '@/interface/AddressEntry'; - export class InputState { public value: string = ''; public autocompleteList: AddressEntry[] = []; diff --git a/src/store/mutations.ts b/src/store/mutations.ts index 878098d..51a861a 100644 --- a/src/store/mutations.ts +++ b/src/store/mutations.ts @@ -1,4 +1,3 @@ -import AddressEntry from '@/interface/AddressEntry'; import { MutationTree } from 'vuex'; import { DATA_SOURCE } from './mutation-types'; import { State } from './state'; diff --git a/src/store/state.ts b/src/store/state.ts index 1695b0e..bb50307 100644 --- a/src/store/state.ts +++ b/src/store/state.ts @@ -1,5 +1,3 @@ -import AddressEntry from '@/interface/AddressEntry'; - export class State { public dataSource: AddressEntry[] = null; } diff --git a/src/vue-shims.d.ts b/src/vue-shims.d.ts index e3c6c72..b3a21c6 100644 --- a/src/vue-shims.d.ts +++ b/src/vue-shims.d.ts @@ -2,6 +2,3 @@ declare module '*.vue' { import Vue from 'vue'; export default Vue; } -declare interface Window { - Vue: any -}