UNPKG

@lithiumjs/angular

Version:

Reactive components made easy. Lithium provides utilities that enable seamless reactive state and event interactions for Angular components.

12 lines (11 loc) 990 B
import type { Constructable, IfEquals, Publicize } from "./lang-utils"; /** @description Ensures that `T[Name]` is the same type as `T[K]`. * `K` is not required to be a strict `keyof T` since it may be a private field. */ type ValidateName<T extends Record<string, any>, K extends string, Name extends string | undefined> = Name extends keyof T ? (IfEquals<T[Name], Publicize<T, K>[K]> extends true ? Name : never) : never; /** @PropertyDecoratorFactory * @description Explicitly declares the decorated property as a stateful property to be tracked by `ComponentStateRef`. * @param publicName (Optional) The public property that this state should be exposed through. */ export declare function DeclareState<Name extends string | undefined = undefined>(publicName?: Name): <ComponentT extends Constructable<any, any>, K extends string>(target: Name extends undefined ? ComponentT : (ValidateName<ComponentT, K, Name> extends never ? never : ComponentT), propKey: K) => void; export {};