使用strictNullChecks的Typescript中的Immutable.js

时间:2017-06-21 16:59:36

标签: typescript typescript-typings immutable.js

可能是一个新手问题。

我正在尝试使用带有编译标记immutable.js的Typescript的strictNullChecks

我有这个非常简单的场景:

const concepts: List<String> = List.of('test');
concepts.map( concept => concept.length );

在第二行,我得到Object is possibly undefined,并且我被告知concept类型为String | undefined。但为什么呢?

我甚至尝试过

List.of('test', undefined);

我收到错误,所以......为什么?!

0 个答案:

没有答案
相关问题