feat(di): add OpaqueToken to DI
Using `new Object()` as a token causes cryptic errors. OpaqueToken class should be used instead.
This commit is contained in:
@ -4,3 +4,4 @@ export * from './binding';
|
||||
export * from './key';
|
||||
export * from './module';
|
||||
export * from './exceptions';
|
||||
export * from './opaque_token';
|
||||
|
11
modules/di/src/opaque_token.js
Normal file
11
modules/di/src/opaque_token.js
Normal file
@ -0,0 +1,11 @@
|
||||
export class OpaqueToken {
|
||||
_desc:string;
|
||||
|
||||
constructor(desc:string){
|
||||
this._desc = `Token(${desc})`;
|
||||
}
|
||||
|
||||
toString() {
|
||||
return this._desc;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user