How do I find an array item with TypeScript? (a modern, easier way)

前端 未结 5 718
长发绾君心
长发绾君心 2020-11-28 09:49

Is there a canonical way to find an item in an array with TypeScript?

ES6+ allows this simple/clean approach

[{"id":1}, {"id":-2}         


        
5条回答
  •  春和景丽
    2020-11-28 10:01

    If you need some es6 improvements not supported by Typescript, you can target es6 in your tsconfig and use Babel to convert your files in es5.

提交回复
热议问题