Add typings for simple _ and other parameters that are missing types

For #70352

Uses `unknown` for parameters that we don't care about the type of. This prevents the type from being used incorrectly (which `any` would allow)
This commit is contained in:
Matt Bierner
2019-03-19 11:34:04 -07:00
parent e388c734f3
commit eac048313a
23 changed files with 77 additions and 73 deletions

View File

@@ -30,7 +30,7 @@ import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProper
import { WindowsService } from 'vs/platform/windows/electron-browser/windowsService';
import { MainProcessService, IMainProcessService } from 'vs/platform/ipc/electron-browser/mainProcessService';
import { EnvironmentService } from 'vs/platform/environment/node/environmentService';
import { IssueReporterModel } from 'vs/code/electron-browser/issue/issueReporterModel';
import { IssueReporterModel, IssueReporterData as IssueReporterModelData } from 'vs/code/electron-browser/issue/issueReporterModel';
import { IssueReporterData, IssueReporterStyles, IssueType, ISettingsSearchIssueReporterData, IssueReporterFeatures, IssueReporterExtensionData } from 'vs/platform/issue/common/issue';
import BaseHtml from 'vs/code/electron-browser/issue/issueReporterPage';
import { createSpdLogService } from 'vs/platform/log/node/spdlogService';
@@ -92,7 +92,7 @@ export class IssueReporter extends Disposable {
this.previewButton = new Button(issueReporterElement);
}
ipcRenderer.on('vscode:issuePerformanceInfoResponse', (_, info) => {
ipcRenderer.on('vscode:issuePerformanceInfoResponse', (_: unknown, info: Partial<IssueReporterData>) => {
this.logService.trace('issueReporter: Received performance data');
this.issueReporterModel.update(info);
this.receivedPerformanceInfo = true;
@@ -103,7 +103,7 @@ export class IssueReporter extends Disposable {
this.updatePreviewButtonState();
});
ipcRenderer.on('vscode:issueSystemInfoResponse', (_, info) => {
ipcRenderer.on('vscode:issueSystemInfoResponse', (_: unknown, info: any) => {
this.logService.trace('issueReporter: Received system data');
this.issueReporterModel.update({ systemInfo: info });
this.receivedSystemInfo = true;
@@ -897,7 +897,7 @@ export class IssueReporter extends Disposable {
return `${repositoryUrl}${queryStringPrefix}title=${encodeURIComponent(issueTitle)}`;
}
private updateSystemInfo = (state) => {
private updateSystemInfo(state: IssueReporterModelData) {
const target = document.querySelector('.block-system .block-info');
if (target) {
let tableHtml = '';
@@ -966,14 +966,14 @@ export class IssueReporter extends Disposable {
}
}
private updateProcessInfo = (state) => {
private updateProcessInfo(state: IssueReporterModelData) {
const target = document.querySelector('.block-process .block-info');
if (target) {
target.innerHTML = `<code>${state.processInfo}</code>`;
}
}
private updateWorkspaceInfo = (state) => {
private updateWorkspaceInfo(state: IssueReporterModelData) {
document.querySelector('.block-workspace .block-info code')!.textContent = '\n' + state.workspaceInfo;
}
@@ -1073,9 +1073,13 @@ export class IssueReporter extends Disposable {
// helper functions
function hide(el) {
el.classList.add('hidden');
function hide(el: Element | undefined | null) {
if (el) {
el.classList.add('hidden');
}
}
function show(el) {
el.classList.remove('hidden');
function show(el: Element | undefined | null) {
if (el) {
el.classList.remove('hidden');
}
}