ref(TS) Improve TS (#13365)

Change some any types to the correct types
This commit is contained in:
Robert Pintilii
2023-05-17 13:05:47 +03:00
committed by GitHub
parent 61e9cacceb
commit 06b67dcf44
21 changed files with 87 additions and 41 deletions

View File

@@ -173,7 +173,15 @@ export function initAnalytics(store: IStore, handlers: Array<Object>) {
const { group, server } = state['features/base/jwt'];
const { locationURL = { href: '' } } = state['features/base/connection'];
const { tenant } = parseURIString(locationURL.href) || {};
const permanentProperties: any = {};
const permanentProperties: {
appName?: string;
externalApi?: boolean;
group?: string;
inIframe?: boolean;
server?: string;
tenant?: string;
websocket?: boolean;
} & typeof deploymentInfo = {};
if (server) {
permanentProperties.server = server;
@@ -202,7 +210,8 @@ export function initAnalytics(store: IStore, handlers: Array<Object>) {
if (deploymentInfo) {
for (const key in deploymentInfo) {
if (deploymentInfo.hasOwnProperty(key)) {
permanentProperties[key] = deploymentInfo[key as keyof typeof deploymentInfo];
permanentProperties[key as keyof typeof deploymentInfo] = deploymentInfo[
key as keyof typeof deploymentInfo];
}
}
}
@@ -235,7 +244,7 @@ export function initAnalytics(store: IStore, handlers: Array<Object>) {
* @returns {Promise} Resolves with the handlers that have been successfully loaded and rejects if there are no handlers
* loaded or the analytics is disabled.
*/
function _loadHandlers(scriptURLs: any[] = [], handlerConstructorOptions: Object) {
function _loadHandlers(scriptURLs: string[] = [], handlerConstructorOptions: Object) {
const promises: Promise<{ error?: Error; type: string; url?: string; }>[] = [];
for (const url of scriptURLs) {