Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change doc.update() parameter type to Partial<T> #1247

Merged
merged 3 commits into from
Oct 12, 2017
Merged

Change doc.update() parameter type to Partial<T> #1247

merged 3 commits into from
Oct 12, 2017

Conversation

markgoho
Copy link
Contributor

Checklist

Description

Strongly typing the parameter requires that the object that's passed in is a complete match for the model. Normally though, you should be able to pass whatever you want to set and update (any number of fields in the model) and it should work.

Code sample

Strongly typing the parameter requires that the object that's passed in is a complete match for the model. Normally though, you should be able to pass whatever you want to set and update (any number of fields in the model) and it should work.
@markgoho
Copy link
Contributor Author

Okay this is a shot in the dark, and I may be missing some obvious solution using Typescript, but it seems like if you take away the :T it works perfectly.

@chrste90
Copy link

What's about : Partial<T>? Does is work?

@codediodeio
Copy link
Contributor

This PR would also close #1215

@markgoho
Copy link
Contributor Author

@chris1308 Oooh, Partial<T> works!

@jamesdaniels
Copy link
Member

Update I'm feeling but would you really want a partial for set?

@markgoho
Copy link
Contributor Author

I don't there'd be a case where you'd want to just pass one of many properties to a .set() call. I guess part of the joy of Typescript is that we can use it to prevent ourselves from making silly mistakes, like passing a single property to a .set() call when we meant .update().

I'm going to tweak the commit and title of the PR based on your very wise question 😄

@markgoho markgoho changed the title Remove strongly typed parameters for update and set Change doc.update() parameter type to Partial<T> Oct 12, 2017
@jamesdaniels jamesdaniels merged commit 297cabb into angular:master Oct 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants