javascript - 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
解决方案
推荐阅读
- javascript - JavaScript 24 时间自动计算 Adobe Form Field 的工时?
- proof - 证明自然 (n) 为零
- ios - 如何从视图控制器中删除导航栏
- python - 如何打印仅包含字符串中字母的单词?
- machine-learning - 在线广告和机器学习
- angular - 为什么我无法获取项目总数并将其绑定到 ngModel?
- asp.net-core - IdentityServer4 从 appsettings.json 读取客户端声明
- axapta - 有什么简单的方法可以检查已发布服务的使用情况吗?
- ios - 在设置包中的设置更改时收到通知(在 Xamarin iOS 中)
- android - 如何使用 kotlin android 扩展从 radiogroup 中检索单选按钮