Ediz Suleyman
Ediz Suleyman

Reputation: 44

Removing unused import throws error in Angular 14

I am having a very weird issue. On the top section of imports, I have 2 declared imports that are not being used. More precisely, I have imported them, but did not declared them in the "imports" section of "NgModule". Now the weird issue starts here, whenever I remove those grayed imports, my app throws error "Can't bind ... it isn't a known property" error. But if I leave them there, my apps run normally and no errors are thrown. I re-started the app many times, also, I thought it might be an cache issue so I tried to clean it, yet I have same issue over and over again. I couldn't find anything on the internet related to this. Anyone who has any idea about this? It doesn't make any sense because I am not declaring them in the "imports" section, why should have they affect on my app if I am removing unused import?

enter image description here


@TsvetanGanev check the contents of Settings below:

@NgModule({
declarations: [SettingsComponent],
imports: [
    RouterModule.forChild(settingsRoutes),
    CommonModule,
    MatButtonModule,
    MatFormFieldModule,
    MatIconModule,
    MatInputModule,
    MatRadioModule,
    MatSelectModule,
    CustomDrawerModule,
    MatCardModule,
    FuseDrawerModule,
    MatSidenavModule,
    MatSlideToggleModule,
    FuseAlertModule,
    SharedModule,
],
providers: [ChangeOfficeService],
exports: [SettingsComponent],
}) 

Upvotes: 1

Views: 488

Answers (0)

Related Questions