Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

173
Vistas
Propety findOneTImeTokenCredentialsByEmail does not exist on type 'typeof CredentialsDao

I am trying to create a method in my credentials service file that needs to access the method from another class called CredentialsDao like so:

disableOneTimeCredentials() {
  const emailAndOneTimeToken = CredentialsDao.findOneTimeTokenCredentialsByEmail()
}

This is whats generating that error:

The credentials dao file looks like so:

export class CredentialsDao {
  constructor() {
     this.findOneTimeTokenCredentialsByEmail = this.findOneTimeTokenCredentialsByEmail.bind(this)
  }

  async findOneTimeTokenCredentialsByEmail(email: string): Promise<ICredential> {
    return this.Model.findOne({
      email: email,
      credentialType: CredentialType.oneTimeToken,
      $or: [
        {
          disabledOn: null
        },
        // {
        //   disabledOn: {
        //     $exists: false  // hangs or return nothing... why?
        //   }
        // },
        {
          disabledOn: {
            $exists: true,
            $ne: null,
            $gt: new Date()
          }
        }
      ]
    })
  }
}

And yes I did import the file.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You are trying to access the static members.

CredentialsDao.findOneTimeTokenCredentialsByEmail();

but the method is not marked as static

async findOneTimeTokenCredentialsByEmail(email: string): Promise<ICredential>

// static modifier
static async findOneTimeTokenCredentialsByEmail(email: string): Promise<ICredential>

Don't think you will be able to use this and reference non-static properties within the static method.

Perhaps an oversight, but will work if you create a new instance:

const service = new CredentialsDao();
service.findOneTimeTokenCredentialsByEmail('vader@ds.com');
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda