Skip to content

Commit fd1ac75

Browse files
committed
Fix TS 3.5 compile errors
Fixing errors related to microsoft/TypeScript#31380
1 parent d5fce51 commit fd1ac75

File tree

20 files changed

+40
-41
lines changed

20 files changed

+40
-41
lines changed

extensions/typescript-language-features/src/utils/surveyor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class Survey {
103103
}
104104

105105
private get triggerCount(): number {
106-
const count = this.memento.get(this.triggerCountMementoKey);
106+
const count = this.memento.get<number>(this.triggerCountMementoKey);
107107
return !count || isNaN(+count) ? 0 : +count;
108108
}
109109

src/vs/base/common/objects.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function deepClone<T>(obj: T): T {
1414
return obj as any;
1515
}
1616
const result: any = Array.isArray(obj) ? [] : {};
17-
Object.keys(obj).forEach((key: string) => {
17+
Object.keys(obj as any).forEach((key: string) => {
1818
if (obj[key] && typeof obj[key] === 'object') {
1919
result[key] = deepClone(obj[key]);
2020
} else {

src/vs/base/common/parsers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export abstract class Parser {
7979
this._problemReporter.fatal(message);
8080
}
8181

82-
protected static merge<T>(destination: T, source: T, overwrite: boolean): void {
82+
protected static merge<T extends object>(destination: T, source: T, overwrite: boolean): void {
8383
Object.keys(source).forEach((key: string) => {
8484
const destValue = destination[key];
8585
const sourceValue = source[key];

src/vs/base/node/request.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export function asText(context: IRequestContext): Promise<string | null> {
159159
});
160160
}
161161

162-
export function asJson<T>(context: IRequestContext): Promise<T | null> {
162+
export function asJson<T = {}>(context: IRequestContext): Promise<T | null> {
163163
return new Promise((c, e) => {
164164
if (!isSuccess(context)) {
165165
return e('Server returned ' + context.res.statusCode);

src/vs/base/test/node/config.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ suite('Config', () => {
2020
const newDir = path.join(parentDir, 'config', id);
2121
const testFile = path.join(newDir, 'config.json');
2222

23-
let watcher = new ConfigWatcher(testFile);
23+
let watcher = new ConfigWatcher<{}>(testFile);
2424

2525
let config = watcher.getConfig();
2626
assert.ok(config);

src/vs/editor/contrib/colorPicker/colorDetector.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ export class ColorDetector implements IEditorContribution {
7676
}
7777
const languageId = model.getLanguageIdentifier();
7878
// handle deprecated settings. [languageId].colorDecorators.enable
79-
let deprecatedConfig = this._configurationService.getValue(languageId.language);
79+
const deprecatedConfig = this._configurationService.getValue<{}>(languageId.language);
8080
if (deprecatedConfig) {
81-
let colorDecorators = deprecatedConfig['colorDecorators']; // deprecatedConfig.valueOf('.colorDecorators.enable');
81+
const colorDecorators = deprecatedConfig['colorDecorators']; // deprecatedConfig.valueOf('.colorDecorators.enable');
8282
if (colorDecorators && colorDecorators['enable'] !== undefined && !colorDecorators['enable']) {
8383
return colorDecorators['enable'];
8484
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ export class InstantiationService implements IInstantiationService {
220220
// Return a proxy object that's backed by an idle value. That
221221
// strategy is to instantiate services in our idle time or when actually
222222
// needed but not when injected into a consumer
223-
const idle = new IdleValue(() => this._createInstance(ctor, args, _trace));
223+
const idle = new IdleValue(() => this._createInstance<T>(ctor, args, _trace));
224224
return <T>new Proxy(Object.create(null), {
225225
get(_target: T, prop: PropertyKey): any {
226226
return idle.getValue()[prop];

src/vs/workbench/browser/dnd.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { addDisposableListener, EventType } from 'vs/base/browser/dom';
3030
import { IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService';
3131
import { IRecentFile } from 'vs/platform/history/common/history';
3232
import { IWorkspaceEditingService } from 'vs/workbench/services/workspace/common/workspaceEditing';
33+
import { withNullAsUndefined } from 'vs/base/common/types';
3334

3435
export interface IDraggedResource {
3536
resource: URI;
@@ -81,7 +82,12 @@ export function extractResources(e: DragEvent, externalOnly?: boolean): Array<ID
8182
try {
8283
const draggedEditors: ISerializedDraggedEditor[] = JSON.parse(rawEditorsData);
8384
draggedEditors.forEach(draggedEditor => {
84-
resources.push({ resource: URI.parse(draggedEditor.resource), backupResource: draggedEditor.backupResource ? URI.parse(draggedEditor.backupResource) : undefined, viewState: draggedEditor.viewState, isExternal: false });
85+
resources.push({
86+
resource: URI.parse(draggedEditor.resource),
87+
backupResource: draggedEditor.backupResource ? URI.parse(draggedEditor.backupResource) : undefined,
88+
viewState: withNullAsUndefined(draggedEditor.viewState),
89+
isExternal: false
90+
});
8591
});
8692
} catch (error) {
8793
// Invalid transfer

src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -388,21 +388,14 @@ export class BreadcrumbsFilePicker extends BreadcrumbsPicker {
388388
const labels = this._instantiationService.createInstance(ResourceLabels, DEFAULT_LABELS_CONTAINER /* TODO@Jo visibility propagation */);
389389
this._disposables.push(labels);
390390

391-
return this._instantiationService.createInstance(
392-
WorkbenchAsyncDataTree,
393-
container,
394-
new FileVirtualDelegate(),
395-
[this._instantiationService.createInstance(FileRenderer, labels)],
396-
this._instantiationService.createInstance(FileDataSource),
397-
{
398-
filterOnType: true,
399-
multipleSelectionSupport: false,
400-
sorter: new FileSorter(),
401-
filter: this._instantiationService.createInstance(FileFilter),
402-
identityProvider: new FileIdentityProvider(),
403-
keyboardNavigationLabelProvider: new FileNavigationLabelProvider()
404-
}
405-
) as WorkbenchAsyncDataTree<BreadcrumbElement, any, FuzzyScore>;
391+
return this._instantiationService.createInstance(WorkbenchAsyncDataTree, container, new FileVirtualDelegate(), [this._instantiationService.createInstance(FileRenderer, labels)], this._instantiationService.createInstance(FileDataSource), {
392+
filterOnType: true,
393+
multipleSelectionSupport: false,
394+
sorter: new FileSorter(),
395+
filter: this._instantiationService.createInstance(FileFilter),
396+
identityProvider: new FileIdentityProvider(),
397+
keyboardNavigationLabelProvider: new FileNavigationLabelProvider()
398+
}) as WorkbenchAsyncDataTree<BreadcrumbElement | IFileStat, any, FuzzyScore>;
406399
}
407400

408401
_setInput(element: BreadcrumbElement): Promise<void> {

src/vs/workbench/browser/parts/editor/editorStatus.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ export class ChangeModeAction extends Action {
10331033
setTimeout(() => {
10341034
this.quickInputService.pick(picks, { placeHolder: nls.localize('pickLanguageToConfigure', "Select Language Mode to Associate with '{0}'", extension || base) }).then(language => {
10351035
if (language) {
1036-
const fileAssociationsConfig = this.configurationService.inspect(FILES_ASSOCIATIONS_CONFIG);
1036+
const fileAssociationsConfig = this.configurationService.inspect<{}>(FILES_ASSOCIATIONS_CONFIG);
10371037

10381038
let associationKey: string;
10391039
if (extension && base[0] !== '.') {

0 commit comments

Comments
 (0)