If we have a scenario where:
class ExampleType {
item1?: string,
item2?: string
}
and all the properties are OPTIONAL.
Is there a way to generate an array of property names like:
["item1", "item2"]
I attempted to use
console.log(Object.keys(new ExampleType()))
but it returned an empty array due to the optional properties.