Skip to content

Commit 6a85bc7

Browse files
committed
Fix more strict function errors
For microsoft#81574
1 parent d436dfd commit 6a85bc7

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/vs/platform/instantiation/common/extensions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import { ServiceIdentifier, BrandedService } from './instantiation';
88

99
const _registry: [ServiceIdentifier<any>, SyncDescriptor<any>][] = [];
1010

11-
export function registerSingleton<T, Services extends BrandedService[]>(id: ServiceIdentifier<T>, ctor: { new(...services: Services): T }, supportsDelayedInstantiation?: boolean): void {
12-
_registry.push([id, new SyncDescriptor<T>(ctor, [], supportsDelayedInstantiation)]);
11+
export function registerSingleton<T, Services extends BrandedService[]>(id: ServiceIdentifier<T>, ctor: new (...services: Services) => T, supportsDelayedInstantiation?: boolean): void {
12+
_registry.push([id, new SyncDescriptor<T>(ctor as new (...args: any[]) => T, [], supportsDelayedInstantiation)]);
1313
}
1414

1515
export function getSingletonServiceDescriptors(): [ServiceIdentifier<any>, SyncDescriptor<any>][] {

src/vs/platform/instantiation/common/instantiationService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export class InstantiationService implements IInstantiationService {
6464
return result;
6565
}
6666
};
67-
return fn.apply(undefined, [accessor, ...args]);
67+
return fn(accessor, ...args);
6868
} finally {
6969
_done = true;
7070
_trace.stop();

src/vs/workbench/common/contributions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ class WorkbenchContributionsRegistry implements IWorkbenchContributionsRegistry
4343

4444
private readonly toBeInstantiated: Map<LifecyclePhase, IConstructorSignature0<IWorkbenchContribution>[]> = new Map<LifecyclePhase, IConstructorSignature0<IWorkbenchContribution>[]>();
4545

46-
registerWorkbenchContribution<Services extends BrandedService[]>(ctor: { new(...services: Services): IWorkbenchContribution }, phase: LifecyclePhase = LifecyclePhase.Starting): void {
46+
registerWorkbenchContribution<Services extends BrandedService[]>(ctor: new (...services: Services) => IWorkbenchContribution, phase: LifecyclePhase = LifecyclePhase.Starting): void {
4747
// Instantiate directly if we are already matching the provided phase
4848
if (this.instantiationService && this.lifecycleService && this.lifecycleService.phase >= phase) {
49-
this.instantiationService.createInstance(ctor);
49+
this.instantiationService.createInstance<Services, typeof ctor, IWorkbenchContribution>(ctor);
5050
}
5151

5252
// Otherwise keep contributions by lifecycle phase
@@ -57,7 +57,7 @@ class WorkbenchContributionsRegistry implements IWorkbenchContributionsRegistry
5757
this.toBeInstantiated.set(phase, toBeInstantiated);
5858
}
5959

60-
toBeInstantiated.push(ctor);
60+
toBeInstantiated.push(ctor as IConstructorSignature0<IWorkbenchContribution>);
6161
}
6262
}
6363

0 commit comments

Comments
 (0)