var user = {};
Run Code Online (Sandbox Code Playgroud)
现在我想创建一个setUsers()接受键/值对对象并初始化user变量的方法.
setUsers = function(data) {
// loop and init user
}
Run Code Online (Sandbox Code Playgroud)
数据如下:
234: "john", 23421: "smith", ....
Run Code Online (Sandbox Code Playgroud) Trying out TypeScript for a React project and I'm stuck on this error:
Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ train_1: boolean; train_2: boolean; train_3: boolean; train_4: boolean; }'.
No index signature with a parameter of type 'string' was found on type '{ train_1: boolean; train_2: boolean; train_3: boolean; train_4: boolean; }'
Run Code Online (Sandbox Code Playgroud)
Which appears when I try to filter the array in my component
.filter(({ name }) => plotOptions[name]); …Run Code Online (Sandbox Code Playgroud)