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

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

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