diff --git a/src/api/addServer.ts b/src/api/addServer.ts index b12e713..6da8501 100644 --- a/src/api/addServer.ts +++ b/src/api/addServer.ts @@ -163,7 +163,7 @@ export async function addServer( "intersystems", scope, ); - const serversInspection = config.inspect("servers"); + const serversInspection = config.inspect>>("servers"); const servers = ( target == vscode.ConfigurationTarget.WorkspaceFolder ? serversInspection?.workspaceFolderValue : target == vscode.ConfigurationTarget.Workspace ? serversInspection?.workspaceValue : diff --git a/src/api/getServerNames.ts b/src/api/getServerNames.ts index bb9e217..36d81b1 100644 --- a/src/api/getServerNames.ts +++ b/src/api/getServerNames.ts @@ -1,11 +1,12 @@ import { IServerName } from "@intersystems-community/intersystems-servermanager"; import * as vscode from "vscode"; +import { IServerSetting } from "../serverSetting"; import { serverDetail } from "./getServerSummary"; export function getServerNames(scope?: vscode.ConfigurationScope, sorted?: boolean): IServerName[] { const allNames: IServerName[] = []; const names: IServerName[] = []; - const servers = vscode.workspace.getConfiguration("intersystems", scope).get("servers"); + const servers = vscode.workspace.getConfiguration("intersystems", scope).get & { "/default"?: string }>("servers"); if (typeof servers === "object" && servers) { diff --git a/src/commands/importFromRegistry.ts b/src/commands/importFromRegistry.ts index 7dbeb38..ad37b46 100644 --- a/src/commands/importFromRegistry.ts +++ b/src/commands/importFromRegistry.ts @@ -2,7 +2,7 @@ import * as vscode from "vscode"; import { ServerManagerAuthenticationProvider } from "../authenticationProvider"; // To avoid overhead querying the registry, cache responses (each time the command is run) -const regQueryCache = new Map(); +const regQueryCache = new Map(); export async function importFromRegistry(secretStorage: vscode.SecretStorage, scope?: vscode.ConfigurationScope) { const config = vscode.workspace.getConfiguration("intersystems", scope); @@ -64,7 +64,7 @@ export async function importFromRegistry(secretStorage: vscode.SecretStorage, sc async function loadRegistryData( config: vscode.WorkspaceConfiguration, - serverDefinitions, + serverDefinitions: ServerDefinitions, serversMissingUsernames: string[], newServerNames: string[], ): Promise { @@ -206,6 +206,8 @@ async function promptForUsernames(serverDefinitions: ServerDefinitions, serversM export interface ServerDefinition { username?: string; + description?: string; + webServer?: { scheme: string; host?: string; port: number; pathPrefix?: string }; } export type ServerDefinitions = Record; @@ -269,8 +271,8 @@ async function promptForPasswords(secretStorage: vscode.SecretStorage, serverDef } } -function preloadRegistryCache(cmd, fullPath) { - const regData = cmd.runSync("reg query " + fullPath + " /s"); +function preloadRegistryCache(cmd: any, fullPath: string) { + const regData: { data: string | null } = cmd.runSync("reg query " + fullPath + " /s"); if (!regData.data) { return; } @@ -283,9 +285,9 @@ function preloadRegistryCache(cmd, fullPath) { }); } -function getStringRegKey(cmd, hive, path, key): string | undefined { +function getStringRegKey(cmd: any, hive: string, path: string, key: string): string | undefined { const queryPath = hive + "\\" + path; - const regData = regQueryCache.get(queryPath) || cmd.runSync("reg query " + queryPath); + const regData: { data?: string | null } = regQueryCache.get(queryPath) || cmd.runSync("reg query " + queryPath); if (!regData.data) { return undefined; } diff --git a/src/commonActivate.ts b/src/commonActivate.ts index 99ce8ec..7db54e8 100644 --- a/src/commonActivate.ts +++ b/src/commonActivate.ts @@ -50,7 +50,7 @@ export class BasicAuthorization implements Authorization { return this.username !== "" && this.#password !== undefined; } - public resolve({ accessToken, username }): this is ResolvedAuthorization { + public resolve({ accessToken, username }: { accessToken?: string; username?: string }): this is ResolvedAuthorization { this.#username = username ?? this.#username; this.#password = accessToken ?? this.#password; return this.resolved(); @@ -92,7 +92,7 @@ export class OAuth2Authorization implements Authorization { return this.#bearer ? true : false; } - public resolve({ accessToken, username }): this is ResolvedAuthorization { + public resolve({ accessToken, username }: { accessToken?: string; username?: string }): this is ResolvedAuthorization { // empty accessTokens are ignored. if (accessToken) { this.#bearer = accessToken; diff --git a/src/makeRESTRequest.ts b/src/makeRESTRequest.ts index f9d9540..fc105fd 100644 --- a/src/makeRESTRequest.ts +++ b/src/makeRESTRequest.ts @@ -72,7 +72,7 @@ export async function makeRESTRequest( url += "v" + String(endpoint.apiVersion) + "/" + endpoint.namespace + endpoint.path; } - const request: AxiosRequestConfig & { headers: {}, data?: any } = { + const request: AxiosRequestConfig & { headers: {}, data?: any, [key: string]: any } = { httpsAgent, headers: {}, method, @@ -206,11 +206,11 @@ async function resolveCredentials(spec: IServerSpec & { auth: Authorization }): * If `error` is `undefined`, returns the empty string. * Borrowed from `vscode-objectscript:/src/utils/index.ts` */ -function stringifyError(error): string { +function stringifyError(error: any): string { try { if (Array.isArray(error?.errors)) { // Need to stringify the inner errors of an AggregateError - const errs = error.errors.map(stringifyError).filter((s) => s != ""); + const errs = error.errors.map(stringifyError).filter((s: string) => s != ""); return errs.length ? `AggregateError:\n- ${errs.join("\n- ")}` : ""; } return ( diff --git a/src/test/runTest.ts b/src/test/runTest.ts index a93191f..cc176e9 100644 --- a/src/test/runTest.ts +++ b/src/test/runTest.ts @@ -12,7 +12,7 @@ async function main() { // Passed to --extensionTestsPath const extensionTestsPath = path.resolve(__dirname, "./suite/index"); - const launchArgs = []; + const launchArgs: string[] = []; // Download VS Code, unzip it and run the integration test await runTests({ extensionDevelopmentPath, extensionTestsPath, launchArgs }); diff --git a/src/ui/serverManagerView.ts b/src/ui/serverManagerView.ts index 44101f1..33b343b 100644 --- a/src/ui/serverManagerView.ts +++ b/src/ui/serverManagerView.ts @@ -649,7 +649,7 @@ async function namespaceProjects(element: ProjectsTreeItem, params?: ServerParam vscode.window.showErrorMessage(message); return undefined; } - response.data.result.content.map((project) => { + response.data.result.content.map((project: { Name: string; Description: string }) => { children.push(new ProjectTreeItem({ parent: element, label: name, id: name }, project.Name, project.Description, params.serverApiVersion!)); }); } diff --git a/tsconfig.json b/tsconfig.json index 13da9b4..e3a6b4e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "module": "commonjs", "target": "es2019", - "noImplicitAny": false, + "noImplicitAny": true, "removeComments": false, "noUnusedLocals": true, "noImplicitThis": true,