When converting a class member name to a string,
I rely on the following function. However, in the example provided, we consistently need to specify the name of the Current Component.
Is there a way to adjust the export function so that it always refers to the current class it is in without requiring the class name to be retyped?
Function:
export function nameof<T>(key: keyof T, instance?: T): keyof T {
return key;
}
Example Usage:
nameof<SampleComponent>('productInput')
Link to Resource: