zefoy / ngx-color-picker

Color picker widget for the Angular (version 2 and newer)
MIT License
449 stars 142 forks source link

Property '"colorPicker"' is incompatible with index signature , Type '{ alias: "colorPicker"; required: false; }' is not assignable to type 'string'. #341

Open mohitv789 opened 11 months ago

mohitv789 commented 11 months ago

First Error --> ngx-color-picker/lib/color-picker.directive.d.ts:108:103 : Property '"colorPicker"' is incompatible with index signature , Type '{ alias: "colorPicker"; required: false; }' is not assignable to type 'string'.

Subsequent Errors --> a) Error: node_modules/ngx-color-picker/lib/helpers.d.ts:22:76 : Property '"rg"' is incompatible with index signature.Type '{ alias: "rg"; required: false; }' is not assignable to type 'string'. b) node_modules/ngx-color-picker/lib/helpers.d.ts:44:80 : Property '"rgX"' is incompatible with index signature. Type '{ alias: "rgX"; required: false; }' is not assignable to type 'string'.

Now whenever I try to use properties of color-picker in HTML elements ( tried with input / span / button ) everytime I am getting error as : Can't bind to 'cpDisableInput' since it isn't a known property of 'input'

My Project Setup : Backend is Djangorestframework served through nginx proxy Frontend is Angular (15) in which I am using ngx-color-picker in a component . I am making a shared module as below , importing and exporting in component module and importing shared module in app module.

Share.Module.Ts :

import { CommonModule } from '@angular/common';
import { ModuleWithProviders, NgModule } from '@angular/core';
import { ColorPickerModule } from 'ngx-color-picker';

@NgModule({
  imports: [
    CommonModule,
    ColorPickerModule
  ],
  exports: [
    CommonModule,
    ColorPickerModule
  ],
  declarations: [],
  providers: []
})
export class SharedModule {

  static forRoot(): ModuleWithProviders<SharedModule> {
    return {
      ngModule: SharedModule
    };
  }
}

Am I doing it correctly?

mohitv789 commented 11 months ago

Any suggestions , anyone ?

chaudhry13 commented 10 months ago

I am also getting the same error. any help here?

juancarlos-eco commented 10 months ago

Has someone found a solution or workaround?

rahulknagori commented 10 months ago

Downgrade to v14.0.0. Everything must work smoothly. Run this command - npm install ngx-color-picker@14.0.0

loicgreffier commented 9 months ago

Faced the same issue trying to run v16.0.0 with Angular v15. Downgrading to ngx-color-picker to v14.0.0 solved the issue.

The issue does not occur when running ngx-color-picker v16.0.0 and Angular v16.