[Types] Make `queryParams` strongly-typed
See original GitHub issueRight now, there are no types for queryParams; the default value is {}, so any object will match this type.
Some autocomplete will be nice, so I propose such alternative:
type GetListQueryParams = {
page?: number
perPage?: number
sort?: string
filter?: string
expand?: string
}
// BaseCrudService@41
protected _getList<T = M>(basePath: string, page = 1, perPage = 30, queryParams: GetListQueryParams = {}): Promise<ListResult<T>> {
// ...
}
Issue Analytics
- State:
- Created 9 months ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
C# 9 records as strongly-typed ids - Part 2: ASP.NET Core ...
C# 9 records as strongly-typed ids - Part 2: ASP.NET Core route and query parameters · Model binding of route and query string...
Read more >angular - How can i make my query parameters to be type safe?
Angular HTTP client expects query parameters with string types only because you can only send string in a URL in the end.
Read more >Strongly-typed way to manage URL parameters. Works with ...
Strongly -typed way to manage URL parameters. Works with react-router. Allows to strong-type parameters in routes and search.
Read more >Strongly Typing Dapper Queries Using nameof - Scott Sauber
Use nameof in order to strongly type your Dapper queries, so renaming a property on your C# doesn't break your Dapper query or...
Read more >strongly typed http - leontrolski
First we have our index, this has no params and no query parameters - simple. Next we have the route /v1/:foo , this...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@ganigeorgiev, please find PR #102 ready for review.
Hm, this was requested previously as part of https://github.com/pocketbase/js-sdk/issues/64.
For now let’s keep the scope of the issue minimal and not merge the
BaseCrudServiceandCrudServicesince this will require some major updates to the tests too.We can add type for the query params but the declaration(s) needs to be a little more “relaxed” for better backward comparability and to allow setting also custom query props, eg. something like:
@sewera If you don’t have the time to work on this, I’ll implement it sometime at the end of the week.