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