I have an object which I use in multiple places in my React app:
export default {
'One': { Key: Foo.Bar, Color: '#eeeeaa' },
'Two': { Key: Foo.Bar, Color: '#aaeeee' },
'Three': { Key: Foo.Bar, Color: '#ffaaaa'},
};
In a specific component I need this object but without the key 'Three'.
When I try:
import MyObjects from './';
const newObject = delete MyObjects.Three;
I get:
The operand of a 'delete' operator must be optional.ts
How to solve this issue or is there a cleaner approach?
Update:
When I try:
const myObject2 = MyObjects;
const { Three, ...testData } = myObject;
console.log(testData);
Then I get Eslint error:
'Three' is assigned a value but never used.eslint@typescript-eslint/no-unused-vars