You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As per the FAQ, we can make things required by setting default: null, if null is not a valid value.
With TypeScript I get the error Type instantiation is excessively deep and possibly infinite when trying to config.getany value, if somewhere in the schema there is default: null.
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 followingThe text was updated successfully, but these errors were encountered: