Skip to content

Commit 65535d9

Browse files
committed
chore: 📦 naming and typo fixed
1 parent 178060e commit 65535d9

File tree

5 files changed

+33
-28
lines changed

5 files changed

+33
-28
lines changed
File renamed without changes.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-api-queries",
3-
"version": "0.0.6",
3+
"version": "0.0.7",
44
"description": "Elegant and simple way to build requests for REST API",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/core/Validator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,6 @@ export interface ErrorOptions {
132132
[key: string]: any
133133
}
134134

135-
export { Validator as ValidatorType }
135+
export type { Validator as ValidatorType }
136136

137137
export default new Validator()

src/index.ts

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
import type { ValidatorType } from './core/Validator'
22
import Validator from './core/Validator'
3-
import type _Vue from 'vue'
3+
import _Vue from 'vue'
4+
5+
// augment typings of Vue.js
6+
import './vue'
47

58
export type Errors = ValidatorType
9+
export type { ValidatorType }
610

7-
class VueApiQuery {
8-
install(Vue: any) {
11+
class VueApiQueries {
12+
install(Vue: typeof _Vue) {
913
Vue.mixin({
1014
beforeCreate() {
11-
this.$options.$errors = {}
12-
Vue.util.defineReactive(this.$options, '$errors', Validator)
15+
this.$options['$errors'] = {}
16+
Vue.set(this.$options, '$errors', Validator)
1317
if (!this.$options.computed) {
1418
this.$options.computed = {}
1519
}
@@ -24,24 +28,4 @@ export { default as Validator } from './core/Validator'
2428
export { default as BaseProxy } from './core/BaseProxy'
2529
export { default as BaseTransformer } from './core/BaseTransformer'
2630
export { default as PaginationTransformer } from './core/PaginationTransformer'
27-
export default new VueApiQuery()
28-
29-
declare module '@nuxt/types' {
30-
interface Context {
31-
$errors: Errors
32-
}
33-
interface NuxtAppOptions {
34-
$errors: Errors
35-
}
36-
}
37-
declare module 'vue/types/vue' {
38-
interface Vue {
39-
$errors: Errors
40-
}
41-
}
42-
declare module 'vue/types/options' {
43-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
44-
interface ComponentOptions<V extends _Vue> {
45-
errors?: Errors
46-
}
47-
}
31+
export default new VueApiQueries()

src/vue.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import _Vue from 'vue'
2+
import type { ValidatorType } from './core/Validator'
3+
4+
declare module '@nuxt/types' {
5+
interface Context {
6+
$errors: ValidatorType
7+
}
8+
interface NuxtAppOptions {
9+
$errors: ValidatorType
10+
}
11+
}
12+
declare module 'vue/types/vue' {
13+
interface Vue {
14+
$errors: ValidatorType
15+
}
16+
}
17+
declare module 'vue/types/options' {
18+
interface ComponentOptions<V extends _Vue> {
19+
errors?: ValidatorType
20+
}
21+
}

0 commit comments

Comments
 (0)