Transloco: Error with angular 8.2.14 when ng serve

Created on 14 Apr 2020  ·  10Comments  ·  Source: ngneat/transloco

I'm submitting a...


[X] Regression (a behavior that used to work and stopped working in a new release)

Current behavior

When I do ng serve i get this error:

ERROR in ../node_modules/@ngneat/transloco/lib/transloco.service.d.ts:33:9 - error TS1086: An accessor cannot be declared in an ambient context.

33 get config(): TranslocoConfig;

Expected behavior

No error, supporting angular 8 ? Typescript 3.5.3

Environment

"@angular/core": "~8.2.14",
"@ngneat/transloco": "^2.14.0",
"@ngneat/transloco-locale": "^1.1.1",
"@ngneat/transloco-persist-lang": "^1.0.2",
"@ngneat/transloco-persist-translations": "^1.0.0",
"typescript": "3.5.3"

Browser:

  • [X] Chrome (desktop) version XX

For Tooling issues:

  • Node version: 12.16.1
  • Platform: Linux

All 10 comments

I have a similar issue. What was the fix in your case?

fix the transloco versions without ^ ie:

"@ngneat/transloco": "2.14.0",
"@ngneat/transloco-locale": "1.1.1",
"@ngneat/transloco-persist-lang": "1.0.2",
"@ngneat/transloco-persist-translations": "1.0.0",

Thanks for sharing it. It looks like there's an issue with version 2.14.1 of transloco that forces the apps to upgrade the angular cli and typescript version latest version. From what I understand there is some breaking change in typescript that causes it.
Similar issues were described in storybook repo: https://github.com/storybookjs/storybook/issues/9463

@ciprian-iacob you are correct, I'm reverting back the TS version and I'll release it in v2.14.2.
Can you test after I release and LMK if it's ok?

@shaharkazaz Yes, sure.

@ciprian-iacob should be up, can you verify? 🙂

@shaharkazaz I can confirm that v2.14.2 is working fine in my testing and the issue describe above is no longer reproducible. Thank you for the fast response and quick fix. Keep up the good work.

Thx @shaharkazaz

Now with v2.14.2, angular 6 & 7 they both fail. I had to downgrade to v2.14.0

ngneat-transloco.js:816 Uncaught TypeError: Object(...) is not a function
at ngneat-transloco.js:816
at Module../node_modules/@ngneat/transloco/fesm5/ngneat-transloco.js (ngneat-transloco.js:828)
at __webpack_require__ (bootstrap:78)

TranslocoService.ɵprov = ɵɵdefineInjectable({ factory: function TranslocoService_Factory() { return new TranslocoService(ɵɵinject(TRANSLOCO_LOADER, 8), ɵɵinject(TRANSLOCO_TRANSPILER), ɵɵinject(TRANSLOCO_MISSING_HANDLER), ɵɵinject(TRANSLOCO_INTERCEPTOR), ɵɵinject(TRANSLOCO_CONFIG), ɵɵinject(TRANSLOCO_FALLBACK_STRATEGY)); }, token: TranslocoService, providedIn: "root" });

I think transloco needs a new major version or a README update with breaking changes

Hi @kabomi it seems like you are right. Apparently Angular's View Engine compiler in V9 does not support Angular versions lower than 8 even though they say it is.
We will update the BREAKING_CHANGES file to include that information.

Thanks for letting us know!

Was this page helpful?
0 / 5 - 0 ratings