Skip to content

Commit 9537ca4

Browse files
author
Benjamin Pasero
committed
debt - less casts
1 parent 978a41a commit 9537ca4

8 files changed

Lines changed: 21 additions & 22 deletions

File tree

src/vs/base/browser/ui/breadcrumbs/breadcrumbsWidget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ export class BreadcrumbsWidget {
334334

335335
private _onClick(event: IMouseEvent): void {
336336
for (let el: HTMLElement | null = event.target; el; el = el.parentElement) {
337-
let idx = this._nodes.indexOf(el as any);
337+
let idx = this._nodes.indexOf(el as HTMLDivElement);
338338
if (idx >= 0) {
339339
this._focus(idx, event);
340340
this._select(idx, event);

src/vs/base/browser/ui/grid/grid.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ export class SerializableGrid<T extends ISerializableView> extends Grid<T> {
457457
return { children, box };
458458

459459
} else if (json.type === 'leaf') {
460-
const view = deserializer.fromJSON(json.data) as T;
460+
const view: T = deserializer.fromJSON(json.data);
461461
return { view, box };
462462
}
463463

@@ -481,9 +481,9 @@ export class SerializableGrid<T extends ISerializableView> extends Grid<T> {
481481
throw new Error('Invalid JSON: \'height\' property must be a number.');
482482
}
483483

484-
const orientation = json.orientation as Orientation;
485-
const width = json.width as number;
486-
const height = json.height as number;
484+
const orientation = json.orientation;
485+
const width = json.width;
486+
const height = json.height;
487487
const box: Box = { top: 0, left: 0, width, height };
488488

489489
const root = SerializableGrid.deserializeNode(json.root, orientation, box, deserializer) as GridBranchNode<T>;

src/vs/base/browser/ui/list/rangeMap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export function consolidate(groups: IRangedGroup[]): IRangedGroup[] {
8484
* collection.
8585
*/
8686
function concat(...groups: IRangedGroup[][]): IRangedGroup[] {
87-
return consolidate(groups.reduce((r, g) => r.concat(g), [] as IRangedGroup[]));
87+
return consolidate(groups.reduce((r, g) => r.concat(g), []));
8888
}
8989

9090
export class RangeMap {

src/vs/base/common/glob.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ function listToMap(list: string[]) {
512512
return map;
513513
}
514514

515-
export function isRelativePattern(obj: any): obj is IRelativePattern {
515+
export function isRelativePattern(obj: unknown): obj is IRelativePattern {
516516
const rp = obj as IRelativePattern;
517517

518518
return rp && typeof rp.base === 'string' && typeof rp.pattern === 'string';

src/vs/base/node/zip.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ export function buffer(zipPath: string, filePath: string): Promise<Buffer> {
243243
return new Promise<Buffer>((c, e) => {
244244
const buffers: Buffer[] = [];
245245
stream.once('error', e);
246-
stream.on('data', b => buffers.push(b as Buffer));
246+
stream.on('data', (b: Buffer) => buffers.push(b));
247247
stream.on('end', () => c(Buffer.concat(buffers)));
248248
});
249249
});

src/vs/base/parts/contextmenu/electron-browser/contextmenu.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ export function popup(items: IContextMenuItem[], options?: IPopupOptions): void
3737
}
3838

3939
function createItem(item: IContextMenuItem, processedItems: IContextMenuItem[]): ISerializableContextMenuItem {
40-
const serializableItem = {
40+
const serializableItem: ISerializableContextMenuItem = {
4141
id: processedItems.length,
4242
label: item.label,
4343
type: item.type,
4444
accelerator: item.accelerator,
4545
checked: item.checked,
4646
enabled: typeof item.enabled === 'boolean' ? item.enabled : true,
4747
visible: typeof item.visible === 'boolean' ? item.visible : true
48-
} as ISerializableContextMenuItem;
48+
};
4949

5050
processedItems.push(item);
5151

src/vs/base/parts/quickopen/browser/quickOpenModel.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -473,17 +473,16 @@ class Renderer implements IRenderer<QuickOpenEntry> {
473473
}
474474

475475
disposeTemplate(templateId: string, templateData: IQuickOpenEntryGroupTemplateData): void {
476-
const data = templateData as IQuickOpenEntryGroupTemplateData;
477-
data.actionBar.dispose();
478-
data.actionBar = null!;
479-
data.container = null!;
480-
data.entry = null!;
481-
data.keybinding = null!;
482-
data.detail = null!;
483-
data.group = null!;
484-
data.icon = null!;
485-
data.label.dispose();
486-
data.label = null!;
476+
templateData.actionBar.dispose();
477+
templateData.actionBar = null!;
478+
templateData.container = null!;
479+
templateData.entry = null!;
480+
templateData.keybinding = null!;
481+
templateData.detail = null!;
482+
templateData.group = null!;
483+
templateData.icon = null!;
484+
templateData.label.dispose();
485+
templateData.label = null!;
487486
}
488487
}
489488

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ export function testFile(folder: string, file: string): Promise<ITestFileResult>
2323
return {
2424
testFile,
2525
cleanUp: () => rimraf(parentDir, RimRafMode.MOVE)
26-
} as ITestFileResult;
26+
};
2727
});
2828
}

0 commit comments

Comments
 (0)