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

前端 未结 5 733
长发绾君心
长发绾君心 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:07

    Playing with the tsconfig.json You can also targeting es5 like this :

    {
        "compilerOptions": {
            "experimentalDecorators": true,
            "module": "commonjs", 
            "target": "es5"
        }
        ...
    

提交回复
热议问题