![](/img/trans.png)
[英]error TS1110: Type expected in node_modules/@angular/core/core.d.ts
[英]“error TS1110: Type expected” when using export type
尝试使用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
包。
使用export type
时遇到类似的错误。 但是,我能够通过升级当前的typescript@^1.8.10来解决此类型错误,魔术错误消失了。
如果当前仍遇到此问题,那么当前正在运行什么tsc / typescript版本?
希望这会有所帮助!
似乎不再支持grunt-typescript
,因此它使用的TS编译器已过时。
我改用grunt-ts
,它按预期工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.