Open noisyscanner opened 2 years ago
Yep, same here.
+1
Is this issue resolved? We also experience the same?
Is it resolved. Can't use undefined or null for default
I found a solution, you have to cast your default to a type you want such as as string
and the Type instantiation is excessively deep and possibly infinite
error goes away. The reason this happens is that undefined | null point to the 'any' type. The recursive type defined that works to get the PathValue aka the type that get() returns can't find an end because of any. The type checker therefore thinks that you have an infinite recursion.
Problem
As per the FAQ, we can make things required by setting
default: null
, ifnull
is not a valid value.With TypeScript I get the error
Type instantiation is excessively deep and possibly infinite
when trying toconfig.get
any value, if somewhere in the schema there isdefault: null
.typescript 4.6.3 convict 6.2.1 @types/convict 6.1.1
(all versions latest at time of writing)
Repo here
https://github.com/noisyscanner/convict-issue Run
yarn build
to see the following