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

245
Views
Redis OM fetchRepository error using typescript

I am building a shopping cart using expressjs, typescript and redis OM as the in memory database. After creating a schema using Redis OM, an error

Property 'fetchRepository' does not exist on type 'typeof App'.ts(2339)

in this line of code

export let CartRepository = client.fetchRepository(CartSchema)

I am a bit new to typescript

the whole schema:

import { Entity, Schema,Repository } from 'redis-om'

import client from '../../../../app'

export default class Cart extends Entity {}

const CartSchema = new Schema(Cart, {
  item_name: { type: 'string' },
  item_Cost:{ type: 'number' },
  coin_type:{type:'string'}
})

export let CartRepository = client.fetchRepository(CartSchema)

CartRepository.createIndex()

Below is where the client is being exported from .

//app.ts
 const url:any = process.env.REDIS_URL

        const connection:any =  createClient({url}).connect().then(() =>{
            console.log("database connected successfully");

        })
        let client:any;

 module.exports.client =  new Client().use(connection);
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You are mixing CommonJS (module.exports) and ESM (import & export)

In app.ts change module.exports.client to export const client = and in the other file change to import { client } from.

about 4 years ago · Santiago Trujillo 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!