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

@@ -104,27 +104,27 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
}
public get connectionName(): string {
return this.getSpecialTypeOptionValue(ConnectionOptionSpecialType.connectionName);
return this.getSpecialTypeOptionValue(ConnectionOptionSpecialType.connectionName)!;
}
public get serverName(): string {
return this.getSpecialTypeOptionValue(ConnectionOptionSpecialType.serverName);
return this.getSpecialTypeOptionValue(ConnectionOptionSpecialType.serverName)!;
}
public get databaseName(): string {
return this.getSpecialTypeOptionValue(ConnectionOptionSpecialType.databaseName);
return this.getSpecialTypeOptionValue(ConnectionOptionSpecialType.databaseName)!;
}
public get userName(): string {
return this.getSpecialTypeOptionValue(ConnectionOptionSpecialType.userName);
return this.getSpecialTypeOptionValue(ConnectionOptionSpecialType.userName)!;
}
public get password(): string {
return this.getSpecialTypeOptionValue(ConnectionOptionSpecialType.password);
return this.getSpecialTypeOptionValue(ConnectionOptionSpecialType.password)!;
}
public get authenticationType(): string {
return this.getSpecialTypeOptionValue(ConnectionOptionSpecialType.authType);
return this.getSpecialTypeOptionValue(ConnectionOptionSpecialType.authType)!;
}
public set connectionName(value: string) {
@@ -206,7 +206,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
return isPasswordRequired;
}
private getSpecialTypeOptionValue(type: string): string {
private getSpecialTypeOptionValue(type: string): string | undefined {
let name = this.getSpecialTypeOptionName(type);
if (name) {
return this.options[name];
@@ -243,7 +243,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
let idValues: string[] = [];
for (let index = 0; index < idNames.length; index++) {
let value = this.options[idNames[index]];
let value = this.options[idNames[index]!];
value = value ? value : '';
idValues.push(`${idNames[index]}${ProviderConnectionInfo.nameValueSeparator}${value}`);
}
@@ -266,7 +266,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
return providerId;
}
public getSpecialTypeOptionName(type: string): string {
public getSpecialTypeOptionName(type: string): string | undefined {
if (this._serverCapabilities) {
let optionMetadata = this._serverCapabilities.connectionOptions.find(o => o.specialValueType === type);
return !!optionMetadata ? optionMetadata.name : undefined;