Add generic parameter to `AjaxResponse` and `ajax`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 31.7k
- Forks
- 3k
- PR merge metrics
- No merged PRs in 30d
Description
Feature Request
Is your feature request related to a problem? Please describe.
ajax(params) returns Observable<AjaxResponse> with field response typed as any.
Describe the solution you'd like
I'd like to be able to pass generic parameter to ajax, like:
ajax<{ field: string }>(params).pipe(map({ response: { field } }) => field)) // properly inferred as `Observable<string>`
Describe alternatives you've considered
Casting type each time, repetitive and annoying.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the TypeScript declarations and tests for AjaxResponse and ajax, then inspect how the current response field is typed and inferred. The work is done when callers can provide a generic response shape and the resulting observable infers that shape without repetitive casts, with existing behavior preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, developer-experience
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100