Skip to content

Commit

Permalink
feat(hops): simplify typings
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `withConfig` and `withServerData` have a simpler type definition now. They only take one generic argument instead of three.

Co-Authored-By: Emanuel Kluge <emanuel.kluge@xing.com>
  • Loading branch information
2 people authored and actions-user committed Oct 7, 2019
1 parent f83b331 commit 966989c
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions packages/hops/lib/runtime.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,13 @@ declare module 'hops' {

export const ConfigContext: React.Context<Config>;

export function withServerData<
P extends { serverData: C },
C = ServerData,
R = Omit<P, 'serverData'>
>(Component: React.ComponentType<P>): React.ComponentType<R>;

export function withConfig<
P extends { config: C },
C = Config,
R = Omit<P, 'config'>
>(Component: React.ComponentType<P>): React.ComponentType<R>;
export function withServerData<Props>(
Component: React.ComponentType<Props & { serverData: ServerData }>
): React.ComponentType<Props>;

export function withConfig<Props>(
Component: React.ComponentType<Props & { config: Config }>
): React.ComponentType<Props>;

export class Mixin {}

Expand Down

0 comments on commit 966989c

Please sign in to comment.