Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带有strictNullChecks的Typescript中的Immutable.js_Typescript_Typescript Typings_Immutable.js - Fatal编程技术网

带有strictNullChecks的Typescript中的Immutable.js

带有strictNullChecks的Typescript中的Immutable.js,typescript,typescript-typings,immutable.js,Typescript,Typescript Typings,Immutable.js,可能是个新手问题 我正在尝试将immutable.js与启用编译标志strictNullChecks的Typescript一起使用 我有一个非常简单的场景: 常量概念:List=List.of('test'); concepts.map(concept=>concept.length); 在第二行,我得到的对象可能未定义,我被告知概念类型为String |未定义。但是为什么呢 我甚至试过 List.of('test', undefined); 我犯了个错误,所以。。。为什么 你能用(概念:s

可能是个新手问题

我正在尝试将
immutable.js
与启用编译标志
strictNullChecks
的Typescript一起使用

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

常量概念:List=List.of('test'); concepts.map(concept=>concept.length); 在第二行,我得到的
对象可能未定义
,我被告知
概念
类型为
String |未定义
。但是为什么呢

我甚至试过

List.of('test', undefined);

我犯了个错误,所以。。。为什么

你能用
(概念:string)=>
试试这个吗?TS在这里显然是错误的,因此,如果它在夜间仍然失败,这将值得向TS提交错误报告。如果其他人已经这样做了,您可能也想在那里搜索此错误。您可以尝试使用
(概念:string)=>
?TS在这里显然是错误的,因此,如果它在夜间仍然失败,这将值得向TS提交错误报告。您可能也想在那里搜索此错误,以防其他人已经这样做了。