Typescript | Call a function every time a function is called
问题 I am trying to write a Typescript API service. For the service I need a way to check that the method exists when a function such as get is called. I realise I can do like get(endpoint: string) { this.handleRequest(); } post(endpoint: string, data: any) { this.handleRequest(); } But I don't particularly want to do that are the top of every method so I didn't know if there was a way to listen within the constructor of the Typescript class for a call of a child function. It seems a little far