Skip to content

Commit

Permalink
fix(types): incorrect type setting fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
iliyaZelenko committed Sep 18, 2019
1 parent 678ad88 commit e13ba79
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 30 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/types/
3 changes: 0 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// import '~/styles/main.styl'
// import '~/styles/themes/bootstrap.styl'
// import '~/styles/themes/material-design.styl'
import component from '~/component.vue'
import EventEmitter from '~/eventEmitter'
import mergeDeep from '~/helpers'
Expand Down
1 change: 0 additions & 1 deletion tests/unit/eventsListeners.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ describe('eventsListeners', () => {
).toBe(selectItem)
})


it('checks onClick with disabled', async () => {
const wrapperWithDisabled = mount<VueCoolSelectComponentInterface>(comp, {
propsData: {
Expand Down
11 changes: 11 additions & 0 deletions types/types-libraries.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Vue from 'vue'
import { CoolSelectUseOptionsInterface } from './types'

declare module 'vue/types/vue' {

interface Vue {
$coolSelect: {
options: CoolSelectUseOptionsInterface
}
}
}
38 changes: 19 additions & 19 deletions types/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
// 1. Make sure to import 'vue' before declaring augmented types
import Vue from 'vue'
import { Wrapper } from '@vue/test-utils'
import Vue, { Component, PluginFunction } from 'vue'

// TODO чтобы у Component была связь с VueCoolSelectComponentInterface
export const component: Component
export const CoolSelect: Component
export const VueCoolSelect: Component
export const CoolSelectPlugin: PluginFunction<CoolSelectUseOptionsInterface>
export const EventEmitter: {
on: (event, listener) => any
onOnce: (event, listener) => any
emit: (event, data) => any
}

export interface CoolSelectUseOptionsInterface {
text: {
noData: string
}
}

export interface VueCoolSelectComponentInterface extends Vue {
/* Data */
[key: string]: any
wishShowMenu: boolean
arrowsIndex: number | null
focused: boolean
Expand Down Expand Up @@ -34,18 +49,3 @@ export interface VueCoolSelectComponentInterface extends Vue {

setBlured ()
}

declare module '@vue/test-utils' {
interface Wrapper {
readonly vm: any
}
}

// 2. Specify a file with the types you want to augment
// Vue has the constructor type in types/vue.d.ts
declare module 'vue/types/vue' {
// 3. Declare augmentation for Vue
interface Vue {

}
}
8 changes: 1 addition & 7 deletions types/vue-shim.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
declare module '*.vue' {
import Vue from 'vue'
const _default: Vue
export default _default
export default Vue
}

// declare module '*.vue' {
// import Vue from 'vue'
// export default Vue
// }

0 comments on commit e13ba79

Please sign in to comment.