Nestjs. Проблемы с типами ()=>any is not assignable to Provider

export function JWTAuthGuard(secret: typeof jwtEmailSecret | typeof jwtSecret):any {
  @Injectable()
  class JWTAuthGuardMixin implements CanActivate {
    constructor(
      private jwtService: JwtService,
    ) {}
   ...
  }
  return mixin(JWTAuthGuardMixin)
}

Код выше приводит к ошибке в модуле

@Module({
   imports:[ ... ],
   provider:[
      ...,
      JWTAuthGuard,
   ],
   exports: [
      ...,
      JWTAuthGuard,
   ],
})
export class CommonModule{}

Если не использовать миксин, то всё хорошо, если с миксином следующая ошибка:

Type '(secret: "secret" | "email-secret") => any' is not assignable to type 'Provider<any>'.
  Type '(secret: "secret" | "email-secret") => any' is missing the following properties from type 'ExistingProvider<any>': provide, useExisting

ИЛИ как по другому передать secret в JWTAuthGuard?


Ответы (0 шт):