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

248
Vistas
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 Respuestas
Responde la pregunta

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 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