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

Support Number or Use ID for getFilterValue #92

Open
itotallyrock opened this issue Apr 14, 2022 · 1 comment
Open

Support Number or Use ID for getFilterValue #92

itotallyrock opened this issue Apr 14, 2022 · 1 comment

Comments

@itotallyrock
Copy link

getFilterValue is a convenient method available for getting a filter's value by its id.

This method expects a string, but a filter's id can be string | number (ID from akita).

This leads to this error when trying to use the following code.

TS2345: Argument of type 'ID' is not assignable to parameter of type 'string'.
  Type 'number' is not assignable to type 'string'.
const myCustomFilter: AkitaFilterLocal<CustomState> = { ... };

function test(): void {
    // Typescript reports an error here
    this.dataSource.getFilterValue(this.myCustomFilter.id);
}

This error applies to AkitaFilterPlugin as well as the wrapper functions on AkitaMatDataSource.

These functions should accept ID so they can reference the filter's id directly without needing a type assertion.

@manudss
Copy link
Owner

manudss commented Apr 15, 2022

Hi @itotallyrock ,

Thank you, for this issue. I had actually considered using it as a string. (because it seemed to me more sensible that the id of the filters is a string).

I think that at first, like Workaround, it should be possible to use the caste as a string.

Otherwise to fix this, I won't have the bandwidth to do it. But you can propose a PR, with the correction.

Thanks,

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

No branches or pull requests

2 participants