使用导出类型时出现“错误 TS1110:类型预期”

Cin*_*ris 4 gruntjs typescript

尝试用于grunt-typescript编译我的 TS 文件时,出现以下错误:

error TS1110: Type expected.
Run Code Online (Sandbox Code Playgroud)

在这三行中的每一行

export type AttributeWriteType = "Append" | "Replace" | "Static";
export type Action = "Create" | "Delete";
export type Status = "Created" | "Queued" | "Running" | "Completed" | "Expired";
Run Code Online (Sandbox Code Playgroud)

我对打字稿相当陌生,因此任何见解都将不胜感激。

Rya*_*ugh 5

这是由grunt-typescript过时版本的 TypeScript 编译器引起的。检查您的 package.json 以确保您使用的是当前版本的typescript包。


Cin*_*ris 3

它看起来grunt-typescript不再受支持,因此它使用的 TS 编译器已经过时。

我转而使用它grunt-ts,它按预期工作。