Question: is strictNullChecks
required to use ts-json-validator?
#34
Labels
question
Further information is requested
strictNullChecks
required to use ts-json-validator?
#34
Thank you for this project - I really like the approach.
I found that I could not get a fairly trivial example to compile in my project:
The use of
v
inv.payload
produces the error:TS2532: Object is possibly 'undefined'.
. If I checkv !== undefined
to narrow the type ofv
thenpayload
is inferred asnever
.After embedding this example in your tests (where it does work). It seems like the important piece of difference is that you have
strictNullChecks
enabled viastrict
intsconfig.json
.I assume that your type magic must rely on inference that needs there to not be implicit void types. I just wanted to check I am not missing something and this is in fact required since I did not see it mentioned anywhere. Is there a way round this? Perhaps I am mistaken to isolate it the issue to
strictNullChecks
(I can do a more careful isolation if needed).As a side-note I would like to enable
strict
mode in all my projects, but I want to use this library in a large system of projects that I am incrementally typing so it's not something I can easily turn on without refactoring large amounts of code.The text was updated successfully, but these errors were encountered: