5

So this is the weirdest thing I've had happen as this project was working perfectly fine yesterday, in fact i even had 'ng serve' still running as i finished my work the day before and everything was fine.

Come today, with no changes, I can no longer compile the app due to typescript 3.7.2 features although i'm running on 3.7.3 globally and 3.8.3 locally with the angular project. I'm also getting a weird warning with async/await use in zone.js although i'm not using async await anywhere in my project yet -- haven't had an issue using async/await in past angular projects though.

The errors:

WARNING: Zone.js does not support native async/await in ES2017.

and

Module parse failed: Unexpected token (17:38)
>             const address = !!company?.address;
>             if (company?.address) {

and it goes on pointing similar stuff throughout the app. Now this app has been generated just weeks ago using angular cli 9 with my tsconfig untouched using:

        "module": "esnext",
        "moduleResolution": "node",
        "target": "esnext",
        "lib": ["es2018", "dom"]

I'm pretty sure this is not about anything i'm doing within the project itself but how the project gets compiled but sadly I have no idea where to look anymore or what I'm missing so any help/suggestions are really appreciated.

Edit:

Deleted local project, copied back from git, updated to angular 10 using TS 3.9.5 and same issues.

SebastianG
  • 8,563
  • 8
  • 47
  • 111
  • 2
    "exnext" contains features 'not' in ES. Features are here: https://github.com/Microsoft/TypeScript/tree/master/lib. I think that, for standard projects, you should use es20** module and target. i.e: target="es2015" and module="es2020" (default of angular10) – Sierrodc Jun 30 '20 at 11:42
  • @Sierrodc thanks -- this has indeed worked, it seems my tsconfig was just wrong, angular won't be able to compile without targeting es2015 and only es2015 -- If you post it as the answer happy to mark it as correct. – SebastianG Jul 06 '20 at 13:33

1 Answers1

0

"exnext" contains features 'not' in ES. Features are here: github.com/Microsoft/TypeScript/tree/master/lib. I think that, for standard projects, you should use es20** module and target. i.e: target="es2015" and module="es2020" (default of angular10)

Sierrodc
  • 845
  • 6
  • 18