Skip to content

How to create a child/proxy class of the client in TypeScript? #2841

Answered by leibale
Frederick888 asked this question in Q&A
Discussion options

You must be logged in to vote

As long as you are not changing the function signature you can just override the function without worrying about the types (as they can stay as is)

const originalGet = client.get.bind(client);
client.get = async key => {
  const result = await originalGet(key);
  // ...
  return result;
};

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Frederick888
Comment options

Answer selected by Frederick888
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants