Skip to content

Commit

Permalink
🤖 Merge PR #64311 [vuelidate] Fix max call stack size error in Vue 2.…
Browse files Browse the repository at this point in the history
…7.6-14 by @IGx89

* [vuelidate] Fix max call stack size error in Vue 2.7.6-14

* Make minimum TS version 4.4

* Add tests

* Tabs -> spaces in test file
  • Loading branch information
IGx89 committed Feb 13, 2023
1 parent 131014c commit b09276c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion types/vuelidate/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Orblazer <https://github.com/orblazer>
// Yuri Krylov <https://github.com/shadrus>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
// TypeScript Version: 4.4

import './vue'
import './lib/validators'
Expand Down
2 changes: 1 addition & 1 deletion types/vuelidate/vue.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Validation } from './vuelidate'

declare module 'vue/types/vue' {
type ValidationProperties<V> = {
[P in Exclude<keyof V, '$v'>]?: Validation & ValidationProperties<V[P]> & ValidationEvaluation
[P in Exclude<keyof V, '$v' | '$parent' | '$root' | '$children'>]?: Validation & ValidationProperties<V[P]> & ValidationEvaluation
}

interface ValidationGroups {
Expand Down
10 changes: 10 additions & 0 deletions types/vuelidate/vuelidate-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,16 @@ export class ValidComponent extends Vue {
return !this.$v.password.minLength
} else return false
}

verifyNoTypeRecursion() {
const parent = this.$v.$parent;
const root = this.$v.$root;
const children = this.$v.$children;

parent // $ExpectType Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, any>> | null
root // $ExpectType Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, any>>
children // $ExpectType Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, any>>[]
}
}

@Component({
Expand Down

0 comments on commit b09276c

Please sign in to comment.