'compile-time' way to get all property names defined interface
问题 I'd like to create a generic TypeScript class for rendering (as a HTML list) of an array of objects which implement a specific interface . e.g. class GenericListRenderer<T> { items: T[]; constructor(listItems: T[], className?: string){ this.items = listItems; ... } private getPropertyNames(): string[]{ // What is the best way to access all property names defined in // TypeScript interface 'T' that was used in this generic? ... } render(){ var propNames: string[] = this.getPropertyNames(); //