Annotate more usage before assign strict null errors

This commit is contained in:
Matt Bierner
2019-02-19 14:11:29 -08:00
parent e9a1cea1fd
commit 7e759cf3c8
8 changed files with 16 additions and 16 deletions

View File

@@ -233,7 +233,7 @@ function convertFromCommentThread(commentThread: modes.CommentThread): vscode.Co
}
function convertFromComment(comment: modes.Comment): vscode.Comment {
let userIconPath: URI;
let userIconPath: URI | undefined;
if (comment.userIconPath) {
try {
userIconPath = URI.parse(comment.userIconPath);

View File

@@ -363,7 +363,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
if (!this._variableResolver) {
this._variableResolver = new ExtHostVariableResolverService(workspaceProvider, this._editorsService, configProvider);
}
let ws: IWorkspaceFolder;
let ws: IWorkspaceFolder | undefined;
const folder = this.getFolder(folderUri, workspaceProvider);
if (folder) {
ws = {

View File

@@ -120,7 +120,7 @@ export class DiagnosticCollection implements vscode.DiagnosticCollection {
// compute change and send to main side
const entries: [URI, IMarkerData[]][] = [];
for (let uri of toSync) {
let marker: IMarkerData[];
let marker: IMarkerData[] | undefined;
let diagnostics = this._data.get(uri.toString());
if (diagnostics) {

View File

@@ -13,7 +13,7 @@ import * as typeConverter from 'vs/workbench/api/node/extHostTypeConverters';
import { ExtHostLanguageFeatures } from 'vs/workbench/api/node/extHostLanguageFeatures';
import { Schemas } from 'vs/base/common/network';
import { ResourceLabelFormatter } from 'vs/platform/label/common/label';
import { State, StateMachine, LinkComputer } from 'vs/editor/common/modes/linkComputer';
import { State, StateMachine, LinkComputer, Edge } from 'vs/editor/common/modes/linkComputer';
import { commonPrefixLength } from 'vs/base/common/strings';
import { CharCode } from 'vs/base/common/charCode';
@@ -41,8 +41,8 @@ class FsLinkProvider {
// sort and compute common prefix with previous scheme
// then build state transitions based on the data
const schemes = this._schemes.sort();
const edges = [];
let prevScheme: string;
const edges: Edge[] = [];
let prevScheme: string | undefined;
let prevState: State;
let nextState = State.LastKnownState;
for (const scheme of schemes) {
@@ -178,7 +178,7 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
// dropping events for wrong scheme
continue;
}
let newType: files.FileChangeType;
let newType: files.FileChangeType | undefined;
switch (type) {
case FileChangeType.Changed:
newType = files.FileChangeType.UPDATED;

View File

@@ -150,7 +150,7 @@ namespace ShellExecutionDTO {
namespace TaskHandleDTO {
export function from(value: types.Task): TaskHandleDTO {
let folder: UriComponents;
let folder: UriComponents | undefined;
if (value.scope !== undefined && typeof value.scope !== 'number') {
folder = value.scope.uri;
}
@@ -181,7 +181,7 @@ namespace TaskDTO {
if (value === undefined || value === null) {
return undefined;
}
let execution: ShellExecutionDTO | ProcessExecutionDTO;
let execution: ShellExecutionDTO | ProcessExecutionDTO | undefined;
if (value.execution instanceof types.ProcessExecution) {
execution = ProcessExecutionDTO.from(value.execution);
} else if (value.execution instanceof types.ShellExecution) {
@@ -226,14 +226,14 @@ namespace TaskDTO {
if (value === undefined || value === null) {
return undefined;
}
let execution: types.ShellExecution | types.ProcessExecution;
let execution: types.ShellExecution | types.ProcessExecution | undefined;
if (ProcessExecutionDTO.is(value.execution)) {
execution = ProcessExecutionDTO.to(value.execution);
} else if (ShellExecutionDTO.is(value.execution)) {
execution = ShellExecutionDTO.to(value.execution);
}
let definition: vscode.TaskDefinition = TaskDefinitionDTO.to(value.definition);
let scope: vscode.TaskScope.Global | vscode.TaskScope.Workspace | vscode.WorkspaceFolder;
let scope: vscode.TaskScope.Global | vscode.TaskScope.Workspace | vscode.WorkspaceFolder | undefined;
if (value.source) {
if (value.source.scope !== undefined) {
if (typeof value.source.scope === 'number') {