I am now using a Visitor pattern where I have 2 visitors using the same interface returning T. It basically looks like the schema below, but my visitor returns something.
I would like to change the return type of one of my visitor to return a Promise.
Should I create a new interface for this issue?

If you want to make use of
async/await, I think it makes sense to create a new interface calledAsyncVisitor. Every visitor you implement should, in a sense, be thought of as its own "virtual" function on an enumeration of types. However, in JavaScript,FunctionandAsyncFunctionare two inherently different types of functions, where the latter may suspend execution and must always return aPromise. Therefore, it doesn't make sense to have one visitor interface to represent both regular and async functions.While you could hypothetically implement your promise-based Visitor as just
Visitor<Promise<T>>andasync/awaitwill still work, your interface would then mix and treatFunctionandAsyncFunctionas interchangeable types, which can be unexpected if you're doing some kind of metaprogramming.In other words, I think your interfaces should look something like this: