简体   繁体   中英

“error TS1110: Type expected” when using export type

When trying to use grunt-typescript to compile my TS files, I'm getting the following error:

error TS1110: Type expected.

on each of these three lines

export type AttributeWriteType = "Append" | "Replace" | "Static";
export type Action = "Create" | "Delete";
export type Status = "Created" | "Queued" | "Running" | "Completed" | "Expired";

I'm fairly new to Typescript, so any insight would be greatly appreciated.

This is caused by grunt-typescript having an out-of-date version of the TypeScript compiler. Check your package.json to ensure you're using a current version of the typescript package.

I was encountering a similar error while was using export type . However, I was able to resolve this type error by upgrading my current typescript@^1.8.10, magically error disappeared.

If you are still currently running into this issue, what tsc/typescript version are you currently running?

Hopefully this can be helpful!

It looks like grunt-typescript isn't being supported anymore, so the TS compiler it uses is out of date.

I switched to using grunt-ts instead, and it is working as intended.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM