ngneat / elf

🧙‍♀️ A Reactive Store with Magical Powers
https://ngneat.github.io/elf/
MIT License
1.62k stars 93 forks source link

Strict mode TS does not accept idKey value other than 'id' #505

Closed Ketec closed 10 months ago

Ketec commented 10 months ago

Which @ngneat/elf-* package(s) are the source of the bug?

store

Is this a regression?

No

Description

withEntities<AssetEntity>({ idKey: 'uuid' }) Results in type error:

Argument type {idKey: "uuid"} is not assignable to parameter type {initialValue?: AssetEntity[] | undefined, idKey?: "id" | undefined} | undefined

The type ends up as "id" here: IdKey extends string = "id"

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/angular-ivy-ykgajg?file=src%2Fapp%2Ftodos%2Fstate%2Ftodos.repository.ts

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in

No response

Anything else?

"typescript": "4.9.5" tsconfig is in strict mode

Do you want to create a pull request?

No

stackblitz[bot] commented 10 months ago

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

NetanelBasal commented 10 months ago

Where do you have uuid key in Todo?

NetanelBasal commented 10 months ago

See https://ngneat.github.io/elf/docs/features/entities-management/entities/#idkey