Kotlin JS doesn't add “new” keyword where needed

I am creating interactive infographics using Google Charts and Kotlin JS. This is snippet from Quick Start Page.

var data = new google.visualization.DataTable();
var chart = new google.visualization.PieChart(document.getElementById('chart_div'));

Here “new” keyword is used. I tried to rewrite this code using Kotlin.

val data = google.visualization.DataTable();
val chart = google.visualization.PieChart(document.getElementById('chart_div'));

But an error occurred saying that “new” keyword is missing in lines above. So Kotlin to JS compiler haven’t added the keyword where they should be.

Is there correct way to avoid the error without using js() function?

Thank you.

Maybe something wrong with your external declarations? With this one Kotlin generates correct code:

external object google {
	object visualization {
		class DataTable
1 Like