Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RangeError: Maximum call stack size exceeded using vuelidate 0.7.x typings package #12750

Closed
aKzenT opened this issue Aug 17, 2022 · 8 comments
Closed

Comments

@aKzenT
Copy link

aKzenT commented Aug 17, 2022

Version

2.7.8

Reproduction link

github.com

Steps to reproduce

npm install

npm run eslint

What is expected?

eslint terminates normally

What is actually happening?

RangeError: Maximum call stack size exceeded occurs:

at getMappedType (C:\enbw\testeslint\node_modules\typescript\lib\typescript.js:63282:31)
at getMappedType (C:\enbw\testeslint\node_modules\typescript\lib\typescript.js:63299:30)
at C:\enbw\testeslint\node_modules\typescript\lib\typescript.js:63432:82
at Object.map (C:\enbw\testeslint\node_modules\typescript\lib\typescript.js:638:29)
at getObjectTypeInstantiation (C:\enbw\testeslint\node_modules\typescript\lib\typescript.js:63432:40)
at instantiateTypeWorker (C:\enbw\testeslint\node_modules\typescript\lib\typescript.js:63666:28)
at instantiateTypeWithAlias (C:\enbw\testeslint\node_modules\typescript\lib\typescript.js:63646:26)
at instantiateType (C:\enbw\testeslint\node_modules\typescript\lib\typescript.js:63629:37)
at instantiateList (C:\enbw\testeslint\node_modules\typescript\lib\typescript.js:63257:34)
at instantiateTypes (C:\enbw\testeslint\node_modules\typescript\lib\typescript.js:63271:20)

The repo works when downgrading to vue 2.7.5. Vue 2.7.6 to 2.7.8 show this problem. I suspect it's a vue issue related to the typing information as I found similar problems in bug tracker for the latest versions. Just uninstalling the vuelidate typings package solves the problem. So it might be some type of typing conflict with vuelidate.

@chenjigeng

This comment was marked as off-topic.

@vaidd4
Copy link

vaidd4 commented Aug 22, 2022

I have the same problem on a big project running Nuxt.js. Fixing vue version at v2.7.5 in package.json is the workarround.

Another issue produced by this problem is that the IDE (PyCharm here) using eslint flags every file in the code base with a typescript error Type instantiation is excessively deep and possibly infinite.

I suspect eslint (v7.32.0) to not like one of the 2 type modifications in vue@2.7.6 :

  • ComponentPublicInstance fffbb9e
  • ... extends never ? ... : ... 52a5979

Will try to upgrade to v8+ but I have other compatibility issues to resolve first.

(It might be related to microsoft/TypeScript#34933)

@fallemand
Copy link

I have the same problem with 2.7.10.
Same as this one: #12683

@AlbinoDrought
Copy link

@blimmer
Copy link

blimmer commented Oct 17, 2022

I've got a workaround for this issue that should unblock folks.

I took a look at the diff between 2.7.5 and 2.7.6, where this broke: v2.7.5...v2.7.6

I think the key is the change to the Vue types here: v2.7.5...v2.7.6#diff-502307d78edff0c6640563ac0f7dcc5c0ec02ee71b8da96c8d54d5c0ab3373ff

Screen Shot 2022-10-17 at 14 57 36

By applying this patch (e.g., via patch-package or yarn's native patching), I was able to get past the error:

diff --git a/node_modules/@types/vuelidate/vue.d.ts b/node_modules/@types/vuelidate/vue.d.ts
index 64e61c2..0fdeebc 100755
--- a/node_modules/@types/vuelidate/vue.d.ts
+++ b/node_modules/@types/vuelidate/vue.d.ts
@@ -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 {

I used @AlbinoDrought's example repo to prove that this now builds: https://github.com/blimmer/vue-12750-repro/actions/runs/3268574902/jobs/5375141277

AlbinoDrought/vue-12750-repro#1

I haven't spent too much time figuring out exactly why this works, but it kind of makes sense since $parent, $root, and $children all reference Vue in their types.

I don't currently have the bandwidth to open a PR to fix this in DefinitelyTyped, but if someone has time, that would be awesome! I hope this helps others get unstuck in the meantime ❤️

@dasdingo
Copy link

I've got a workaround for this issue that should unblock folks.

I took a look at the diff between 2.7.5 and 2.7.6, where this broke: v2.7.5...v2.7.6

I think the key is the change to the Vue types here: v2.7.5...v2.7.6#diff-502307d78edff0c6640563ac0f7dcc5c0ec02ee71b8da96c8d54d5c0ab3373ff

Screen Shot 2022-10-17 at 14 57 36

By applying this patch (e.g., via patch-package or yarn's native patching), I was able to get past the error:

diff --git a/node_modules/@types/vuelidate/vue.d.ts b/node_modules/@types/vuelidate/vue.d.ts
index 64e61c2..0fdeebc 100755
--- a/node_modules/@types/vuelidate/vue.d.ts
+++ b/node_modules/@types/vuelidate/vue.d.ts
@@ -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 {

I used @AlbinoDrought's example repo to prove that this now builds: https://github.com/blimmer/vue-12750-repro/actions/runs/3268574902/jobs/5375141277

AlbinoDrought/vue-12750-repro#1

I haven't spent too much time figuring out exactly why this works, but it kind of makes sense since $parent, $root, and $children all reference Vue in their types.

I don't currently have the bandwidth to open a PR to fix this in DefinitelyTyped, but if someone has time, that would be awesome! I hope this helps others get unstuck in the meantime ❤️

I nearly wanted to quit my job as a software developer because I couldn't make the vue version upgrade 2.6.x -> 2.7.13 work until I found your comment, which solved the issue for me. You are my hero! Before I have seen your fix I tried several things like increasing the maximum depths for typescript "instantiateTypes" and adding some logging, but this didn't help at all to find a fix.

@TimWiffenAsura
Copy link

I've seen a different solution suggested here and have referred to this solution as an alternative.

I'm not sure which is the better solution, so I'd be grateful for some input as I'm experiencing this issue and would like to see a permanent solution.

@yyx990803
Copy link
Member

closing as this has been fixed in vuelidate types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants