Skip to content

Commit af4b21c

Browse files
RyanCavanaughLabhanshAgrawal
authored andcommitted
Add missing constraints
1 parent 6516af4 commit af4b21c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/utils/object.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ export function keys(imm: Record<string, any>) {
1717
return keysCache.get(imm);
1818
}
1919

20-
export const ObjectTypedKeys = <T>(obj: T) => {
20+
export const ObjectTypedKeys = <T extends object>(obj: T) => {
2121
return Object.keys(obj) as (keyof T)[];
2222
};

lib/utils/plugins.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function exposeDecorated<P extends Record<string, any>>(
9191
};
9292
}
9393

94-
function getDecorated<P>(parent: React.ComponentType<P>, name: string): React.ComponentClass<P> {
94+
function getDecorated<P extends Record<string, any>>(parent: React.ComponentType<P>, name: string): React.ComponentClass<P> {
9595
if (!decorated[name]) {
9696
let class_ = exposeDecorated(parent);
9797
(class_ as any).displayName = `_exposeDecorated(${name})`;
@@ -136,7 +136,7 @@ function getDecorated<P>(parent: React.ComponentType<P>, name: string): React.Co
136136
// for each component, we return a higher-order component
137137
// that wraps with the higher-order components
138138
// exposed by plugins
139-
export function decorate<P>(
139+
export function decorate<P extends Record<string, any>>(
140140
Component_: React.ComponentType<P>,
141141
name: string
142142
): React.ComponentClass<P, {hasError: boolean}> {
@@ -450,7 +450,7 @@ export function getTabProps<T extends Assignable<TabProps, T>>(tab: any, parentP
450450
// connects + decorates a class
451451
// plugins can override mapToState, dispatchToProps
452452
// and the class gets decorated (proxied)
453-
export function connect<stateProps, dispatchProps>(
453+
export function connect<stateProps extends {}, dispatchProps>(
454454
stateFn: (state: HyperState) => stateProps,
455455
dispatchFn: (dispatch: HyperDispatch) => dispatchProps,
456456
c: any,

0 commit comments

Comments
 (0)