@mvcs/core
Version:
MV* common objects and interfaces required across the framework
31 lines (30 loc) • 1.05 kB
TypeScript
import { Abstract, Newable } from "tstt";
/**
* Type identifier for runtime types that are affected by type erasure (interfaces, types, etc).
* Makes possible way to use interface as type, thankfully to typescript declaration merging feature.
*
* Consider following example code:
*
* @example
* export interface Example { ... }
* export namespace Example {
* export declare const BeanType: Example;
* export const BeanName = "Example";
* }
* ....
* const bean = context.bean(Example);
*/
export declare type VirtualBeanType<T = any> = {} & {
/**
* Property value declaring instance type of the bean.
* Value is not used during runtime and required only for type checking.
*/
readonly BeanType: T;
/** Display name of the bean. */
readonly BeanName: string;
};
/**
* Defines possible ways to identify beans.
*/
export declare type BeanType<T = any> = Newable<T> | Abstract<T> | VirtualBeanType<T> | symbol | string;
export declare function beanTypeName<T>(type: BeanType<T>): string | undefined;