Skip to content

Accessing EntityId results in "TS2538: Type unique symbol cannot be used as an index type" #261

@finkpong

Description

@finkpong

According to the docs it is possible to access the entityId/entityKeyName like this:

import { EntityId } from 'redis-om'

Then you can access the entity ID using that symbol:

album = await albumRepository.save(album)
album[EntityId] // '01FJYWEYRHYFT8YTEGQBABJ43J'

i tried this, but getting the following error in the IDE (webstorm):
TS2538: Type unique symbol cannot be used as an index type.

Despite the error in the IDE, at runtime it successfully produces the entity ID. I could either ignore the wiggly red underline or suppress the error (@ts-ignore and eslint) so i guess it is fine, but just wanted to confirm this is expected behavior?

thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions