vue icon indicating copy to clipboard operation
vue copied to clipboard

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

Open aKzenT opened this issue 1 year ago • 7 comments

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.

aKzenT avatar Aug 17 '22 10:08 aKzenT

I had the same problem.hope it can be fixed soon

chenjigeng avatar Aug 18 '22 14:08 chenjigeng

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 [email protected] :

  • ComponentPublicInstance https://github.com/vuejs/vue/commit/fffbb9e856de5e4b3053a6b4d01d1404bfb6f85e
  • ... extends never ? ... : ... https://github.com/vuejs/vue/commit/52a59790a5b6e16c9f8cc737fcd784413dda282d

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

(It might be related to https://github.com/microsoft/TypeScript/issues/34933)

vaidd4 avatar Aug 22 '22 08:08 vaidd4

I have the same problem with 2.7.10. Same as this one: https://github.com/vuejs/vue/issues/12683

fallemand avatar Oct 04 '22 07:10 fallemand

Created a repro here: https://github.com/AlbinoDrought/vue-12750-repro

Here's the failing npm run build job log: https://github.com/AlbinoDrought/vue-12750-repro/actions/runs/3268360727/jobs/5374676524

AlbinoDrought avatar Oct 17 '22 20:10 AlbinoDrought

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: https://github.com/vuejs/vue/compare/v2.7.5...v2.7.6

I think the key is the change to the Vue types here: https://github.com/vuejs/vue/compare/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

https://github.com/AlbinoDrought/vue-12750-repro/pull/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 ❤️

blimmer avatar Oct 17 '22 21:10 blimmer

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.

dasdingo avatar Oct 28 '22 19:10 dasdingo