如何对非 nullCheck 安全的库使用 strictNullChecks [英] How to use strictNullChecks with libraries that are not nullCheck safe
问题描述
我觉得我在这里错过了一些重要的东西.我已阅读 打字稿 2.0.我很想使用它,但是当我在我的项目中打开它时,它会发现我正在使用的支持库及其相关类型定义存在问题.
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.
我可以将代码更改为具有声音类型定义,但我没有一种简单的方法来更新我使用的所有其他库.这是否实际上意味着我不能使用 strictNullCheck 直到/除非我使用的库更新为严格空安全?
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?
推荐答案
找了半天我终于发现,通过使用编译器选项 skipDefaultLibCheck
你可以在这里得到大部分我需要的东西.
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.
这篇关于如何对非 nullCheck 安全的库使用 strictNullChecks的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!