Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UpdateStr and UpdateNum are not export in index #4374

Open
1 of 2 tasks
muuvmuuv opened this issue Jun 4, 2024 · 2 comments
Open
1 of 2 tasks

UpdateStr and UpdateNum are not export in index #4374

muuvmuuv opened this issue Jun 4, 2024 · 2 comments

Comments

@muuvmuuv
Copy link

muuvmuuv commented Jun 4, 2024

Which @ngrx/* package(s) are the source of the bug?

entity

Minimal reproduction of the bug/regression with instructions

Does not work: import { UpdateStr } from '@ngrx/entity'
Works but errors: import { UpdateStr } from '@ngrx/entity/src/models'

Expected behavior

Export it like Update.

Versions of NgRx, Angular, Node, affected browser(s) and operating system(s)

Just updated to latest

Other information

No response

I would be willing to submit a PR to fix this issue

  • Yes
  • No
@timdeschryver
Copy link
Member

Could you please elaborate the use case why these types are required over Update<T>?

@muuvmuuv
Copy link
Author

muuvmuuv commented Jun 5, 2024

We put in some models directly that come from our API, these have strings as their ID. To not always call .toString() it would be nice to directly say UpdateStr. TypeScript will always complain about it when doing stuff like entry.id === id, because it could be a number.

function patchEntryAndChildrens(entry: Update<Entry>) {
  // ... update
  const children = state.filter(e => e.parentId === entry.id.toString()) // id/parentId are strings
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants