My objective is a working Angular v10 project, using .flat()
on arrays. Our team recently upgraded our Angular project to version 10. The project now, based on the Angular CLI, has the following files in the root:
Everything works, but our IDE (vs code), gives us the warning:
Property 'flat' does not exist on type 'string[][]'.ts(2339)
According to this answer on SO, adding es2019
to the lib property should fix the issue. But I have added "es2019" to both tsconfig.base.json and tsconfig.json to no help.
Now open Visual Studio Code. Go to "File" > "Open Folder" and select "First-Angular-Project" from the "Desktop". Now in the "TERMINAL" run ng new Angular-Project-Demo. Whenever it prompts with something like "Would you like to add Angular routing? (y/N)" press "y" and hit "ENTER".
Create a new Angular application using ng new or open an existing one. Open the command prompt or terminal. Alternatively, if you have your Angular application open in an IDE such as Visual Studio Code, you can use the built-in terminal. The new component will get created in a new folder, inside the src/app directory.
TypeScript is a primary language for Angular application development. It is a superset of JavaScript with design-time support for type safety and tooling. Browsers can't execute TypeScript directly. Typescript must be "transpiled" into JavaScript using the tsc compiler, which requires some configuration.
In my case, I already had something in "lib" so I just changed the es from 2018 to 2019:
From:
"lib": ["es2018", "dom"]
To:
"lib": ["es2019", "dom"]
(And it took about 30-60 seconds before Code recognized the changes in my ts files)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With