简体   繁体   中英

Angular compilation error : TS2585 Build:'Promise' only refers to a type, but is being used as a value here. Do you need to change your target library

I'm working on an Angular project using Visual Studio 2022. When I included a fileUpload.ts file in the project, it started giving a compilation error in the project and it doesn't work anymore. I need help, the project no longer compiles.

Error: Error TS2585 Build:'Promise' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later.

error NG6001: The class 'FileUpload' is listed in the declarations of the NgModule 'AppModule', but is not a directive, a component, or a pipe. Either remove it from the NgModule's declarations, or add an appropriate Angular decorator.

I'm using Angular 14

When I remove the project file it works again.

This error occurs because when adding the file through Visual Studio it is marked to be compiled. To solve just put the biuld action as "None"

在此处输入图像描述

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