Skip to content

Conversation

@monkeycatdog
Copy link

It will be very convenient to use the save method with a different set of arguments.
Added overload.

@coveralls
Copy link

coveralls commented May 29, 2019

Coverage Status

Coverage increased (+0.3%) to 91.879% when pulling 672aa42 on iamruslanbakirov:check-args-in-save into 65d02f0 on ghidoz:master.

public save(params: {[s: string]: any}, customUrl: string): Observable<this>;
public save(headers: HttpHeaders, customUrl: string): Observable<this>;
public save(params: {[s: string]: any}, headers: HttpHeaders, customUrl: string): Observable<this>;
public save(...args: any[]): Observable<this> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather have a single argument instead of this type checking.
something like:

public save(options: SaveRequestOptions): Observable<this>;

@iamruslanbakirov what do you think about that?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you right, but typescript has overloading and it's great feature for this cause. And I saw same implementation in AngularJS.

so, when you have only one parameter you should be again and again create options object. it's bored 😑

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

Successfully merging this pull request may close these issues.

3 participants