Skip to content
This repository has been archived by the owner on Sep 4, 2019. It is now read-only.

Update TypeScript definition for service.patch #199

Merged
merged 1 commit into from
Oct 22, 2017

Conversation

kfatehi
Copy link
Contributor

@kfatehi kfatehi commented Sep 20, 2017

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

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
@@ -19,7 +19,7 @@ declare module 'feathers-client' {
get(id: string, params?: any): Promise<T>;
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>;
Copy link

@j2L4e j2L4e Oct 8, 2017

Choose a reason for hiding this comment

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

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

@daffl daffl merged commit 1bf6c2d into feathersjs-ecosystem:master Oct 22, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants