Skip to content

[REQ][Typescript-axios], ability to pass in parameters as an object #5385

@standayweb

Description

@standayweb

Is your feature request related to a problem? Please describe.

It can be hard to read the code and can introduce bugs when using normal function parameters, for instance, if you have this:

api.getMembers(orgId, offset, limit, sortBy, sortOrder, options)

and the backend adds an argument websiteId, after orgId, depending on the types of the items it won't necessarily cause a type error.

Describe the solution you'd like

I would like the option to pass in the parameters as an object

Describe alternatives you've considered

For now, I am manually creating helper functions like this, but it's still a hassle to make sure to keep them up to date, it would be nicer to have the security of having objects here so that if anything at all is wrong, it will give a type error

getMembers: ({ orgId, offset, limit, sortBy, sortOrder, options }: GetOrgMembersReq) =>
    api.getMembers(orgId, offset, limit, sortBy, sortOrder, options)

Additional context

No additional context, let me know if you have any questions

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions