When data is passed as a variable, defining that data as type any should appease TypeScript, e.g.:
// Append a 'text' SVGElement with data-driven text() to each 'g' SVGElement
d3.selectAll('g')
.each(function(d: any) {
d3.select(this)
.append('text')
.text(d.mytext);
});