From 4a822168ef354ceefbdb643e31eedaa56ee10db0 Mon Sep 17 00:00:00 2001 From: CGQAQ Date: Mon, 2 Dec 2024 16:28:59 +0800 Subject: [PATCH] fix: typo --- src/base/common/instantiation/instantiation.ts | 14 +++++++------- .../common/instantiation/instantiationService.ts | 9 ++++++--- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/base/common/instantiation/instantiation.ts b/src/base/common/instantiation/instantiation.ts index cb72e64c..17ccef2f 100644 --- a/src/base/common/instantiation/instantiation.ts +++ b/src/base/common/instantiation/instantiation.ts @@ -1,4 +1,4 @@ -import { type interfaces, LazyServiceIdentifer } from 'inversify'; +import { type interfaces, LazyServiceIdentifier } from 'inversify'; export type Newable = interfaces.Newable; @@ -6,9 +6,9 @@ export type ServiceIdentifier = interfaces.ServiceIdentifier; export type FactoryFunction = () => interfaces.ServiceIdentifier; -export type ServiceDescriptor = T | LazyServiceIdentifer | FactoryFunction; +export type ServiceDescriptor = T | LazyServiceIdentifier | FactoryFunction; -export { LazyServiceIdentifer }; +export { LazyServiceIdentifier }; export interface ServicesAccessor { get(id: ServiceIdentifier): T; @@ -16,7 +16,7 @@ export interface ServicesAccessor { const _registry: [ServiceIdentifier, ServiceDescriptor][] = []; -export function registerSingleton(id: ServiceIdentifier, useValue: T | LazyServiceIdentifer): void; +export function registerSingleton(id: ServiceIdentifier, useValue: T | LazyServiceIdentifier): void; export function registerSingleton(id: ServiceIdentifier, useFactory: FactoryFunction): void; export function registerSingleton( id: ServiceIdentifier, @@ -25,16 +25,16 @@ export function registerSingleton( ): void; export function registerSingleton( id: ServiceIdentifier, - ctorOrDescriptor: T | LazyServiceIdentifer | Newable | FactoryFunction, + ctorOrDescriptor: T | LazyServiceIdentifier | Newable | FactoryFunction, supportsDelayedInstantiation?: boolean, ): void { - if (ctorOrDescriptor instanceof LazyServiceIdentifer) { + if (ctorOrDescriptor instanceof LazyServiceIdentifier) { _registry.push([id, ctorOrDescriptor]); return; } if (typeof ctorOrDescriptor === 'function' && supportsDelayedInstantiation) { - _registry.push([id, new LazyServiceIdentifer(() => ctorOrDescriptor as Newable)]); + _registry.push([id, new LazyServiceIdentifier(() => ctorOrDescriptor as Newable)]); return; } diff --git a/src/base/common/instantiation/instantiationService.ts b/src/base/common/instantiation/instantiationService.ts index 9c64c66b..a1f77427 100644 --- a/src/base/common/instantiation/instantiationService.ts +++ b/src/base/common/instantiation/instantiationService.ts @@ -1,8 +1,11 @@ -import { Container, type interfaces, LazyServiceIdentifer } from 'inversify'; +import { Container, type interfaces, LazyServiceIdentifier } from 'inversify'; + + import { isDisposable } from '../lifecycle'; import { getSingletonServiceDescriptors, type ServiceIdentifier } from './instantiation'; + export const providerContainer = new Container(); export class InstantiationService { @@ -13,7 +16,7 @@ export class InstantiationService { for (const [identifier, descriptor] of getSingletonServiceDescriptors()) { const binding = providerContainer.bind(identifier); - if (descriptor instanceof LazyServiceIdentifer) { + if (descriptor instanceof LazyServiceIdentifier) { binding.toDynamicValue(() => descriptor.unwrap()).inSingletonScope(); } else { binding.toConstantValue(descriptor); @@ -104,4 +107,4 @@ export class InstantiationService { throw new Error('InstantiationService has been disposed'); } } -} +} \ No newline at end of file