swimlane / ngx-charts

:bar_chart: Declarative Charting Framework for Angular
https://swimlane.github.io/ngx-charts/
MIT License
4.3k stars 1.15k forks source link

Error while building project : An accessor cannot be declared in an ambient context #1416

Closed pranavghate30 closed 4 years ago

pranavghate30 commented 4 years ago

First of all Thank you for a great plugin, really appropriate it. I had an issue with 13.0.2 Version where I was getting Kind of undefined as an error while trying prod build. So I checked for it and found a new version released. I Updated the project and got a new error as below.

Error in Console ERROR in node_modules/@swimlane/ngx-charts/lib/bar-chart/bar.component.d.ts(39,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/common/legend/legend-entry.component.d.ts(11,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/common/tooltip/tooltip.component.d.ts(19,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/common/tooltip/tooltip.directive.d.ts(30,17): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/common/tooltip/tooltip.directive.d.ts(31,17): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/common/count/count.directive.d.ts(17,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/common/count/count.directive.d.ts(18,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/common/count/count.directive.d.ts(19,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/common/count/count.directive.d.ts(20,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/common/count/count.directive.d.ts(21,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/common/count/count.directive.d.ts(22,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/common/svg-radial-gradient.component.d.ts(9,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/common/svg-radial-gradient.component.d.ts(10,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/number-card/number-card.component.d.ts(21,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/pie-chart/pie-label.component.d.ts(19,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/pie-chart/pie-label.component.d.ts(20,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/pie-chart/pie-label.component.d.ts(21,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/pie-chart/pie-label.component.d.ts(22,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/pie-chart/pie-label.component.d.ts(23,9): error TS1086: An accessor cannot be declared in an ambient context.

Would really appreciate if I get solution on it 👍

ngx-charts version 13.0.3 ERROR IN BUILDING CHARTS

pabloppizarro commented 4 years ago

My team and I are having the same issue , waiting for any solution.

antleypk commented 4 years ago

my team and I are having same issue; Issue was created from following this tutorial:https://medium.com/@swathisprasad/building-data-visualization-with-angular-and-ngx-charts-375942d49fd6

vikre commented 4 years ago

12.1.0 Works fine with angular 8 if you guys are running 8 :) Had the same problem installing latest 13.0.3, but downgrading to 12.1.0 did the trick for now.

antleypk commented 4 years ago

i re-installed everything. I went down a rabbit hole; but got it to work in the end. htanks friend/

pranavghate30 commented 4 years ago

Can you guys help me get the Stable version for angular 7? as I am using 7 in my project.

vikre commented 4 years ago

@pranavghate30 Try specifying the version to be 11.2.0 - since in the changelog it says that >= 12 is angular 8, and >= 13 is angular 9.

Hypercubed commented 4 years ago

@pranavghate30 @pabloppizarro @antleypk I created a new angular cli app, installed ngx-charts, and setup a basic visualization as shown here: https://medium.com/@swathisprasad/building-data-visualization-with-angular-and-ngx-charts-375942d49fd6

I am no able to repo this issues. Does anyone have a broken example?

Hypercubed commented 4 years ago

Here is my demo created using the cli and following the medium post: https://github.com/Hypercubed/ngx-charts-demo

Hypercubed commented 4 years ago

I just republished 13.0.2 as 13.0.4. Please "upgrade" to 13.0.4 for angular versions <9. Otherwise please use 14.0.0.

pranavghate30 commented 4 years ago

Hi, Guys Sorry to reply late.

if I build the application using "ng build" It build the dist folder. but.

@vikre I tried with version 11.2.0 and then trying "ng build --prod" and still I get below error image

Here is my package.json image

@Hypercubed Even with Version 13.0.4 I get below error when I do ng build --prod image

I am sorry I am new to angular framework.

pranavghate30 commented 4 years ago

I tried Increasing the Heap Size by running below command node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build --prod and I got this error image

mariomurrent-softwaresolutions commented 4 years ago

Any updates on this? Not resolved for me until now

Pawansharma0044 commented 2 years ago

getting the same error while i try to implement I had an issue with npm i @swimlane/ngx-graph., where I was getting Kind of undefined as an error while trying prod build.

Error in Console ERROR in node_modules/@swimlane/ngx-charts/lib/bar-chart/bar.component.d.ts(39,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/common/legend/legend-entry.component.d.ts(11,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/common/tooltip/tooltip.component.d.ts(19,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/common/tooltip/tooltip.directive.d.ts(30,17): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/common/tooltip/tooltip.directive.d.ts(31,17): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/common/count/count.directive.d.ts(17,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/common/count/count.directive.d.ts(18,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/common/count/count.directive.d.ts(19,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/common/count/count.directive.d.ts(20,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/common/count/count.directive.d.ts(21,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/common/count/count.directive.d.ts(22,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/common/svg-radial-gradient.component.d.ts(9,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/common/svg-radial-gradient.component.d.ts(10,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/number-card/number-card.component.d.ts(21,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/pie-chart/pie-label.component.d.ts(19,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/pie-chart/pie-label.component.d.ts(20,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/pie-chart/pie-label.component.d.ts(21,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/pie-chart/pie-label.component.d.ts(22,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@swimlane/ngx-charts/lib/pie-chart/pie-label.component.d.ts(23,9): error TS1086: An accessor cannot be declared in an ambient context.

image

Pawansharma0044 commented 2 years ago

does anyone have solution, for above error

JStw commented 2 years ago

I fixed it by installed the @swimlane/ngx-graph version 7.2.0 and also adding the "skipLibCheck": true in my tsconfig.json in the compilerOptions.

I'm using this one in a standalone project so I don't care about skipping the lib check however I don't recommend this solution for a serious/professional project.

I'm working with Angular 8 on this project.