【发布时间】:2017-01-29 13:10:15
【问题描述】:
考虑以下 Typescript 示例。第一行导致错误'type undefined[] is not assignable to type [string]'。最后两行编译。
let givesAnError: [string] = [];
let isOK: string[] = [];
let isAlsoOK: [string] = ["foo"];
你必须如何解释 Typescript 中的类型定义[string]?
【问题讨论】:
标签: typescript types