I'm currently developing JavaScript code using ECMAScript 6 and I'm facing an issue with calling an asynchronous method from a superclass within a method of an extending class. Here is the scenario I'm dealing with:
class SuperClass {
constructor(){}
async method() {
return;
}
}
class ExtendClass extends SuperClass {
constructor() {
super();
}
async method() {
return super.method();
}
}
When attempting to compile the above code, I encounter the following error:
SyntaxError: 'super' keyword unexpected here
at Object.<anonymous> (Path/To/File.js:line:character)
Is it actually feasible to achieve what I'm trying to do? My attempts to find relevant information through Google have been unsuccessful thus far.
Notably, awaiting the call to the super class or employing different method names has not rectified the issue - the only effective workaround seems to be making the extending class' method non-async.