Es6 object assignment error

const reserved = item => {
      let res = { label: item.action_name, value: item.action_id, checked: false };
      if (item.son && item.son.length > 0) {
        res.son = item.son.map(s => reserved(s));
      }
      return res;
    };

    const result = this.moduleData.showModule.reduce((res, item) => {
      res.push(reserved(item));
      return res;
    }, []);

clipboard.png

what should I do

Es6
Dec.20,2021

this tells you how to change it. This is a type detection error belonging to typescript.
Type supplement
adding a type any to each value is the most rude way
here you need Interfaces object type interface to define the search keyword


ts syntax does not allow you to add new attributes to the object casually, you need to define it in interface.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ec8351-2eb2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ec8351-2eb2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?