Typescript upgrade to 4.6.2 (#126935) (#127163)

(cherry picked from commit 192309fc27)

Co-authored-by: Spencer <spencer@elastic.co>
This commit is contained in:
Kibana Machine 2022-03-08 14:20:57 -05:00 committed by GitHub
parent 28088b75a9
commit eb178a860b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 101 additions and 118 deletions

View file

@ -92,7 +92,7 @@
"**/react-syntax-highlighter/**/highlight.js": "^10.4.1",
"**/refractor/prismjs": "~1.27.0",
"**/trim": "1.0.1",
"**/typescript": "4.5.3",
"**/typescript": "4.6.2",
"**/underscore": "^1.13.1",
"globby/fast-glob": "3.2.7",
"puppeteer/node-fetch": "^2.6.7"
@ -565,7 +565,7 @@
"@types/js-levenshtein": "^1.1.0",
"@types/js-search": "^1.4.0",
"@types/js-yaml": "^3.11.1",
"@types/jsdom": "^16.2.13",
"@types/jsdom": "^16.2.14",
"@types/json-stable-stringify": "^1.0.32",
"@types/json5": "^0.0.30",
"@types/kbn__ace": "link:bazel-bin/packages/kbn-ace/npm_module_types",
@ -707,9 +707,9 @@
"@types/yargs": "^15.0.0",
"@types/yauzl": "^2.9.1",
"@types/zen-observable": "^0.8.0",
"@typescript-eslint/eslint-plugin": "^5.6.0",
"@typescript-eslint/parser": "^5.6.0",
"@typescript-eslint/typescript-estree": "^5.6.0",
"@typescript-eslint/eslint-plugin": "^5.13.0",
"@typescript-eslint/parser": "^5.13.0",
"@typescript-eslint/typescript-estree": "^5.13.0",
"@yarnpkg/lockfile": "^1.1.0",
"abab": "^2.0.4",
"aggregate-error": "^3.1.0",
@ -881,7 +881,7 @@
"ts-loader": "^7.0.5",
"ts-morph": "^13.0.2",
"tsd": "^0.13.1",
"typescript": "4.5.3",
"typescript": "4.6.2",
"unlazy-loader": "^0.1.3",
"url-loader": "^2.2.0",
"val-loader": "^1.1.1",

View file

@ -122,7 +122,7 @@ export class ActionTypeRegistry {
)
);
}
this.actionTypes.set(actionType.id, { ...actionType } as ActionType);
this.actionTypes.set(actionType.id, { ...actionType } as unknown as ActionType);
this.taskManager.registerTaskDefinitions({
[`actions:${actionType.id}`]: {
title: actionType.name,
@ -141,7 +141,7 @@ export class ActionTypeRegistry {
// No need to notify usage on basic action types
if (actionType.minimumLicenseRequired !== 'basic') {
this.licensing.featureUsage.register(
getActionTypeFeatureUsageName(actionType as ActionType),
getActionTypeFeatureUsageName(actionType as unknown as ActionType),
actionType.minimumLicenseRequired
);
}

View file

@ -14,8 +14,15 @@ import { AbstractGeoFileImporter } from '../abstract_geo_file_importer';
export const GEOJSON_FILE_TYPES = ['.json', '.geojson'];
interface LoaderBatch {
bytesUsed?: number;
batchType?: string;
container?: Feature;
data?: Feature[];
}
export class GeoJsonImporter extends AbstractGeoFileImporter {
private _iterator?: Iterator<unknown>;
private _iterator?: AsyncIterator<LoaderBatch>;
private _prevBatchLastFeature?: Feature;
protected async _readNext(prevTotalFeaturesRead: number, prevTotalBytesRead: number) {
@ -49,24 +56,28 @@ export class GeoJsonImporter extends AbstractGeoFileImporter {
return results;
}
if ('bytesUsed' in batch) {
if (batch.bytesUsed) {
results.bytesRead = batch.bytesUsed - prevTotalBytesRead;
}
const features: unknown[] = this._prevBatchLastFeature ? [this._prevBatchLastFeature] : [];
const features: Feature[] = this._prevBatchLastFeature ? [this._prevBatchLastFeature] : [];
this._prevBatchLastFeature = undefined;
const isLastBatch = batch.batchType === 'root-object-batch-complete';
if (isLastBatch) {
// Handle single feature geoJson
if (featureIndex === 0) {
features.push(batch.container);
if (batch.container) {
features.push(batch.container);
}
}
} else {
features.push(...batch.data);
if (batch.data) {
features.push(...batch.data);
}
}
for (let i = 0; i < features.length; i++) {
const feature = features[i] as Feature;
const feature = features[i];
if (!isLastBatch && i === features.length - 1) {
// Do not process last feature until next batch is read, features on batch boundary may be incomplete.
this._prevBatchLastFeature = feature;

View file

@ -1,36 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
Cypress.Commands.add('getBySel', (selector, ...args) =>
cy.get(`[data-test-subj=${selector}]`, ...args)
);

View file

@ -22,27 +22,25 @@
// https://on.cypress.io/configuration
// ***********************************************************
// force ESM in this module
export {};
// eslint-disable-next-line import/no-extraneous-dependencies
import 'cypress-react-selector';
// Import commands.js using ES2015 syntax:
import './commands';
// import './coverage';
declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace Cypress {
interface Chainable {
getBySel: typeof cy.get;
getBySel(...args: Parameters<Cypress.Chainable['get']>): Chainable<JQuery<HTMLElement>>;
}
}
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function getBySel(selector: string, ...args: any[]) {
return cy.get(`[data-test-subj=${selector}]`, ...args);
}
Cypress.Commands.add('getBySel', getBySel);
Cypress.Commands.add('getBySel', (selector, ...args) =>
cy.get(`[data-test-subj="${selector}"]`, ...args)
);
// Alternatively you can use CommonJS syntax:
// require('./commands')

View file

@ -15,7 +15,6 @@ import {
import { errors } from '@elastic/elasticsearch';
import { i18n } from '@kbn/i18n';
import { ElasticsearchClient } from 'src/core/server';
import { PromiseType } from 'utility-types';
import { ReportingCore } from '../../';
import { REPORTING_SYSTEM_INDEX } from '../../../common/constants';
import { ReportApiJSON, ReportSource } from '../../../common/types';
@ -61,7 +60,7 @@ export function jobsQueryFactory(reportingCore: ReportingCore): JobsQueryFactory
}
async function execQuery<
T extends (client: ElasticsearchClient) => Promise<PromiseType<ReturnType<T>> | undefined>
T extends (client: ElasticsearchClient) => Promise<Awaited<ReturnType<T>> | undefined>
>(callback: T): Promise<Awaited<ReturnType<T>> | undefined> {
try {
const { asInternalUser: client } = await reportingCore.getEsClient();

View file

@ -18,7 +18,7 @@ export async function extract(archivePath: string, targetPath: string) {
unpacker = unzip;
break;
default:
throw new ExtractError(`Unable to unpack filetype: ${fileType}`);
throw new ExtractError(new Error(`Unable to unpack filetype: ${fileType}`));
}
await unpacker(archivePath, targetPath);

View file

@ -6,9 +6,9 @@
*/
export class ExtractError extends Error {
public readonly cause: string;
public readonly cause: Error;
constructor(cause: string, message = 'Failed to extract the browser archive') {
constructor(cause: Error, message = 'Failed to extract the browser archive') {
super(message);
this.message = message;
this.name = this.constructor.name;

View file

@ -107,6 +107,7 @@ export const sideEffectSimulatorFactory: () => SideEffectSimulator = () => {
contentRect,
borderBoxSize: [{ inlineSize: 0, blockSize: 0 }],
contentBoxSize: [{ inlineSize: 0, blockSize: 0 }],
devicePixelContentBoxSize: [],
},
];
this.callback(entries, this);

118
yarn.lock
View file

@ -6735,10 +6735,10 @@
resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-3.12.1.tgz#5c6f4a1eabca84792fbd916f0cb40847f123c656"
integrity sha512-SGGAhXLHDx+PK4YLNcNGa6goPf9XRWQNAUUbffkwVGGXIxmDKWyGGL4inzq2sPmExu431Ekb9aEMn9BkPqEYFA==
"@types/jsdom@^16.2.13":
version "16.2.13"
resolved "https://registry.yarnpkg.com/@types/jsdom/-/jsdom-16.2.13.tgz#126c8b7441b159d6234610a48de77b6066f1823f"
integrity sha512-8JQCjdeAidptSsOcRWk2iTm9wCcwn9l+kRG6k5bzUacrnm1ezV4forq0kWjUih/tumAeoG+OspOvQEbbRucBTw==
"@types/jsdom@^16.2.14":
version "16.2.14"
resolved "https://registry.yarnpkg.com/@types/jsdom/-/jsdom-16.2.14.tgz#26fe9da6a8870715b154bb84cd3b2e53433d8720"
integrity sha512-6BAy1xXEmMuHeAJ4Fv4yXKwBDTGTOseExKE3OaHiNycdHdZw59KfYzrt0DkDluvwmik1HRt6QS7bImxUmpSy+w==
dependencies:
"@types/node" "*"
"@types/parse5" "*"
@ -7888,13 +7888,14 @@
resolved "https://registry.yarnpkg.com/@types/zen-observable/-/zen-observable-0.8.0.tgz#8b63ab7f1aa5321248aad5ac890a485656dcea4d"
integrity sha512-te5lMAWii1uEJ4FwLjzdlbw3+n0FZNOvFXHxQDKeT0dilh7HOzdMzV2TrJVUzq8ep7J4Na8OUYPRLSQkJHAlrg==
"@typescript-eslint/eslint-plugin@^5.6.0":
version "5.7.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.7.0.tgz#12d54709f8ea1da99a01d8a992cd0474ad0f0aa9"
integrity sha512-8RTGBpNn5a9M628wBPrCbJ+v3YTEOE2qeZb7TDkGKTDXSj36KGRg92SpFFaR/0S3rSXQxM0Og/kV9EyadsYSBg==
"@typescript-eslint/eslint-plugin@^5.13.0":
version "5.13.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.13.0.tgz#2809052b85911ced9c54a60dac10e515e9114497"
integrity sha512-vLktb2Uec81fxm/cfz2Hd6QaWOs8qdmVAZXLdOBX6JFJDhf6oDZpMzZ4/LZ6SFM/5DgDcxIMIvy3F+O9yZBuiQ==
dependencies:
"@typescript-eslint/experimental-utils" "5.7.0"
"@typescript-eslint/scope-manager" "5.7.0"
"@typescript-eslint/scope-manager" "5.13.0"
"@typescript-eslint/type-utils" "5.13.0"
"@typescript-eslint/utils" "5.13.0"
debug "^4.3.2"
functional-red-black-tree "^1.0.1"
ignore "^5.1.8"
@ -7902,18 +7903,6 @@
semver "^7.3.5"
tsutils "^3.21.0"
"@typescript-eslint/experimental-utils@5.7.0":
version "5.7.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-5.7.0.tgz#2b1633e6613c3238036156f70c32634843ad034f"
integrity sha512-u57eZ5FbEpzN5kSjmVrSesovWslH2ZyNPnaXQMXWgH57d5+EVHEt76W75vVuI9qKZ5BMDKNfRN+pxcPEjQjb2A==
dependencies:
"@types/json-schema" "^7.0.9"
"@typescript-eslint/scope-manager" "5.7.0"
"@typescript-eslint/types" "5.7.0"
"@typescript-eslint/typescript-estree" "5.7.0"
eslint-scope "^5.1.1"
eslint-utils "^3.0.0"
"@typescript-eslint/experimental-utils@^4.0.1":
version "4.31.2"
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.31.2.tgz#98727a9c1e977dd5d20c8705e69cd3c2a86553fa"
@ -7926,14 +7915,14 @@
eslint-scope "^5.1.1"
eslint-utils "^3.0.0"
"@typescript-eslint/parser@^5.6.0":
version "5.7.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.7.0.tgz#4dca6de463d86f02d252e681136a67888ea3b181"
integrity sha512-m/gWCCcS4jXw6vkrPQ1BjZ1vomP01PArgzvauBqzsoZ3urLbsRChexB8/YV8z9HwE3qlJM35FxfKZ1nfP/4x8g==
"@typescript-eslint/parser@^5.13.0":
version "5.13.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.13.0.tgz#0394ed8f2f849273c0bf4b811994d177112ced5c"
integrity sha512-GdrU4GvBE29tm2RqWOM0P5QfCtgCyN4hXICj/X9ibKED16136l9ZpoJvCL5pSKtmJzA+NRDzQ312wWMejCVVfg==
dependencies:
"@typescript-eslint/scope-manager" "5.7.0"
"@typescript-eslint/types" "5.7.0"
"@typescript-eslint/typescript-estree" "5.7.0"
"@typescript-eslint/scope-manager" "5.13.0"
"@typescript-eslint/types" "5.13.0"
"@typescript-eslint/typescript-estree" "5.13.0"
debug "^4.3.2"
"@typescript-eslint/scope-manager@4.31.2":
@ -7944,23 +7933,32 @@
"@typescript-eslint/types" "4.31.2"
"@typescript-eslint/visitor-keys" "4.31.2"
"@typescript-eslint/scope-manager@5.7.0":
version "5.7.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.7.0.tgz#70adf960e5a58994ad50438ba60d98ecadd79452"
integrity sha512-7mxR520DGq5F7sSSgM0HSSMJ+TFUymOeFRMfUfGFAVBv8BR+Jv1vHgAouYUvWRZeszVBJlLcc9fDdktxb5kmxA==
"@typescript-eslint/scope-manager@5.13.0":
version "5.13.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.13.0.tgz#cf6aff61ca497cb19f0397eea8444a58f46156b6"
integrity sha512-T4N8UvKYDSfVYdmJq7g2IPJYCRzwtp74KyDZytkR4OL3NRupvswvmJQJ4CX5tDSurW2cvCc1Ia1qM7d0jpa7IA==
dependencies:
"@typescript-eslint/types" "5.7.0"
"@typescript-eslint/visitor-keys" "5.7.0"
"@typescript-eslint/types" "5.13.0"
"@typescript-eslint/visitor-keys" "5.13.0"
"@typescript-eslint/type-utils@5.13.0":
version "5.13.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.13.0.tgz#b0efd45c85b7bab1125c97b752cab3a86c7b615d"
integrity sha512-/nz7qFizaBM1SuqAKb7GLkcNn2buRdDgZraXlkhz+vUGiN1NZ9LzkA595tHHeduAiS2MsHqMNhE2zNzGdw43Yg==
dependencies:
"@typescript-eslint/utils" "5.13.0"
debug "^4.3.2"
tsutils "^3.21.0"
"@typescript-eslint/types@4.31.2":
version "4.31.2"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.31.2.tgz#2aea7177d6d744521a168ed4668eddbd912dfadf"
integrity sha512-kWiTTBCTKEdBGrZKwFvOlGNcAsKGJSBc8xLvSjSppFO88AqGxGNYtF36EuEYG6XZ9vT0xX8RNiHbQUKglbSi1w==
"@typescript-eslint/types@5.7.0":
version "5.7.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.7.0.tgz#2d4cae0105ba7d08bffa69698197a762483ebcbe"
integrity sha512-5AeYIF5p2kAneIpnLFve8g50VyAjq7udM7ApZZ9JYjdPjkz0LvODfuSHIDUVnIuUoxafoWzpFyU7Sqbxgi79mA==
"@typescript-eslint/types@5.13.0":
version "5.13.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.13.0.tgz#da1de4ae905b1b9ff682cab0bed6b2e3be9c04e5"
integrity sha512-LmE/KO6DUy0nFY/OoQU0XelnmDt+V8lPQhh8MOVa7Y5k2gGRd6U9Kp3wAjhB4OHg57tUO0nOnwYQhRRyEAyOyg==
"@typescript-eslint/typescript-estree@4.31.2":
version "4.31.2"
@ -7975,19 +7973,31 @@
semver "^7.3.5"
tsutils "^3.21.0"
"@typescript-eslint/typescript-estree@5.7.0", "@typescript-eslint/typescript-estree@^5.6.0":
version "5.7.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.7.0.tgz#968fad899050ccce4f08a40cd5fabc0798525006"
integrity sha512-aO1Ql+izMrTnPj5aFFlEJkpD4jRqC4Gwhygu2oHK2wfVQpmOPbyDSveJ+r/NQo+PWV43M6uEAeLVbTi09dFLhg==
"@typescript-eslint/typescript-estree@5.13.0", "@typescript-eslint/typescript-estree@^5.13.0":
version "5.13.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.13.0.tgz#b37c07b748ff030a3e93d87c842714e020b78141"
integrity sha512-Q9cQow0DeLjnp5DuEDjLZ6JIkwGx3oYZe+BfcNuw/POhtpcxMTy18Icl6BJqTSd+3ftsrfuVb7mNHRZf7xiaNA==
dependencies:
"@typescript-eslint/types" "5.7.0"
"@typescript-eslint/visitor-keys" "5.7.0"
"@typescript-eslint/types" "5.13.0"
"@typescript-eslint/visitor-keys" "5.13.0"
debug "^4.3.2"
globby "^11.0.4"
is-glob "^4.0.3"
semver "^7.3.5"
tsutils "^3.21.0"
"@typescript-eslint/utils@5.13.0":
version "5.13.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.13.0.tgz#2328feca700eb02837298339a2e49c46b41bd0af"
integrity sha512-+9oHlPWYNl6AwwoEt5TQryEHwiKRVjz7Vk6kaBeD3/kwHE5YqTGHtm/JZY8Bo9ITOeKutFaXnBlMgSATMJALUQ==
dependencies:
"@types/json-schema" "^7.0.9"
"@typescript-eslint/scope-manager" "5.13.0"
"@typescript-eslint/types" "5.13.0"
"@typescript-eslint/typescript-estree" "5.13.0"
eslint-scope "^5.1.1"
eslint-utils "^3.0.0"
"@typescript-eslint/visitor-keys@4.31.2":
version "4.31.2"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.31.2.tgz#7d5b4a4705db7fe59ecffb273c1d082760f635cc"
@ -7996,12 +8006,12 @@
"@typescript-eslint/types" "4.31.2"
eslint-visitor-keys "^2.0.0"
"@typescript-eslint/visitor-keys@5.7.0":
version "5.7.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.7.0.tgz#e05164239eb7cb8aa9fa06c516ede480ce260178"
integrity sha512-hdohahZ4lTFcglZSJ3DGdzxQHBSxsLVqHzkiOmKi7xVAWC4y2c1bIMKmPJSrA4aOEoRUPOKQ87Y/taC7yVHpFg==
"@typescript-eslint/visitor-keys@5.13.0":
version "5.13.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.13.0.tgz#f45ff55bcce16403b221ac9240fbeeae4764f0fd"
integrity sha512-HLKEAS/qA1V7d9EzcpLFykTePmOQqOFim8oCvhY3pZgQ8Hi38hYpHd9e5GN6nQBFQNecNhws5wkS9Y5XIO0s/g==
dependencies:
"@typescript-eslint/types" "5.7.0"
"@typescript-eslint/types" "5.13.0"
eslint-visitor-keys "^3.0.0"
"@ungap/promise-all-settled@1.1.2":
@ -29047,10 +29057,10 @@ typescript-tuple@^2.2.1:
dependencies:
typescript-compare "^0.0.2"
typescript@4.5.3, typescript@^3.3.3333, typescript@^3.5.3, typescript@^4.3.5, typescript@~4.4.2:
version "4.5.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.3.tgz#afaa858e68c7103317d89eb90c5d8906268d353c"
integrity sha512-eVYaEHALSt+s9LbvgEv4Ef+Tdq7hBiIZgii12xXJnukryt3pMgJf6aKhoCZ3FWQsu6sydEnkg11fYXLzhLBjeQ==
typescript@4.6.2, typescript@^3.3.3333, typescript@^3.5.3, typescript@^4.3.5, typescript@~4.4.2:
version "4.6.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.2.tgz#fe12d2727b708f4eef40f51598b3398baa9611d4"
integrity sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==
ua-parser-js@^0.7.18:
version "0.7.24"