Is it possible to have such function or design something similar?
class Test {
  testProperty: string;
  secondTestProperty: string;
}
function propAsString(input: any) {
  ...
}
let test = new Test();
console.log(propAsString(test.testProperty)); // output 'testProperty'
console.log(propAsString(test.secondTestProperty)); // output 'secondTestProperty'
