I have object and there are some elements i don't want them (ex: 'id'), there is any way to exclude this elements from object in type script.
Asked
Active
Viewed 116 times
-1
-
I need in type script – Mohamad Alhamid Jul 22 '19 at 23:53
-
1A valid JavaScript is essentially TypeScript. And if you look at the solution provided, it's exactly the same. – SiddAjmera Jul 22 '19 at 23:54
1 Answers
0
Use delete
JavaScript operator.
Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete
const obj = { id: 1 }
console.log(obj)
delete obj.id
console.log(obj)

zmag
- 7,825
- 12
- 32
- 42
-
OK thanks, just i have confuse between java script and type script because there is difference in syntax – Mohamad Alhamid Jul 23 '19 at 00:06