Details on target
Change
When attempting the following:
import {
ApiMixin,
AxiosErrorMixin,
UserEndpoint,
HandleErrorMixin,
SessionCsrfCookieMixin,
FormMixin,
} from 'resource-endpoint'
class UserBase extends SessionCsrfCookieMixin(
ApiMixin(FormMixin(UserEndpoint)),
) {}
class UserQuery extends AxiosErrorMixin(UserBase) {}
export class User extends HandleErrorMixin(UserBase) {
/**
*
* @returns {UserQuery}
*/
get reactQuery() {
return new UserQuery()
}
}
An error of Uncaught TypeError: Class constructor UserBase cannot be invoked without 'new'
would occur in the browser.
Issue seems to be around classes transpiled to ES5. Mainly, that native ES6 classes cannot extend the the transpiled classes.
The problem is that the class extends native ES6 class and is transpiled to ES5 with Babel. Transpiled classes cannot extend native classes, at least without additional measures.