Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.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
Typescript 使用Immutable.Map时出错_Typescript_Angular5_Immutable.js - Fatal编程技术网

Typescript 使用Immutable.Map时出错

Typescript 使用Immutable.Map时出错,typescript,angular5,immutable.js,Typescript,Angular5,Immutable.js,获取错误 类型为“{name:string;插曲:number;}”的参数不能分配给类型为“Iterable”的参数 下面是一段代码 let movie = Immutable.Map<string, any>({ name: "Star Wars", episode: 8 }); let movie=Immutable.Map({ 名称:“星球大战”, 第8集 }); 我不知道为什么会出现上述错误以及如何修复它。[string,any]是一

获取错误

类型为“{name:string;插曲:number;}”的参数不能分配给类型为“Iterable”的参数

下面是一段代码

let movie = Immutable.Map<string, any>({
   name: "Star Wars",   
   episode: 8
});
let movie=Immutable.Map({
名称:“星球大战”,
第8集
});

我不知道为什么会出现上述错误以及如何修复它。

[string,any]是一个数组而不是一个对象。尝试:

let movie = Immutable.Map(["Star Wars", 7]); 

[string,any]是数组而不是对象。尝试:

let movie = Immutable.Map(["Star Wars", 7]); 

不工作。显示错误:类型为“(string | number)[]”的参数不能分配给类型为“{[key:string]:{};}的参数,让movie=Immutable.Map({[“星球大战]:{插曲:7}});不工作。显示错误:类型为“(string | number)[]”的参数不能分配给类型为“{[key:string]:{};}的参数,让movie=Immutable.Map({[“星球大战]:{插曲:7}});