-1

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.

Mohamad Alhamid
  • 346
  • 4
  • 15

1 Answers1

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