Home > Enterprise >  Angular compilation error : TS2585 Build:'Promise' only refers to a type, but is being use
Angular compilation error : TS2585 Build:'Promise' only refers to a type, but is being use

Time:01-10

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.

CodePudding user response:

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"

enter image description here

  • Related