当我尝试联合元组时,数组有一些长度我得到了错误
看看这个工作示例,其中每种类型都有不同的长度。 Example。 (UPD:将流程版本更改为0.71)
但是当我尝试使用一些长度流添加类型无法解决它。 Example
type Step<T> = T | [T] | [T, Object];
type S3 = [Step<'Z'>]
type S4 = [Step<'X'>]
type S = S3 | S4
let a6: S = ['Z']
let a7: S = [['Z']]
错误:
11: let a7: S = [['Z']]
^ Could not decide which case to select. Since case 1 [1] may work but if it
doesn't case 2 [2] looks promising too. To fix add a type annotation to array literal [3].
References:
8: type S = S3 | S4
^ [1]
8: type S = S3 | S4
^ [2]
11: let a7: S = [['Z']]
^ [3]
我该如何解决这个问题?