Typescript &引用;错误TS1110:应为“类型”;使用导出类型时
尝试使用Typescript &引用;错误TS1110:应为“类型”;使用导出类型时,typescript,gruntjs,Typescript,Gruntjs,尝试使用grunt typescript编译TS文件时,我遇到以下错误: error TS1110: Type expected. 在这三行中的每一行上 export type AttributeWriteType = "Append" | "Replace" | "Static"; export type Action = "Create" | "Delete"; export type Status = "Created" | "Queued" | "Running" | "Complet
grunt typescript
编译TS文件时,我遇到以下错误:
error TS1110: Type expected.
在这三行中的每一行上
export type AttributeWriteType = "Append" | "Replace" | "Static";
export type Action = "Create" | "Delete";
export type Status = "Created" | "Queued" | "Running" | "Completed" | "Expired";
我对Typescript相当陌生,因此任何见解都将不胜感激。这是由于
grunt Typescript
的Typescript编译器版本过时造成的。检查package.json以确保您使用的是当前版本的typescript
软件包。看起来不再支持grunt typescript
,因此它使用的TS编译器已过时
我改为使用
grunt ts
,它可以正常工作。我在使用导出类型时遇到了类似的错误。然而,我通过升级当前的typescript@^1.8.10解决了这个类型错误,错误神奇地消失了
如果您当前仍遇到此问题,您当前运行的tsc/typescript版本是什么
希望这能有所帮助 这些行在模块内吗?感谢您的回复,我可以通过切换到grunt ts
而不是grunt typescript
来修复它grunt ts
正在使用最新版本的typescript,因此修复了它。做了同样的事情,效果非常好!谢谢