pIvan / ngx-color-picker

Pure Angular color picker library.
MIT License
96 stars 16 forks source link

Type '{ color: { alias: "color"; required: false; }; control: { alias: "control"; required: false; }; }' does not satisfy the constraint '{ [key: string]: string; }' #75

Closed aleksander351 closed 1 year ago

aleksander351 commented 1 year ago

When installing the ngx-color-picker, version 16.1.0 we get multiple typing errors:

Error: node_modules/@iplab/ngx-color-picker/lib/components/chrome-picker/chrome-picker.component.d.ts:19:91 - error TS2344: Type '{ color: { alias: "color"; required: false; }; control: { alias: "control"; required: false; }; }' does not satisfy the constraint '{ [key: string]: string; }'. Property '"color"' is incompatible with index signature. Type '{ alias: "color"; required: false; }' is not assignable to type 'string'.

19 static ɵcmp: i0.ɵɵComponentDeclaration<ChromePickerComponent, "chrome-picker", never, { "color": { "alias": "color"; "required": false; }; "control": { "alias": "control"; "required": false; }; }, { "colorChange": "colorChange"; }, never, ["[before]", "*"], false, never>;


Error: node_modules/@iplab/ngx-color-picker/lib/components/compact-picker/compact-picker.component.d.ts:16:93 - error TS2344: Type '{ color: { alias: "color"; required: false; }; control: { alias: "control"; required: false; }; }' does not satisfy the constraint '{ [key: string]: string; }'.
  Property '"color"' is incompatible with index signature.
    Type '{ alias: "color"; required: false; }' is not assignable to type 'string'.

16     static ɵcmp: i0.ɵɵComponentDeclaration<CompactPickerComponent, "compact-picker", never, { "color": { "alias": "color"; "required": false; }; "control": { "alias": "control"; "required": false; }; }, { "colorChange": "colorChange"; }, never, ["[before]", "*"], false, never>;

Error: node_modules/@iplab/ngx-color-picker/lib/components/github-picker/github-picker.component.d.ts:21:91 - error TS2344: Type '{ color: { alias: "color"; required: false; }; control: { alias: "control"; required: false; }; columns: { alias: "columns"; required: false; }; }' does not satisfy the constraint '{ [key: string]: string; }'. Property '"color"' is incompatible with index signature. Type '{ alias: "color"; required: false; }' is not assignable to type 'string'.

21 static ɵcmp: i0.ɵɵComponentDeclaration<GithubPickerComponent, "github-picker", never, { "color": { "alias": "color"; "required": false; }; "control": { "alias": "control"; "required": false; }; "columns": { "alias": "columns"; "required": false; }; }, { "colorChange": "colorChange"; }, never, ["[before]", "*"], false, never>;



Error: node_modules/@iplab/ngx-color-picker/lib/components/ip-picker/ip-picker.component.d.ts:15:83 - error TS2344: Type '{ color: { alias: "color"; required: false; }; control: { alias: "control"; required: false; }; }' does not satisfy the constraint '{ [key: string]: string; }'.
  Property '"color"' is incompatible with index signature.
    Type '{ alias: "color"; required: false; }' is not assignable to type 'string'.

15     static ɵcmp: i0.ɵɵComponentDeclaration<IpPickerComponent, "ip-picker", never, { "color": { "alias": "color"; "required": false; }; "control": { "alias": "control"; "required": false; }; }, { "colorChange": "colorChange"; }, never, never, false, never>;

and many others.

I assume it has something to do with our typescript version:
"typescript": "4.8.4",
"@angular/core": "15.0.4",
aleksander351 commented 1 year ago

"skipLibCheck": true,

makes the errors go away but I don't think it's the soundest solution.

pIvan commented 1 year ago

Hi @aleksander351, could you please update TypeScript? Angular v16 requires TypeScript version 4.9 or later, and >= 5.0.0 would be ideal.

aleksander351 commented 1 year ago

Hi @pIvan we are currently not ready to update to Angular 16. We are still on version 15.

pIvan commented 1 year ago

No problem, but then ng-color-picker must also be of version >= 15.0.0, more precisely, 15.1.0.

pIvan commented 1 year ago

Update the package.json manually or use this command: npm install npm i @iplab/ngx-color-picker@15.1.0.

aleksander351 commented 1 year ago

Installing ngx-color-picker@15.1.0 worked for our Angular version. Thank you so much for your help! Hvala puno!

pIvan commented 1 year ago

Molim ;)