I am not sure how you are supposed to nest functions in TypeScript. I was doing it similar to Javascript and got a lot of errors.
I have this in my typescript file (this is basically the only thing there):
ngAfterViewInit(): void {
d3.csv('data/data.csv').then((data: Array<String> => {
data.forEach(d:string =>{
d.age = Number(d.age)
})
})
}
And my data.csv file has this:
name,age
Lam,30
Peter,90
Aaron,2
Swizt,14
Irene,36
Travis, 55
I get errors such as
"Argument of type '(data: String[], { data, forEach }: any) => any' is not assignable to parameter of type '(value: DSVRowArray<string>) => any'.ts(2345)"
, and
"A parameter initializer is only allowed in a function or constructor implementation.ts(2371)"