This repository was archived by the owner on Sep 4, 2019. It is now read-only.
Update TypeScript definition for service.patch#199
Merged
Conversation
Similar to React's `setState`, the `patch` function should allow a partial object of a given type, but no extraneous keys thereafter. Resource: https://github.com/developit/preact/blob/f7834ec9fb7848581c6fbc7833bcbe2f2db9fe61/src/preact.d.ts#L61
j2L4e
reviewed
Oct 8, 2017
| create(data: T, params?: any): Promise<T>; | ||
| update(id: string, data: T, params?: any): Promise<T>; | ||
| patch(id: string, data: T, params?: any) : Promise<T>; | ||
| patch<K extends keyof T>(id: string, data:Pick<T, K>, params?: any) : Promise<T>; |
There was a problem hiding this comment.
looks good, would need to be patched in feathers and feathers-reactive too.
Out of curiosity: How is this different from using data: Partial<T>?
edit: this answered my question: https://medium.com/@curtistatewilkinson/typescript-2-1-and-the-power-of-pick-ff433f1e6fb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Similar to React's
setState, thepatchfunction should allow a partial object of a given type, but no extraneous keys thereafter.Resource: https://github.com/developit/preact/blob/f7834ec9fb7848581c6fbc7833bcbe2f2db9fe61/src/preact.d.ts#L61