Skip to content

EntityId returned with fetch() has type "undefined" #199

@ktatu

Description

@ktatu

Entities retrieved with fetch() have an entityId with type string | undefined, even though fetching with an entityId that doesn't match anything in the database results in the same entityId being returned.

Code sample:

import { EntityId, Repository, Schema } from "redis-om"
import redisClient from "../services/redisClient"

const schema = new Schema("user", {
    userId: { type: "string" }
})

const repository = new Repository(schema, redisClient)

const fetchUser = async (entityId: string) => {
    const user = await repository.fetch(entityId)

    // userEntityId has type "string | undefined"
    const userEntityId = user[EntityId]
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions