Javascript 打字稿';s mixin官方applyMixin无法将类作为函数调用

Javascript 打字稿';s mixin官方applyMixin无法将类作为函数调用,javascript,typescript,mixins,Javascript,Typescript,Mixins,我正在尝试编写一个mixin,并使用来自的官方applyMixins。applyMixins如下所示: applyMixins.ts export class BaseApiService { private headers = { Accept: 'application/json', 'Content-Type': 'application/json', }; protected client: AxiosInstance; public construc

我正在尝试编写一个mixin,并使用来自的官方
applyMixins
applyMixins
如下所示:

applyMixins.ts

export class BaseApiService {
  private headers = {
    Accept: 'application/json',
    'Content-Type': 'application/json',
  };

  protected client: AxiosInstance;

  public constructor() {
    this.client = axios.create({
      baseURL: process.env.NEXT_PUBLIC_API_URL || 'https://localhost:8000/',
      headers: this.headers,
    });
    // ... other code such as request and response interceptor
  }
}
导出默认函数applyMixins(derivedCtor:any,baseCtors:any[]):void{
baseCtors.forEach((baseCtor)=>{
Object.getOwnPropertyNames(baseCtor.prototype).forEach((名称)=>{
const baseCtorName=Object.getOwnPropertyDescriptor(
baseCtor.prototype,
名称
);
如果(!baseCtorName){
返回;
}
Object.defineProperty(derivedCtor.prototype,name,baseCtorName);
});
});}
我的混血儿看起来像这样

baseApi.ts

export class BaseApiService {
  private headers = {
    Accept: 'application/json',
    'Content-Type': 'application/json',
  };

  protected client: AxiosInstance;

  public constructor() {
    this.client = axios.create({
      baseURL: process.env.NEXT_PUBLIC_API_URL || 'https://localhost:8000/',
      headers: this.headers,
    });
    // ... other code such as request and response interceptor
  }
}
authMixin.ts

export class BaseApiService {
  private headers = {
    Accept: 'application/json',
    'Content-Type': 'application/json',
  };

  protected client: AxiosInstance;

  public constructor() {
    this.client = axios.create({
      baseURL: process.env.NEXT_PUBLIC_API_URL || 'https://localhost:8000/',
      headers: this.headers,
    });
    // ... other code such as request and response interceptor
  }
}
导出接口IAuthApi{
登录(
用户名:string,
密码:string

):Promise

您链接的手册文档未使用applyMixins的定义。请使用官方示例