Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

171
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda