首页 > 解决方案 > Typescript 解析错误:导入 const 元组时出现意外的令牌类型

问题描述

我有 file1,其中有以下类型定义:

export const repeatIntervals = [
    'never',
    'day',
    'week',
    'two weeks',
    'month',
] as const

export type RepeatInterval = typeof repeatIntervals[number]

在 file2 中,我想导入repeatIntervals以便可以使用迭代元组。

但我在编译期间收到此错误Parsing error: Unexpected token type

标签: javascripttypescriptvue.jsionic-framework

解决方案


推荐阅读