mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-04 04:22:50 +00:00
fix: change SCThingMeta getInstance() return value
This commit is contained in:
@@ -222,7 +222,7 @@ export class SCThingMeta implements SCMetaTranslations<SCThing> {
|
|||||||
/**
|
/**
|
||||||
* Set type definiton for singleton instance
|
* Set type definiton for singleton instance
|
||||||
*/
|
*/
|
||||||
protected static _instance: SCThingMeta;
|
protected static _instance = new Map<string, unknown>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translations of fields
|
* Translations of fields
|
||||||
@@ -268,8 +268,10 @@ export class SCThingMeta implements SCMetaTranslations<SCThing> {
|
|||||||
* Function to retrieve typed singleton instance
|
* Function to retrieve typed singleton instance
|
||||||
*/
|
*/
|
||||||
public static getInstance<T extends SCThingMeta>(): T {
|
public static getInstance<T extends SCThingMeta>(): T {
|
||||||
const typedThis = this as any as typeof SCThingMeta;
|
if (!this._instance.has(this.name)) {
|
||||||
return (typedThis._instance || (typedThis._instance = new this())) as T;
|
this._instance.set(this.name, new this());
|
||||||
|
}
|
||||||
|
return this._instance.get(this.name) as T;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected constructor() {}
|
protected constructor() {}
|
||||||
|
|||||||
@@ -64,11 +64,6 @@ export interface SCDiff extends SCDiffWithoutReferences {
|
|||||||
* Meta information about a diff
|
* Meta information about a diff
|
||||||
*/
|
*/
|
||||||
export class SCDiffMeta extends SCThingMeta implements SCMetaTranslations<SCDiff> {
|
export class SCDiffMeta extends SCThingMeta implements SCMetaTranslations<SCDiff> {
|
||||||
/**
|
|
||||||
* Set type definiton for singleton instance
|
|
||||||
*/
|
|
||||||
protected static _instance: SCThingMeta;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translations of fields
|
* Translations of fields
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user