question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Breaking changes appeared after upgrading typescript version from ~3.5.3 to ~3.7.5

See original GitHub issue

In commit https://github.com/sweetalert2/ngx-sweetalert2/commit/093a1f0595f2264f9625d7d9f8c94e22ea9062c0, you upgraded typescript version to support Angular 9. This is honorable 😃

Unfortunately, all applications pointing to previous version of angular (e.g… 8.2.14) and defining @sweetalert2/ngx-sweetalert2 with version ^7.3.0 will logically points to 7.4.0 version of @sweetalert2/ngx-sweetalert2 (because of ^) and triggers terrible compilation errors on ng build --prod :

ERROR in ../node_modules/@sweetalert2/ngx-sweetalert2/lib/sweetalert2-loader.service.d.ts:9:9 - error TS1086: An accessor cannot be declared in an ambient context.

9     get swal(): Promise<typeof SwalDefault>;
          ~~~~
../node_modules/@sweetalert2/ngx-sweetalert2/lib/swal.component.d.ts:101:9 - error TS1086: An accessor cannot be declared in an ambient context.

101     set swalOptions(options: SweetAlertOptions);
            ~~~~~~~~~~~
../node_modules/@sweetalert2/ngx-sweetalert2/lib/swal.component.d.ts:107:9 - error TS1086: An accessor cannot be declared in an ambient context.

107     get swalOptions(): SweetAlertOptions;
            ~~~~~~~~~~~
../node_modules/@sweetalert2/ngx-sweetalert2/lib/swal.component.d.ts:121:9 - error TS1086: An accessor cannot be declared in an ambient context.

121     set swalVisible(visible: boolean);
            ~~~~~~~~~~~
../node_modules/@sweetalert2/ngx-sweetalert2/lib/swal.component.d.ts:122:9 - error TS1086: An accessor cannot be declared in an ambient context.

122     get swalVisible(): boolean;
            ~~~~~~~~~~~
../node_modules/@sweetalert2/ngx-sweetalert2/lib/swal.directive.d.ts:27:9 - error TS1086: An accessor cannot be declared in an ambient context.

27     set swal(options: SwalComponent | SweetAlertOptions | SweetAlertArrayOptions);

I strongly recommend to you to advice users to reference ~7.3.0 instead of ^7.3.0 or consider to directly upgrade @sweetalert2/ngx-sweetalert2 to 8.0.0 to include angular 9 support 👍

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
toveruxcommented, Feb 17, 2020

Sorry, version 7.4.1 is also broken, but in another way. I’ve implemented .d.ts downlevelling and used package.json’s typesVersions (Angular 8 was using an alternative version of the .d.ts files, Angular 9 used the current ones), and it worked very well for Angular 8… except in AoT where it was failing in a strange way.

I have no other choice than to drop Angular 8 support from here and release a new major.

Angular 8 users should stay on ~7.3.0. All three versions in range ~7.4.0 are broken and should be avoided, and have been removed from GitHub and deprecated on npm.

3reactions
sandersncommented, Feb 18, 2020

@toverux I am the author of downlevel-dts and I am aware that it is not ready for wide use. What problems did you run into specifically? I’d like to see whether I can fix them.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - TypeScript 3.9
TypeScript 3.9 addresses this issue by changing the internals of how the compiler and language service caches file lookups.
Read more >
Documentation - TypeScript 4.5
TypeScript 4.5 Release Notes. ... When you upgrade TypeScript, you're also forced to handle changes to TypeScript's built-in declaration files, and this can ......
Read more >
Documentation - TypeScript 4.4
When we pass an object literal to something with an expected type, TypeScript will look for excess properties that weren't declared in the...
Read more >
Documentation - TypeScript 3.8
When using import type to import a class, you can't do things like extend from ... It's going to continue to be the...
Read more >
Documentation - TypeScript 4.7
TypeScript 4.7 Release Notes. ... This has been a very difficult feature, since the Node.js ecosystem is built on a different module system...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found