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

@@ -26,7 +26,7 @@ export const Extensions = {
export interface IConnectionProviderRegistry {
registerConnectionProvider(id: string, properties: ConnectionProviderProperties): void;
getProperties(id: string): ConnectionProviderProperties;
getProperties(id: string): ConnectionProviderProperties | undefined;
readonly onNewProvider: Event<{ id: string, properties: ConnectionProviderProperties }>;
readonly providers: { [id: string]: ConnectionProviderProperties };
}
@@ -41,7 +41,7 @@ class ConnectionProviderRegistryImpl implements IConnectionProviderRegistry {
this._onNewProvider.fire({ id, properties });
}
public getProperties(id: string): ConnectionProviderProperties {
public getProperties(id: string): ConnectionProviderProperties | undefined {
return this._providers.get(id);
}

View File

@@ -257,7 +257,7 @@ class DataResourceDataProvider implements IGridDataProvider {
return serializer.handleSerialization(this.documentUri, format, (filePath) => this.doSerialize(serializer, filePath, format, selection));
}
private async doSerialize(serializer: ResultSerializer, filePath: string, format: SaveFormat, selection: Slick.Range[]): Promise<SaveResultsResponse> {
private doSerialize(serializer: ResultSerializer, filePath: string, format: SaveFormat, selection: Slick.Range[]): Promise<SaveResultsResponse | undefined> {
// TODO implement selection support
let columns = this.resultSet.columnInfo;
let rowLength = this.rows.length;
@@ -296,8 +296,7 @@ class DataResourceDataProvider implements IGridDataProvider {
getRowRange: (rowStart, numberOfRows) => getRows(rowStart, numberOfRows),
rowCount: rowLength
});
let result = await this._serializationService.serializeResults(serializeRequestParams);
return result;
return this._serializationService.serializeResults(serializeRequestParams);
}
/**

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);