mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
Add missing constraints
This commit is contained in:
parent
6516af44d2
commit
af4b21cd0e
2 changed files with 4 additions and 4 deletions
|
|
@ -17,6 +17,6 @@ export function keys(imm: Record<string, any>) {
|
|||
return keysCache.get(imm);
|
||||
}
|
||||
|
||||
export const ObjectTypedKeys = <T>(obj: T) => {
|
||||
export const ObjectTypedKeys = <T extends object>(obj: T) => {
|
||||
return Object.keys(obj) as (keyof T)[];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ function exposeDecorated<P extends Record<string, any>>(
|
|||
};
|
||||
}
|
||||
|
||||
function getDecorated<P>(parent: React.ComponentType<P>, name: string): React.ComponentClass<P> {
|
||||
function getDecorated<P extends Record<string, any>>(parent: React.ComponentType<P>, name: string): React.ComponentClass<P> {
|
||||
if (!decorated[name]) {
|
||||
let class_ = exposeDecorated(parent);
|
||||
(class_ as any).displayName = `_exposeDecorated(${name})`;
|
||||
|
|
@ -136,7 +136,7 @@ function getDecorated<P>(parent: React.ComponentType<P>, name: string): React.Co
|
|||
// for each component, we return a higher-order component
|
||||
// that wraps with the higher-order components
|
||||
// exposed by plugins
|
||||
export function decorate<P>(
|
||||
export function decorate<P extends Record<string, any>>(
|
||||
Component_: React.ComponentType<P>,
|
||||
name: string
|
||||
): React.ComponentClass<P, {hasError: boolean}> {
|
||||
|
|
@ -450,7 +450,7 @@ export function getTabProps<T extends Assignable<TabProps, T>>(tab: any, parentP
|
|||
// connects + decorates a class
|
||||
// plugins can override mapToState, dispatchToProps
|
||||
// and the class gets decorated (proxied)
|
||||
export function connect<stateProps, dispatchProps>(
|
||||
export function connect<stateProps extends {}, dispatchProps>(
|
||||
stateFn: (state: HyperState) => stateProps,
|
||||
dispatchFn: (dispatch: HyperDispatch) => dispatchProps,
|
||||
c: any,
|
||||
|
|
|
|||
Loading…
Reference in a new issue