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.

Not able to generate Angular build due to ngx-translate errors

See original GitHub issue

I’m submitting a Bug report

Your Environment

Software Version(s)
Angular 8.3.22
Angular-Slickgrid ^2.17.10
TypeScript ~3.5.3

Describe the Bug

From recently we started receiving errors while generating the dist of the project and errors as follow


14     set translate(key: string);
           ~~~~~~~~~
../node_modules/@ngx-translate/core/lib/translate.directive.d.ts:15:9 - error TS1086: An accessor cannot be declared in an ambient context.

15     set translateParams(params: any);
           ~~~~~~~~~~~~~~~
../node_modules/@ngx-translate/core/lib/translate.service.d.ts:49:9 - error TS1086: An accessor cannot be declared in an ambient context.

49     get onTranslationChange(): EventEmitter<TranslationChangeEvent>;
           ~~~~~~~~~~~~~~~~~~~
../node_modules/@ngx-translate/core/lib/translate.service.d.ts:56:9 - error TS1086: An accessor cannot be declared in an ambient context.

56     get onLangChange(): EventEmitter<LangChangeEvent>;
           ~~~~~~~~~~~~
../node_modules/@ngx-translate/core/lib/translate.service.d.ts:63:9 - error TS1086: An accessor cannot be declared in an ambient context.

63     get onDefaultLangChange(): EventEmitter<DefaultLangChangeEvent>;
           ~~~~~~~~~~~~~~~~~~~
../node_modules/@ngx-translate/core/lib/translate.service.d.ts:67:9 - error TS1086: An accessor cannot be declared in an ambient context.

67     get defaultLang(): string;
           ~~~~~~~~~~~
../node_modules/@ngx-translate/core/lib/translate.service.d.ts:68:9 - error TS1086: An accessor cannot be declared in an ambient context.

68     set defaultLang(defaultLang: string);
   91m        ~~~~~~~~~~~
../node_modules/@ngx-translate/core/lib/translate.service.d.ts:72:9 - error TS1086: An accessor cannot be declared in an ambient context.

72     get currentLang(): string;
           ~~~~~~~~~~~
../node_modules/@ngx-translate/core/lib/translate.service.d.ts:73:9 - error TS1086: An accessor cannot be declared in an ambient context.

73     set currentLang(currentLang: string);
           ~~~~~~~~~~~
../node_modules/@ngx-translate/core/lib/translate.service.d.ts:77:9 - error TS1086: An accessor cannot be declared in an ambient context.

77     get langs(): string[];
           ~~~~~
../node_modules/@ngx-translate/core/lib/translate.service.d.ts:78:9 - error TS1086: An accessor cannot be declared in an ambient context.

78     set langs(langs: string[]);
           ~~~~~
../node_modules/@ngx-translate/core/lib/translate.service.d.ts:82:9 - error TS1086: An accessor cannot be declared in an ambient context.

82     get translations(): any;
           ~~~~~~~~~~~~
../node_modules/@ngx-translate/core/lib/translate.service.d.ts:83:9 - error TS1086: An accessor cannot be declared in an ambient context.

83     set translations(translations: any);
           ~~~~~~~~~~~~

Steps to Reproduce

npm install ng build --prod

Expected Behavior

Dist files should be generated successfully

Current Behavior

Possible Solution

Code Sample

My package.json

   "@angular/animations": "^8.2.14",
    "@angular/common": "^8.2.14",
    "@angular/compiler": "^8.2.14",
    "@angular/core": "^8.2.14",
    "@angular/forms": "^8.2.14",
    "@angular/platform-browser": "^8.2.14",
    "@angular/platform-browser-dynamic": "^8.2.14",
    "@angular/router": "^8.2.14",
    "@ckeditor/ckeditor5-build-inline": "^18.0.0",
    "@ng-bootstrap/ng-bootstrap": "^5.1.5",
    "@ng-select/ng-option-highlight": "0.0.4",
    "@ng-select/ng-select": "^3.7.1",
    "angular-slickgrid": "^2.17.10",
    "angular2-draggable": "^2.3.2",
    "bootstrap": "^4.4.1",
    "exceljs": "^1.12.0",
    "file-saver": "^2.0.2",
    "ionicons": "^4.6.3",
    "lodash": "^4.17.15",
    "moment": "^2.24.0",
    "moment-timezone": "^0.5.28",
    "ng5-slider": "^1.2.4",
    "ngx-cookie-service": "^2.3.0",
    "ngx-filesaver": "^8.1.0",
    "ngx-typeahead": "^6.2.0",
    "rxjs": "~6.4.0",
    "stream": "0.0.2",
    "timers": "^0.1.1",
    "tslib": "^1.10.0",
    "xml2js": "0.4.19",
    "zone.js": "~0.9.1"

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
mvgadagicommented, Sep 11, 2020
1reaction
mvgadagicommented, Sep 9, 2020

We could possible add a note to the README in the Compatibility list section. That would be really great if you could contribute to the lib by modifying the README with the steps you followed. Mind doing a quick PR? You could do it directly from GitHub website too… and/or update the HOWTO Steps by Steps - Wiki

Okay sure @ghiscoding I will do a PR to update the README

Read more comments on GitHub >

github_iconTop Results From Across the Web

ngx-translate not working on production after upgrade to ...
I recently upgraded to angular 11 and for some ...
Read more >
How to translate your Angular app with ngx-translate
1. Add ngx-translate to your Angular application 2. Set up the TranslateService in your app.module.ts 3. Create your main language translation file (in...
Read more >
Creating libraries - Angular
This page provides a conceptual overview of how to create and publish new libraries to extend Angular functionality. If you find that you...
Read more >
How To Use ngx-translate with Angular - DigitalOcean
Create a brand new Angular application and add some dependencies. Open your terminal and use @angular/cli to create a new project: ng new ......
Read more >
I am using @ngx-translate for translation but unable to get ...
This error is thrown because Angular doesn't know where to find the translate pipe. You need to import the TranslateModule in the page's ......
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