array() 和 tuple() 仅定义可变数组,而非 ReadonlyArray

作者: jakubwolny创建于 2021年4月1日更新于 2025年1月17日
标签feature♥ help please

我想我有类似的问题 https://GitHub.com/ianstormtaylor/superstruct/issues/523 我想在对象内定义一个 ReadonlyArray<string> 属性,所以我做了如下操作: `tags: array(string())` 但是当我尝试在应用程序的其他地方使用该对象时,TS 会报错,因为 ReadonlyArray 是 Array 的子集(不实现变异方法)。

内容来源: ianstormtaylor/superstruct