#ng2-chart error while complaining on angular 14.0.5

48 messages · Page 1 of 1 (latest)

pine owl
#

Hello im tryong to use ng2-chart with angular 14.0.5 but keeps getting this error:
Error: node_modules/ng2-charts/lib/base-chart.directive.d.ts:40:18 - error TS2707: Generic type 'ɵɵDirectiveDeclaration' requires between 6 and 8 type arguments.

40 static ɵdir: i0.ɵɵDirectiveDeclaration<BaseChartDirective<any, any, any>, "canvas[baseChart]", ["base-chart"], { "type": "type"; "legend": "legend"; "data": "data"; "options": "options"; "plugins": "plugins"; "labels": "labels"; "datasets": "datasets"; }, { "chartClick": "chartClick"; "chartHover": "chartHover"; }, never, never, false, never>;

Any idea how to fix it ?
Checked the repo of the lib for any open report and found 2 but i tried both ways that was said.

wraith magnet
#

g!codeblock @pine owl first what is the complete output of ng version. Copy and paste the text here in a code block as shown 👇

solar plazaBOT
#

@pine owl, you can use the following snippet to have your code formatted and colored by Discord. Replace ts with the language you need (i.e. html, js, css, etc)
```ts
// your code goes here
```

pine owl
#

/ \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|

/ △ \ | '_ \ / | | | | |/ _ | '__| | | | | | |
/ ___ | | | | (
| | || | | (| | | | || | | |
// __| ||_, |_,||_,|| _|||
|___/

Angular CLI: 14.0.5
Node: 16.13.2
Package Manager: npm 8.2.0
OS: win32 x64

Angular: 14.0.5
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.1402.10
@angular-devkit/build-angular 14.2.10
@angular-devkit/core 14.2.10
@angular-devkit/schematics 14.0.5
@angular/cdk 14.2.7
@angular/material 14.2.7
@schematics/angular 14.0.5
rxjs 6.6.7
typescript 4.7.4

#

4.0.0 was the one on the project , tried 3.1.2

knotty basalt
#

Sorry, I saw on GitHub downgrading the library's version doesn't help everyone.

pine owl
#

Yeah i checked there

#

Ig i will try with version 3.0.0-rc.7

knotty basalt
#

There is nothing much we can do if a bug is already declared on the project. You 'll have to wait for maintainers action or by trying to fix the bug on the library itself.

pine owl
#

Understand

#

I will another try with the other version i saw

#

If that doesnt help i will check what i can do to fix it

#

Thank you tho

wraith magnet
#

what is the output of npm list chart.js?

pine owl
pine owl
granite abyss
#

Remember to clean cache before rebuilding

wraith magnet
#

I have

├── chart.js@3.9.1
└─┬ ng2-charts@3.1.2
  └── chart.js@3.9.1 deduped

on Angular v13, installed brand new today with npm ci and it works...

#

I might have missed more context from other conversations elsewhere.

pine owl
knotty basalt
pine owl
pine owl
#

Since that version is 1 year old

#

Not sure it would be a good idea, idk

granite abyss
#

I find strnage it works exactly wuth such an old version.
I'd retry with stable 3.x and 4.0.x before submitting any comment.

wraith magnet
pine owl
#

So far tried with 4.0.2 , 4.0.0 , and 3.1.2 doesnt work for me

pine owl
#

4.0.x for angular 14 and 4.1.x for 15 from what i read

wraith magnet
#

My experience with using this software is not to expect patches to old versions 😦

granite abyss
#

I still blame cache.
I'd retry with 4.0.x on a clean environment.

wraith magnet
pine owl
pine owl
pine owl
pine owl
wraith magnet
#

did you do npm ci?

pine owl
#

No i retuned the old packed like it was

#

Didnt knew that command until now

wraith magnet
#

"clean install" will reinstall everything, exactly as specified in package-lock.json

pine owl
#

Understand trying now

#

Thank you for the tip tho

pine owl
granite abyss
#

4.1.0 is for ng15

pine owl
#

Will try with 4.0.2

#

Or 4.0.0 which ik support 14

pine owl