【发布时间】:2022-07-01 21:43:17
【问题描述】:
我正在导入这个数组:
const quotes = [
{ quote: "Design is intelligence made visible.", name: "Alina Wheeler" },
{
quote:
"The public is more familiar with bad design than good design. It is, in effect, conditioned to prefer bad design, because that is what it lives with. The new becomes threatening, the old reassuring.",
name: "Paul Rand",
},
{
quote: "Every great design begins with an even better story.",
name: "Lorinda Mamo",
}
];
进入另一个 .tsx 文件并以这种方式使用它:
import * as quotes from "./quotes/quotes";
const quoteLength = quotes.length - 1;
但我收到此错误:“typeof import”类型上不存在属性“length”
知道如何解决这个问题吗?如何将该对象数组声明为类型?
【问题讨论】:
标签: reactjs typescript