首页 > 解决方案 > 如何创建任何不同泛型的数组?

问题描述

我想创建类型必须相同的数组和数组。例如。

// Implements the type
[['foo', 'bar'], [null, null], [1, 2]]

// Doesn't implement the type
[[1, 'foo'], [true, undefined]]

这怎么能在 TypeScript 中完成?

标签: arraystypescriptgenerics

解决方案


推荐阅读