@@ -4,11 +4,11 @@ import * as React from "react"
|
||||
import type * as Component from "./Component.js"
|
||||
|
||||
|
||||
export const TypeId: unique symbol = Symbol.for("@effect-fc/Memoized/Memoized")
|
||||
export type TypeId = typeof TypeId
|
||||
export const MemoizedTypeId: unique symbol = Symbol.for("@effect-fc/Memoized/Memoized")
|
||||
export type MemoizedTypeId = typeof MemoizedTypeId
|
||||
|
||||
export interface Memoized<P> extends MemoizedOptions<P> {
|
||||
readonly [TypeId]: TypeId
|
||||
readonly [MemoizedTypeId]: MemoizedTypeId
|
||||
}
|
||||
|
||||
export interface MemoizedOptions<P> {
|
||||
@@ -17,7 +17,7 @@ export interface MemoizedOptions<P> {
|
||||
|
||||
|
||||
export const MemoizedPrototype = Object.freeze({
|
||||
[TypeId]: TypeId,
|
||||
[MemoizedTypeId]: MemoizedTypeId,
|
||||
|
||||
transformFunctionComponent<P extends {}>(
|
||||
this: Memoized<P>,
|
||||
@@ -28,7 +28,7 @@ export const MemoizedPrototype = Object.freeze({
|
||||
} as const)
|
||||
|
||||
|
||||
export const isMemoized = (u: unknown): u is Memoized<unknown> => Predicate.hasProperty(u, TypeId)
|
||||
export const isMemoized = (u: unknown): u is Memoized<unknown> => Predicate.hasProperty(u, MemoizedTypeId)
|
||||
|
||||
export const memoized = <T extends Component.Component<any, any, any, any>>(
|
||||
self: T
|
||||
|
||||
Reference in New Issue
Block a user