Currently, I am facing an issue while attempting to utilize Google Charts in a project built with Angular CLI (version 7.2.3).
At first, I attempted to install the typings using the command below (both with and without the -dev flag):
npm install --save-dev @types/google.visualization
Subsequently, Visual Studio Code's intellisense immediately starts functioning, and there are no highlighted errors when executing a simple test like this:
const chartBoxStyle: google.visualization.ChartBoxStyle = {};
Unfortunately, upon building by running ng build, an error is thrown:
error TS2503: Cannot find namespace 'google'.
I attempted to rectify this by adding the following line to my file, but it did not resolve the issue:
declare const google: any;
In my tsconfig.json file, the typeRoots section is configured as shown below, with the google.visualization folder visible within:
"typeRoots": ["node_modules/@types"]
If anyone can offer assistance in overcoming this obstacle, it would be immensely appreciated as I currently don't have any further ideas on how to proceed.