Allen Allen - 22 days ago 9
TypeScript Question

How to use strictNullChecks with libraries that are not nullCheck safe

I feel like I am missing something big here. I have read all the details of the new strictNullCheck goodness in typescript 2.0. I would love to use it but when I turn it on in my projects it finds issues with the supporting libraries I am using and their associated type definitions.

I can change my code to have sound type definitions but I don't have an easy way to update all the other libraries I use. Does this effectively mean that I can't use strictNullCheck until/unless the libraries I am using update to be strict null safe?

Answer

After looking around for quite a while I finally found that by using the compiler option skipDefaultLibCheck you can get most of what I needed here.