简体   繁体   English

如何创建没有默认类型的ImmutableJS记录?

[英]How to create an ImmutableJS Record without default types?

It appears that ImmutableJS Records need default values but I would prefer if they just threw runtime exceptions if fields are missing. 看来ImmutableJS Records需要默认值,但是如果缺少字段,它们只抛出运行时异常,我希望这样做。 Is there any way to do this? 有什么办法吗?

Looks like the answer is no. 看起来答案是否定的。 From the docs : 文档

Values provided to the constructor not found in the Record type will be ignored. 提供给构造函数的在Record类型中找不到的值将被忽略。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM