Add more areas to strict null (#7243)

* add more areas to strict null

* fix compile errors

* fix tests

* fix checks

* address PR comments
This commit is contained in:
Anthony Dresser
2019-09-18 12:27:19 -07:00
committed by GitHub
parent 373828d76f
commit aad9c0f965
35 changed files with 193 additions and 184 deletions

View File

@@ -32,7 +32,7 @@ let prevSavePath: string;
export interface SaveResultsResponse {
succeeded: boolean;
messages: string;
messages?: string;
}
interface ICsvConfig {
@@ -94,7 +94,7 @@ export class ResultSerializer {
/**
* Handle save request by getting filename from user and sending request to service
*/
public handleSerialization(uri: string, format: SaveFormat, sendRequest: ((filePath: string) => Promise<SaveResultsResponse>)): Thenable<void> {
public handleSerialization(uri: string, format: SaveFormat, sendRequest: ((filePath: string) => Promise<SaveResultsResponse | undefined>)): Thenable<void> {
const self = this;
return this.promptForFilepath(format, uri).then(filePath => {
if (filePath) {
@@ -103,7 +103,7 @@ export class ResultSerializer {
}
return self.doSave(filePath, format, () => sendRequest(filePath));
}
return Promise.resolve(undefined);
return Promise.resolve();
});
}
@@ -331,19 +331,19 @@ export class ResultSerializer {
/**
* Send request to sql tools service to save a result set
*/
private async doSave(filePath: string, format: string, sendRequest: () => Promise<SaveResultsResponse>): Promise<void> {
private async doSave(filePath: string, format: string, sendRequest: () => Promise<SaveResultsResponse | undefined>): Promise<void> {
this.logToOutputChannel(LocalizedConstants.msgSaveStarted + filePath);
// send message to the sqlserverclient for converting results to the requested format and saving to filepath
try {
let result = await sendRequest();
if (result.messages) {
if (!result || result.messages) {
this._notificationService.notify({
severity: Severity.Error,
message: LocalizedConstants.msgSaveFailed + result.messages
message: LocalizedConstants.msgSaveFailed + (result ? result.messages : '')
});
this.logToOutputChannel(LocalizedConstants.msgSaveFailed + result.messages);
this.logToOutputChannel(LocalizedConstants.msgSaveFailed + (result ? result.messages : ''));
} else {
this.promptFileSavedNotification(filePath);
this.logToOutputChannel(LocalizedConstants.msgSaveSucceeded + filePath);