@xylabs/object
Advanced tools
Comparing version 3.1.8 to 3.1.9
@@ -8,5 +8,5 @@ import { Logger } from '@xylabs/logger'; | ||
export type BaseParams<TAdditionalParams extends EmptyObject | void = void> = TAdditionalParams extends EmptyObject ? BaseParamsFields & TAdditionalParams : BaseParamsFields; | ||
export declare abstract class Base<TParams extends BaseParams | undefined = BaseParams> { | ||
export declare abstract class Base<TParams extends BaseParams | void = void> { | ||
static defaultLogger?: Logger; | ||
static readonly globalInstances: Record<BaseClassName, WeakRef<Base<BaseParams | undefined>>[]>; | ||
static readonly globalInstances: Record<BaseClassName, WeakRef<Base>[]>; | ||
static readonly globalInstancesCountHistory: Record<BaseClassName, number[]>; | ||
@@ -20,3 +20,3 @@ static readonly uniqueName: string; | ||
private _params; | ||
constructor(params: TParams); | ||
constructor(params?: TParams extends BaseParams ? TParams : BaseParams); | ||
static get historyInterval(): number; | ||
@@ -30,3 +30,3 @@ static set historyInterval(value: number); | ||
get logger(): Logger | undefined; | ||
get params(): TParams; | ||
get params(): TParams extends BaseParams ? TParams : BaseParams; | ||
static gc(force?: boolean): void; | ||
@@ -33,0 +33,0 @@ static gc(className: string): void; |
@@ -111,3 +111,3 @@ // src/AsTypeFactory.ts | ||
constructor(params) { | ||
this._params = params; | ||
this._params = params ?? {}; | ||
params?.logger?.debug(`Base constructed [${Object(this).name}]`); | ||
@@ -114,0 +114,0 @@ this.recordInstance(); |
@@ -8,5 +8,5 @@ import { Logger } from '@xylabs/logger'; | ||
export type BaseParams<TAdditionalParams extends EmptyObject | void = void> = TAdditionalParams extends EmptyObject ? BaseParamsFields & TAdditionalParams : BaseParamsFields; | ||
export declare abstract class Base<TParams extends BaseParams | undefined = BaseParams> { | ||
export declare abstract class Base<TParams extends BaseParams | void = void> { | ||
static defaultLogger?: Logger; | ||
static readonly globalInstances: Record<BaseClassName, WeakRef<Base<BaseParams | undefined>>[]>; | ||
static readonly globalInstances: Record<BaseClassName, WeakRef<Base>[]>; | ||
static readonly globalInstancesCountHistory: Record<BaseClassName, number[]>; | ||
@@ -20,3 +20,3 @@ static readonly uniqueName: string; | ||
private _params; | ||
constructor(params: TParams); | ||
constructor(params?: TParams extends BaseParams ? TParams : BaseParams); | ||
static get historyInterval(): number; | ||
@@ -30,3 +30,3 @@ static set historyInterval(value: number); | ||
get logger(): Logger | undefined; | ||
get params(): TParams; | ||
get params(): TParams extends BaseParams ? TParams : BaseParams; | ||
static gc(force?: boolean): void; | ||
@@ -33,0 +33,0 @@ static gc(className: string): void; |
@@ -112,3 +112,3 @@ // src/AsTypeFactory.ts | ||
var _a; | ||
this._params = params; | ||
this._params = params ?? {}; | ||
(_a = params == null ? void 0 : params.logger) == null ? void 0 : _a.debug(`Base constructed [${Object(this).name}]`); | ||
@@ -115,0 +115,0 @@ this.recordInstance(); |
@@ -14,5 +14,5 @@ { | ||
"dependencies": { | ||
"@xylabs/assert": "^3.1.8", | ||
"@xylabs/logger": "^3.1.8", | ||
"@xylabs/promise": "^3.1.8" | ||
"@xylabs/assert": "^3.1.9", | ||
"@xylabs/logger": "^3.1.9", | ||
"@xylabs/promise": "^3.1.9" | ||
}, | ||
@@ -62,4 +62,4 @@ "devDependencies": { | ||
"sideEffects": false, | ||
"version": "3.1.8", | ||
"version": "3.1.9", | ||
"type": "module" | ||
} |
@@ -22,5 +22,5 @@ import { assertEx } from '@xylabs/assert' | ||
export abstract class Base<TParams extends BaseParams | undefined = BaseParams> { | ||
export abstract class Base<TParams extends BaseParams | void = void> { | ||
static defaultLogger?: Logger | ||
static readonly globalInstances: Record<BaseClassName, WeakRef<Base<BaseParams | undefined>>[]> = {} | ||
static readonly globalInstances: Record<BaseClassName, WeakRef<Base>[]> = {} | ||
static readonly globalInstancesCountHistory: Record<BaseClassName, number[]> = {} | ||
@@ -33,6 +33,6 @@ static readonly uniqueName = globallyUnique(this.name, this, 'xyo') | ||
private static _maxGcFrequency = MAX_GC_FREQUENCY | ||
private _params: TParams | ||
private _params: TParams extends BaseParams ? TParams : BaseParams | ||
constructor(params: TParams) { | ||
this._params = params | ||
constructor(params?: TParams extends BaseParams ? TParams : BaseParams) { | ||
this._params = params ?? ({} as TParams extends BaseParams ? TParams : BaseParams) | ||
params?.logger?.debug(`Base constructed [${Object(this).name}]`) | ||
@@ -76,3 +76,3 @@ this.recordInstance() | ||
get params() { | ||
get params(): TParams extends BaseParams ? TParams : BaseParams { | ||
return this._params | ||
@@ -79,0 +79,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
290358
Updated@xylabs/assert@^3.1.9
Updated@xylabs/logger@^3.1.9
Updated@xylabs/promise@^3.1.9