@@ -25,22 +25,22 @@ export const isMemoized = (u: unknown): u is Memoized<unknown> => Predicate.hasP
|
||||
|
||||
export const memo = <T extends Component.Component<any, any, any>>(
|
||||
self: T
|
||||
): T & Memoized<Component.Component.Props<T>> => Object.setPrototypeOf(
|
||||
Object.assign(function() {}, self, MemoizedProto),
|
||||
Object.getPrototypeOf(self),
|
||||
): T & Memoized<Component.FunctionComponent.Props<Component.Component.FunctionComponent<T>>> => Object.setPrototypeOf(
|
||||
Object.assign(function() {}, self),
|
||||
Object.seal({ ...Object.getPrototypeOf(self), ...MemoizedProto }),
|
||||
)
|
||||
|
||||
export const withOptions: {
|
||||
<T extends Component.Component<any, any, any> & Memoized<any>>(
|
||||
options: Partial<Memoized.Options<Component.Component.Props<T>>>
|
||||
options: Partial<Memoized.Options<Component.FunctionComponent.Props<Component.Component.FunctionComponent<T>>>>
|
||||
): (self: T) => T
|
||||
<T extends Component.Component<any, any, any> & Memoized<any>>(
|
||||
self: T,
|
||||
options: Partial<Memoized.Options<Component.Component.Props<T>>>,
|
||||
options: Partial<Memoized.Options<Component.FunctionComponent.Props<Component.Component.FunctionComponent<T>>>>,
|
||||
): T
|
||||
} = Function.dual(2, <T extends Component.Component<any, any, any> & Memoized<any>>(
|
||||
self: T,
|
||||
options: Partial<Memoized.Options<Component.Component.Props<T>>>,
|
||||
options: Partial<Memoized.Options<Component.FunctionComponent.Props<Component.Component.FunctionComponent<T>>>>,
|
||||
): T => Object.setPrototypeOf(
|
||||
Object.assign(function() {}, self, options),
|
||||
Object.getPrototypeOf(self),
|
||||
|
||||
Reference in New Issue
Block a user