Add type for Document in sql database projects (#17539)

This commit is contained in:
Kim Santiago
2021-11-02 13:17:18 -07:00
committed by GitHub
parent 8c3c18e8dc
commit 312b410fff
4 changed files with 96 additions and 95 deletions

View File

@@ -39,14 +39,14 @@ export async function readPublishProfile(profileUri: vscode.Uri): Promise<Publis
*/
export async function load(profileUri: vscode.Uri, dacfxService: utils.IDacFxService): Promise<PublishProfile> {
const profileText = await fs.readFile(profileUri.fsPath);
const profileXmlDoc = new xmldom.DOMParser().parseFromString(profileText.toString());
const profileXmlDoc: Document = new xmldom.DOMParser().parseFromString(profileText.toString());
// read target database name
let targetDbName: string = '';
let targetDatabaseNameCount = profileXmlDoc.documentElement.getElementsByTagName(constants.targetDatabaseName).length;
if (targetDatabaseNameCount > 0) {
// if there is more than one TargetDatabaseName nodes, SSDT uses the name in the last one so we'll do the same here
targetDbName = profileXmlDoc.documentElement.getElementsByTagName(constants.targetDatabaseName)[targetDatabaseNameCount - 1].textContent;
targetDbName = profileXmlDoc.documentElement.getElementsByTagName(constants.targetDatabaseName)[targetDatabaseNameCount - 1].textContent!;
}
const connectionInfo = await readConnectionString(profileXmlDoc);