mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-02 09:35:40 -05:00
strict null checks azure (#11928)
* strict null checks azure * strict compilation * Fix compilation issues * Return empty arrays instead
This commit is contained in:
@@ -51,7 +51,7 @@ export interface IConnectionCompletionOptions {
|
||||
/**
|
||||
* Parameters to be used if connecting from an editor
|
||||
*/
|
||||
params: INewConnectionParams;
|
||||
params?: INewConnectionParams;
|
||||
|
||||
/**
|
||||
* Open the connection dialog if connection fails
|
||||
@@ -107,12 +107,12 @@ export interface IConnectionManagementService {
|
||||
/**
|
||||
* Opens the connection dialog to create new connection
|
||||
*/
|
||||
showConnectionDialog(params?: INewConnectionParams, options?: IConnectionCompletionOptions, model?: IConnectionProfile, connectionResult?: IConnectionResult): Promise<void>;
|
||||
showConnectionDialog(params?: INewConnectionParams, options?: IConnectionCompletionOptions, model?: Partial<IConnectionProfile>, connectionResult?: IConnectionResult): Promise<void>;
|
||||
|
||||
/**
|
||||
* Load the password and opens a new connection
|
||||
*/
|
||||
connect(connection: IConnectionProfile, uri: string, options?: IConnectionCompletionOptions, callbacks?: IConnectionCallbacks): Promise<IConnectionResult>;
|
||||
connect(connection: IConnectionProfile, uri?: string, options?: IConnectionCompletionOptions, callbacks?: IConnectionCallbacks): Promise<IConnectionResult>;
|
||||
|
||||
/**
|
||||
* Opens a new connection and save the profile in settings
|
||||
@@ -183,7 +183,7 @@ export interface IConnectionManagementService {
|
||||
|
||||
isRecent(connectionProfile: ConnectionProfile): boolean;
|
||||
|
||||
isConnected(fileUri: string, connectionProfile?: ConnectionProfile): boolean;
|
||||
isConnected(fileUri?: string, connectionProfile?: ConnectionProfile): boolean;
|
||||
|
||||
disconnectEditor(owner: IConnectableInput, force?: boolean): Promise<boolean>;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ export class ConnectionProfile extends ProviderConnectionInfo implements interfa
|
||||
|
||||
public constructor(
|
||||
capabilitiesService: ICapabilitiesService,
|
||||
model: string | azdata.IConnectionProfile) {
|
||||
model: string | azdata.IConnectionProfile | undefined) {
|
||||
super(capabilitiesService, model);
|
||||
if (model && !isString(model)) {
|
||||
this.groupId = model.groupId;
|
||||
|
||||
@@ -18,7 +18,7 @@ export interface INewConnectionProfileGroup {
|
||||
}
|
||||
|
||||
export interface IConnectionProfileGroup extends INewConnectionProfileGroup {
|
||||
id: string;
|
||||
id?: string;
|
||||
}
|
||||
|
||||
export class ConnectionProfileGroup extends Disposable implements IConnectionProfileGroup {
|
||||
@@ -30,8 +30,8 @@ export class ConnectionProfileGroup extends Disposable implements IConnectionPro
|
||||
public readonly isRoot: boolean = false;
|
||||
public constructor(
|
||||
public name: string,
|
||||
public parent: ConnectionProfileGroup | undefined,
|
||||
public id: string,
|
||||
public parent?: ConnectionProfileGroup,
|
||||
public id?: string,
|
||||
public color?: string,
|
||||
public description?: string
|
||||
) {
|
||||
|
||||
@@ -289,7 +289,7 @@ export class ConnectionStore {
|
||||
if (children) {
|
||||
children.map(group => {
|
||||
let connectionGroup = new ConnectionProfileGroup(group.name, parent, group.id, group.color, group.description);
|
||||
this.addGroupFullNameToMap(group.id, connectionGroup.fullName);
|
||||
this.addGroupFullNameToMap(group.id!, connectionGroup.fullName);
|
||||
if (connections) {
|
||||
let connectionsForGroup = connections.filter(conn => conn.groupId === connectionGroup.id);
|
||||
let conns: ConnectionProfile[] = [];
|
||||
|
||||
@@ -27,7 +27,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
||||
|
||||
public constructor(
|
||||
protected capabilitiesService: ICapabilitiesService,
|
||||
model: string | azdata.IConnectionProfile
|
||||
model: string | azdata.IConnectionProfile | undefined
|
||||
) {
|
||||
super();
|
||||
// we can't really do a whole lot if we don't have a provider
|
||||
@@ -61,7 +61,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
||||
*/
|
||||
private updateSpecialValueType(typeName: SettableProperty, model: azdata.IConnectionProfile): void {
|
||||
if (!this[typeName]) {
|
||||
this[typeName] = model[typeName];
|
||||
this[typeName] = model[typeName]!;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ suite('SQL ConnectionProfileInfo tests', () => {
|
||||
test('set properties should set the values correctly', () => {
|
||||
let conn = new ConnectionProfile(capabilitiesService, undefined!);
|
||||
assert.equal(conn.serverName, undefined);
|
||||
conn.connectionName = connectionProfile.connectionName;
|
||||
conn.connectionName = connectionProfile.connectionName!;
|
||||
conn.serverName = connectionProfile.serverName;
|
||||
conn.databaseName = connectionProfile.databaseName;
|
||||
conn.authenticationType = connectionProfile.authenticationType;
|
||||
|
||||
@@ -139,7 +139,7 @@ suite('SQL ProviderConnectionInfo tests', () => {
|
||||
test('set properties should set the values correctly', () => {
|
||||
let conn = new ProviderConnectionInfo(capabilitiesService, mssqlProviderName);
|
||||
assert.equal(conn.serverName, undefined);
|
||||
conn.connectionName = connectionProfile.connectionName;
|
||||
conn.connectionName = connectionProfile.connectionName!;
|
||||
conn.serverName = connectionProfile.serverName;
|
||||
conn.databaseName = connectionProfile.databaseName;
|
||||
conn.authenticationType = connectionProfile.authenticationType;
|
||||
|
||||
Reference in New Issue
Block a user