Skip to content

Add check arguments to save model method#226

Open
monkeycatdog wants to merge 2 commits intoghidoz:masterfrom
monkeycatdog:check-args-in-save
Open

Add check arguments to save model method#226
monkeycatdog wants to merge 2 commits intoghidoz:masterfrom
monkeycatdog:check-args-in-save

Conversation

@monkeycatdog
Copy link
Copy Markdown

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

@coveralls
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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