I have this code in JavaScript ES6:
data = [{name:'Peter'}];
const first_name = data.find(o => o.Name === 'name').Value;
I want to migrating to TS, in my tsconfig.json file I set:
"noImplicitAny": true,
and now I'm getting:
Parameter 'o' implicitly has an 'any' type
I tried:
const first_name = data.find(o:object => o.Name === 'name').Value;
but then I got:
Error: ',' expected.
It's my first day with TS, so, how can I use "Array.find" with TypeScript? Do I need to add a @type library?
const first_name = data.find(o:object => o.Name === 'name').Value;is wrong syntax, tryconst first_name = data.find((o:object) => o.Name === 'name').Value;with braces