Add placeholder types for fixing issues with TestInstantiationService (#164295)

This commit is contained in:
Matt Bierner 2022-10-24 08:18:43 -07:00 committed by GitHub
parent e63406a507
commit a033a32f09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View file

@ -293,7 +293,7 @@ suite('Editor Modes - textToHtmlTokenizer', () => {
class Mode extends Disposable {
private readonly languageId = 'textToHtmlTokenizerMode';
public readonly languageId = 'textToHtmlTokenizerMode';
constructor(
@ILanguageService languageService: ILanguageService

View file

@ -38,7 +38,7 @@ export const IInstantiationService = createDecorator<IInstantiationService>('ins
* Given a list of arguments as a tuple, attempt to extract the leading, non-service arguments
* to their own tuple.
*/
type GetLeadingNonServiceArgs<Args> =
export type GetLeadingNonServiceArgs<Args> =
Args extends [...BrandedService[]] ? []
: Args extends [infer A, ...BrandedService[]] ? [A]
: Args extends [infer A, ...infer R] ? [A, ...GetLeadingNonServiceArgs<R>]

View file

@ -7,9 +7,9 @@ import { IdleValue } from 'vs/base/common/async';
import { Event } from 'vs/base/common/event';
import { illegalState } from 'vs/base/common/errors';
import { toDisposable } from 'vs/base/common/lifecycle';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { SyncDescriptor, SyncDescriptor0 } from 'vs/platform/instantiation/common/descriptors';
import { Graph } from 'vs/platform/instantiation/common/graph';
import { IInstantiationService, ServiceIdentifier, ServicesAccessor, _util } from 'vs/platform/instantiation/common/instantiation';
import { GetLeadingNonServiceArgs, IInstantiationService, ServiceIdentifier, ServicesAccessor, _util } from 'vs/platform/instantiation/common/instantiation';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { LinkedList } from 'vs/base/common/linkedList';
@ -72,6 +72,9 @@ export class InstantiationService implements IInstantiationService {
}
}
createInstance(ctorOrDescriptor: any | SyncDescriptor<any>, ...rest: any[]): any; // Comment out this line to fix type issues
createInstance<T>(descriptor: SyncDescriptor0<T>): T;
createInstance<Ctor extends new (...args: any[]) => any, R extends InstanceType<Ctor>>(ctor: Ctor, ...args: GetLeadingNonServiceArgs<ConstructorParameters<Ctor>>): R;
createInstance(ctorOrDescriptor: any | SyncDescriptor<any>, ...rest: any[]): any {
let _trace: Trace;
let result: any;