I want to use Google Charts with TypeScript, but I'm not sure if Google Charts has .d.ts file(s). Does anyone know if they're out there available for download and if yes, can you link them?
Does Google Charts have TypeScript definition file(s)?
Asked Answered
Might be of interest: github.com/DefinitelyTyped/DefinitelyTyped/issues/15835 –
Tsingyuan
thanks but that's for angular google chart and I'm not using Angular I'm using React –
Tripinnate
I believe the project is merely an angular wrapper, but there is a typings file in that repository: github.com/angular-google-chart/google-chart-typings/blob/… - it doesn't seem to be related to angular in particular. –
Tsingyuan
oh, that's awesome, thanks....have you used it personally? do you have an idea of how complete it is? –
Tripinnate
Sorry, no - I haven't actually used it; though it's the only result I could find. Might be worth while contacting the author and asking how complete it is, and seeing if it's possible to have it pulled into the DefinitelyTyped repository for others –
Tsingyuan
The repository description says "very incomplete and work in progress"...perhaps I should look into other charting libraries –
Tripinnate
It does (at least nowadays), called google.visualization
:
npm install @types/google.visualization
still up to date? –
Lager
I added that and still get [lint] [tsc] src/pages/charts.tsx:23:18 - error TS2304: Cannot find name 'google'. –
Lager
you need to add "google.visualization" to tsconfig.app.json compilerOptions -> types array –
Sideman
@Sideman I tried with this but it still gives me this error:
.../@types/google.visualization/index.d.ts' is not a module.
–
Pricilla You can see them on github: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/google.visualization
You can download index.d.ts file
how to add this to file so that google var is recognised? google.charts.load('current', { packages: ['corechart', 'bar'] }); –
Lager
install @types/google.visualization and add "google.visualization" to tsconfig.app.json compilerOptions -> types array –
Sideman
© 2022 - 2024 — McMap. All rights reserved.