Skip to content

Commit 8bc7ff2

Browse files
author
Julien Heller
committed
Remove leading _ as it's not private
1 parent 7762117 commit 8bc7ff2

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/ContainerInstance.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,10 +502,10 @@ export class ContainerInstance {
502502

503503
if (value instanceof AsyncInitializedService || service.asyncInitialization) {
504504
return new Promise((resolve) => {
505-
if (!(value._initialized instanceof Promise) && service.asyncInitialization) {
505+
if (!(value.initialized instanceof Promise) && service.asyncInitialization) {
506506
throw new MissingInitializedPromiseError(service.value);
507507
}
508-
value._initialized.then(() => resolve(value));
508+
value.initialized.then(() => resolve(value));
509509
});
510510
}
511511
return Promise.resolve(value);

src/error/MissingInitializedPromiseError.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ export class MissingInitializedPromiseError extends Error {
66

77
constructor(value: any) {
88
super(
9-
(value._initialized
10-
? `asyncInitialization: true was used, but ${value.name}#_initialized is not a Promise. `
11-
: `asyncInitialization: true was used, but ${value.name}#_initialized is undefined. `) +
9+
(value.initialized
10+
? `asyncInitialization: true was used, but ${value.name}#initialized is not a Promise. `
11+
: `asyncInitialization: true was used, but ${value.name}#initialized is undefined. `) +
1212
`You will need to either extend the abstract AsyncInitializedService class, or assign ` +
13-
`${value.name}#_initialized to a Promise in your class' constructor that resolves when all required ` +
13+
`${value.name}#initialized to a Promise in your class' constructor that resolves when all required ` +
1414
`initialization is complete.`
1515
);
1616
Object.setPrototypeOf(this, MissingInitializedPromiseError.prototype);

src/types/AsyncInitializedService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
* Extend when declaring a service with asyncInitialization: true flag.
33
*/
44
export abstract class AsyncInitializedService {
5-
public _initialized: Promise<any>;
5+
public initialized: Promise<any>;
66

77
constructor() {
8-
this._initialized = this.initialize();
8+
this.initialized = this.initialize();
99
}
1010

1111
protected abstract initialize(): Promise<any>;

0 commit comments

Comments
 (0)