Using the code from the given example results in "Type instantiation is excessively deep and possibly infinite" error
jainil opened this issue · 3 comments
I created a starter typescript project and added the example file from the readme to test this out. However I am getting the following error for UserSchema:
Type instantiation is excessively deep and possibly infinite. ts(2589)
Is this an issue with the lib or my config?
My tsconfig:
{
"compilerOptions": {
"outDir": "dist",
"baseUrl": ".",
"declaration": true,
"module": "commonjs",
"target": "es6",
"noEmitOnError": true,
"sourceMap": true,
"moduleResolution": "node",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true
},
"include": [
"src"
],
"exclude": [
"node_modules",
"dist"
]
}
Found a corresponding report on mongoose repo regarding this issue: Automattic/mongoose#11787
For now fixing mongoose version to 6.3.1 solves the problem for me.
Closing since this is an upstream issue.
Thanks @jainil. Ill keep an eye on the upstream issue and make any required updates if needed.
@jainil Note that this issue has been resolved in newer Mongoose versions, so if you want to upgrade your Mongoose version you can do so (must be 6.4.1 or higher)