Skip to content

Commit af4208d

Browse files
authored
Merge pull request #5199 from asemdreibati/di-enhancement
Store the DI decorator's id in specific property (#5131).
2 parents ce095b3 + db925ad commit af4208d

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

src/common/services/InstantiationService.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export class InstantiationService implements IInstantiationService {
6767
for (const dependency of serviceDependencies) {
6868
const service = this._services.get(dependency.id);
6969
if (!service) {
70-
throw new Error(`[createInstance] ${ctor.name} depends on UNKNOWN service ${dependency.id}.`);
70+
throw new Error(`[createInstance] ${ctor.name} depends on UNKNOWN service ${dependency.id._id}.`);
7171
}
7272
serviceArgs.push(service);
7373
}

src/common/services/ServiceRegistry.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export function createDecorator<T>(id: string): IServiceIdentifier<T> {
3333
storeServiceDependency(decorator, target, index);
3434
};
3535

36-
decorator.toString = () => id;
36+
decorator._id = id;
3737

3838
serviceRegistry.set(id, decorator);
3939
return decorator;

src/common/services/Services.ts

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ export interface ICharsetService {
124124
export interface IServiceIdentifier<T> {
125125
(...args: any[]): void;
126126
type: T;
127+
_id: string;
127128
}
128129

129130
export interface IBrandedService {

0 commit comments

Comments
 (0)