Skip to content

Commit 5acd78e

Browse files
committed
Strict null checks
1 parent cb05d8f commit 5acd78e

4 files changed

Lines changed: 12 additions & 10 deletions

File tree

src/tsconfig.strictNullChecks.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@
121121
"./vs/code/electron-main/keyboard.ts",
122122
"./vs/code/electron-main/sharedProcess.ts",
123123
"./vs/code/electron-main/theme.ts",
124+
"./vs/code/node/cli.ts",
124125
"./vs/code/node/paths.ts",
125126
"./vs/code/node/shellEnv.ts",
126127
"./vs/code/node/wait.ts",
@@ -702,7 +703,8 @@
702703
"./vs/workbench/services/themes/common/workbenchThemeService.ts",
703704
"./vs/workbench/services/title/common/titleService.ts",
704705
"./vs/workbench/services/workspace/common/workspaceEditing.ts",
705-
"./vs/workbench/test/electron-browser/api/mock.ts"
706+
"./vs/workbench/test/electron-browser/api/mock.ts",
707+
"./vs/platform/backup/electron-main/backupMainService.ts"
706708
],
707709
"exclude": [
708710
"./typings/require-monaco.d.ts"

src/vs/code/node/cli.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export async function main(argv: string[]): Promise<any> {
7777
try {
7878

7979
// Check for readonly status and chmod if so if we are told so
80-
let targetMode: number;
80+
let targetMode: number = 0;
8181
let restoreMode = false;
8282
if (!!args['file-chmod']) {
8383
targetMode = fs.statSync(target).mode;
@@ -132,11 +132,11 @@ export async function main(argv: string[]): Promise<any> {
132132
child.stdout.on('data', (data: Buffer) => console.log(data.toString('utf8').trim()));
133133
child.stderr.on('data', (data: Buffer) => console.log(data.toString('utf8').trim()));
134134

135-
return new TPromise<void>(c => child.once('exit', () => c()));
135+
return new TPromise<void>(c => child.once('exit', () => c(void 0)));
136136
});
137137
}
138138

139-
let stdinWithoutTty: boolean;
139+
let stdinWithoutTty: boolean = false;
140140
try {
141141
stdinWithoutTty = !process.stdin.isTTY; // Via https://twitter.com/MylesBorins/status/782009479382626304
142142
} catch (error) {
@@ -162,7 +162,7 @@ export async function main(argv: string[]): Promise<any> {
162162
stdinFilePath = paths.join(os.tmpdir(), `code-stdin-${Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 3)}.txt`);
163163

164164
// open tmp file for writing
165-
let stdinFileError: Error;
165+
let stdinFileError: Error | undefined;
166166
let stdinFileStream: fs.WriteStream;
167167
try {
168168
stdinFileStream = fs.createWriteStream(stdinFilePath);
@@ -227,7 +227,7 @@ export async function main(argv: string[]): Promise<any> {
227227
// and pass it over to the starting instance. We can use this file
228228
// to wait for it to be deleted to monitor that the edited file
229229
// is closed and then exit the waiting process.
230-
let waitMarkerFilePath: string;
230+
let waitMarkerFilePath: string | undefined;
231231
if (args.wait) {
232232
waitMarkerFilePath = await createWaitMarkerFile(verbose);
233233
if (waitMarkerFilePath) {
@@ -361,10 +361,10 @@ export async function main(argv: string[]): Promise<any> {
361361
return new TPromise<void>(c => {
362362

363363
// Complete when process exits
364-
child.once('exit', () => c(null));
364+
child.once('exit', () => c(void 0));
365365

366366
// Complete when wait marker file is deleted
367-
whenDeleted(waitMarkerFilePath).then(c, c);
367+
whenDeleted(waitMarkerFilePath!).then(c, c);
368368
}).then(() => {
369369

370370
// Make sure to delete the tmp stdin file if we have any

src/vs/platform/backup/electron-main/backupMainService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ export class BackupMainService implements IBackupMainService {
182182
this.rootWorkspaces = this.validateWorkspaces(backups.rootWorkspaces);
183183

184184
// read folder backups
185-
let workspaceFolders: URI[];
185+
let workspaceFolders: URI[] = [];
186186
try {
187187
if (Array.isArray(backups.folderURIWorkspaces)) {
188188
workspaceFolders = backups.folderURIWorkspaces.map(f => URI.parse(f));

src/vs/platform/configuration/node/configuration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class UserConfiguration extends Disposable {
3737
}
3838

3939
reload(): Promise<void> {
40-
return new Promise(c => this.userConfigModelWatcher.reload(() => c(null)));
40+
return new Promise<void>(c => this.userConfigModelWatcher.reload(() => c()));
4141
}
4242

4343
}

0 commit comments

Comments
 (0)