add TYPE property to UmbContextToken to get the generic type
This commit is contained in:
@@ -1,4 +1,15 @@
|
||||
export class UmbContextToken<T = unknown> {
|
||||
/**
|
||||
* Get the type of the token
|
||||
*
|
||||
* @public
|
||||
* @type {T}
|
||||
* @memberOf UmbContextToken
|
||||
* @example `typeof MyToken.TYPE`
|
||||
* @returns undefined
|
||||
*/
|
||||
readonly TYPE: T = undefined as never;
|
||||
|
||||
/**
|
||||
* @param alias Unique identifier for the token,
|
||||
* @param _desc Description for the token,
|
||||
@@ -7,13 +18,6 @@ export class UmbContextToken<T = unknown> {
|
||||
*/
|
||||
constructor(protected alias: string, protected _desc?: string) {}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
get multi(): UmbContextToken<Array<T>> {
|
||||
return this as UmbContextToken<Array<T>>;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method must always return the unique alias of the token since that
|
||||
* will be used to look up the token in the injector.
|
||||
|
||||
Reference in New Issue
Block a user