plotly / angular-plotly.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error with latest version

saitejayala opened this issue · comments

I have updated plotly version today to latest
In my package.json file i have
"angular-plotly.js": "^1.6.0",
"plotly.js": "^1.52.2"

From then it is giving me error on ng build
below is the error:

**ERROR in node_modules/angular-plotly.js/src/app/plotly-via-cdn/plotly-via-cdn.module.d.ts:9:16 - error TS1086: An accessor cannot be declared in an ambient context.

9 static set plotlyVersion(version: string);
~~~~~~~~~~~~~
node_modules/angular-plotly.js/src/app/plotly-via-cdn/plotly-via-cdn.module.d.ts:10:16 - error TS1086: An accessor cannot be declared in an ambient context.

10 static set plotlyBundle(bundle: PlotlyBundleName);
~~~~~~~~~~~~
node_modules/angular-plotly.js/src/app/shared/plotly.service.d.ts:11:9 - error TS1086: An accessor cannot be declared in an ambient context.

11 get debug(): boolean;**

Any idea why this is giving me error

Same here with angular 8.2 & typescript 3.5.3
It works with typescript 3.6 but that is not allowed with angular 8
https://devblogs.microsoft.com/typescript/announcing-typescript-3-6/#get-and-set-accessors-allowed-in-ambient-contexts

@nicodh @saitejayala as a quickfix, try downgrading angular-plotly.js to version 1.5.0. This is the last version with angular 8.
In parallel, I will investigate why these errors might be happening

@andrefarzat since we need the treemap/sunburst click event, and facing this issue., the downgrade wont work

I have the same issue. It seems this library is now compiled using NG9? Is that correct? because that will break support with version 8 Angular apps. If this is the case, this really should have been a major release right?

@MikeOne looks like you're right. From 7 to 8 wasn't the same issue, but to 9 is having these small (but several) issues which I can't replicate in my tests. Will downgrade to angular 8.x and release a 2.x version to suporte angular 9.x

@saitejayala @MikeOne @tanvi-cota ok guys, I deprecated versions 1.6.0, 1.6.1, and 1.7.0, downgraded the angular to 8 and published the version 1.8.0. Also, I generated the version 2.0.0 with support to angular 9. Please, test now and let me know if it works correctly now 😸

Great. I’ll test it asap. For clarification- you really don’t ‘need’ a ng9 version short term. The Angular ngcc compiler will take care of enabling version 8 libraries to work with Ivy for you.

@andrefarzat this seems to work now, thanks for the quick fix!

Closing this issue. Please, feel free to reopen if it persists 😸

So, as of today should it give any errors while compiling? Because I am getting:
ERROR in node_modules/angular-plotly.js/src/app/plotly-via-cdn/plotly-via-cdn.module.d.ts(9,16): error TS1086: An accessor cannot be declared in an ambient context. node_modules/angular-plotly.js/src/app/plotly-via-cdn/plotly-via-cdn.module.d.ts(10,16): error TS1086: An accessor cannot be declared in an ambient context. node_modules/angular-plotly.js/src/app/shared/plotly.service.d.ts(11,9): error TS1086: An accessor cannot be declared in an ambient context.

What is a way to making it work in Angular 9?

Thanks

@markzolotoy the correct version to work with angular 9 is 2.x.x. Which version are you using when this error occurs ?

`Angular CLI: 7.3.10
Node: 10.15.1
OS: win32 x64
Angular: 7.2.16
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package Version

@angular-devkit/architect 0.13.10
@angular-devkit/build-angular 0.13.10
@angular-devkit/build-optimizer 0.13.10
@angular-devkit/build-webpack 0.13.10
@angular-devkit/core 7.3.10
@angular-devkit/schematics 7.3.10
@angular/cli 7.3.10
@ngtools/webpack 7.3.10
@schematics/angular 7.3.10
@schematics/update 0.13.10
rxjs 6.6.2
typescript 3.6.5
webpack 4.29.0`

And in angular.json I have this:
scripts": ["node_modules/plotly.js/dist/plotly.min.js"],

@markzolotoy looks like you're using version 7.2.16. You can update the angular to 8.x and use angular-plotly.js version 1.8.0 or you can use angular 7.x with angular-plotly.js version 1.3.2 (see #79 (comment) )