I have an array of strings that has to match an interface properties names
export interface MyType1 {
propName1: number;
propName2: string;
propNameX: number;
}
tableColumns: string[] = [
'propName1',
'propName2',
'propNameX'
];
Initially I was thinking to convert an interface to an array of strings but haven't found a solution that works.
So now I am wondering if there anyway to see if array of strings matching an interface or something like that.
I've tried using https://github.com/kimamula/ts-transformer-keys but it won't work in my case as I have no access to webpack configuration, otherwise throwing compiled error in the browser.
Need help.
Quite simply
const tableColumns: (keyof MyType1)[] = [
'propName1',
'propName2',
'propNameX'
];