Remove fields from typescript interface object

后端 未结 3 569
余生分开走
余生分开走 2020-12-11 05:11

I am getting a json response and storing it in mongodb, however the fields that I don\'t need are also getting in to the database, is there anyway to strip the uneseccary fi

3条回答
  •  情深已故
    2020-12-11 06:00

    Suppose you want to remove age

    temp = {...temp, age: undefined}
    

    This will remove age from your object for good.

提交回复
热议问题