Google charts and typescript

280 views
Skip to first unread message

Nikos Katsikanis

unread,
Feb 21, 2023, 6:55:35 AM2/21/23
to Google Visualization API
I have this code, with type `/// <reference types="google.visualization" />`
but google is not recognised:

Screenshot 2023-02-21 at 11.55.21.png

Daniel LaLiberte

unread,
Feb 21, 2023, 11:23:39 AM2/21/23
to google-visua...@googlegroups.com
The loader has been updated for the 'upcoming' release of v52, but it should only have added access to the new version.   There have been other refactoring changes that conceivably could have affected the code, but I see how it could have lost the definition of the global 'google'.  Moreover, I am not sure I can easily revert this change of the loader, since I would have to return to the compilation environment from a couple years ago. 

The way you are loading the loader, using a constructed async script element appended to the body, is significantly different from the typical, more static loading via a script tag in the document head.  I'm wondering if you are using this pattern multiple times in the document, perhaps unintentionally.


--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/ee101963-b123-4cbc-90ca-a59039c3f5f3n%40googlegroups.com.


--

Daniel LaLiberte

 • SWE

 Cambridge MA

 • dlaliberte@Google.com

Nikos Katsikanis

unread,
Feb 21, 2023, 12:12:25 PM2/21/23
to Google Visualization API
Thanks for your quick response, we manage this loading, so it only happens once; as we have dynamic routes, we want to load it on only some pages.

Daniel LaLiberte

unread,
Feb 21, 2023, 12:46:56 PM2/21/23
to google-visua...@googlegroups.com
OK, I would like to find a workaround for you, while also figuring out what exactly is going wrong.  I'll need you to do some experimenting, or if you can give me a link to an example that shows the problem you are experiencing, especially a simplified example using jsfiddle or something similar, that would be great.

Is it possible to check whether the code does get executed, but only after your onload handler is called? 

Could you try using addEventListener rather than the onload mechanism?

Can you try adding a static loading of the loader, just to make sure that use case still works?


Reply all
Reply to author
Forward
Message has been deleted
0 new messages