Update return types that can return undefined (#14660)

This commit is contained in:
Charles Gagnon
2021-03-11 10:09:50 -08:00
committed by GitHub
parent 6c877a4e20
commit cf862854c5
2 changed files with 8 additions and 8 deletions

View File

@@ -161,13 +161,13 @@ export interface IConnectionManagementService {
deleteConnectionGroup(group: ConnectionProfileGroup): Promise<boolean>;
getAdvancedProperties(): azdata.ConnectionOption[];
getAdvancedProperties(): azdata.ConnectionOption[] | undefined;
getConnectionUri(connectionProfile: IConnectionProfile): string;
getFormattedUri(uri: string, connectionProfile: IConnectionProfile): string;
getConnectionUriFromId(connectionId: string): string;
getConnectionUriFromId(connectionId: string): string | undefined;
isConnected(fileUri: string): boolean;
@@ -193,7 +193,7 @@ export interface IConnectionManagementService {
addSavedPassword(connectionProfile: IConnectionProfile): Promise<IConnectionProfile>;
listDatabases(connectionUri: string): Thenable<azdata.ListDatabasesResult>;
listDatabases(connectionUri: string): Thenable<azdata.ListDatabasesResult | undefined>;
/**
* Register a connection provider
@@ -204,11 +204,11 @@ export interface IConnectionManagementService {
editGroup(group: ConnectionProfileGroup): Promise<void>;
getConnectionProfile(fileUri: string): IConnectionProfile;
getConnectionProfile(fileUri: string): IConnectionProfile | undefined;
getConnectionInfo(fileUri: string): ConnectionManagementInfo;
getConnectionInfo(fileUri: string): ConnectionManagementInfo | undefined;
getDefaultProviderId(): string;
getDefaultProviderId(): string | undefined;
getUniqueConnectionProvidersByNameMap(providerNameToDisplayNameMap: { [providerDisplayName: string]: string }): { [providerDisplayName: string]: string };

View File

@@ -1218,11 +1218,11 @@ export class ConnectionManagementService extends Disposable implements IConnecti
return this._connectionStatusManager.isConnecting(fileUri);
}
public getConnectionProfile(fileUri: string): interfaces.IConnectionProfile {
public getConnectionProfile(fileUri: string): interfaces.IConnectionProfile | undefined {
return this._connectionStatusManager.isConnected(fileUri) ? this._connectionStatusManager.getConnectionProfile(fileUri) : undefined;
}
public getConnectionInfo(fileUri: string): ConnectionManagementInfo {
public getConnectionInfo(fileUri: string): ConnectionManagementInfo | undefined {
return this._connectionStatusManager.isConnected(fileUri) ? this._connectionStatusManager.findConnection(fileUri) : undefined;
}