Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

177
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!