Skip to content

Commit

Permalink
[7.x] [chore] TS 3.9: convert ts-ignore to ts-expect-error (#69541) (#…
Browse files Browse the repository at this point in the history
…69771)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
clintandrewhall and elasticmachine authored Jun 24, 2020
1 parent 9ce10b7 commit 15ad354
Show file tree
Hide file tree
Showing 98 changed files with 164 additions and 220 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
Style,
ExpressionFunctionDefinition,
} from 'src/plugins/expressions/common';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { Handlebars } from '../../../common/lib/handlebars';
import { getFunctionHelp } from '../../../i18n';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,25 @@ export function compare(): ExpressionFunctionDefinition<'compare', Context, Argu
return a !== b;
case Operation.LT:
if (typesMatch) {
// @ts-ignore #35433 This is a wonky comparison for nulls
// @ts-expect-error #35433 This is a wonky comparison for nulls
return a < b;
}
return false;
case Operation.LTE:
if (typesMatch) {
// @ts-ignore #35433 This is a wonky comparison for nulls
// @ts-expect-error #35433 This is a wonky comparison for nulls
return a <= b;
}
return false;
case Operation.GT:
if (typesMatch) {
// @ts-ignore #35433 This is a wonky comparison for nulls
// @ts-expect-error #35433 This is a wonky comparison for nulls
return a > b;
}
return false;
case Operation.GTE:
if (typesMatch) {
// @ts-ignore #35433 This is a wonky comparison for nulls
// @ts-expect-error #35433 This is a wonky comparison for nulls
return a >= b;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common';
import { ContainerStyle, Overflow, BackgroundRepeat, BackgroundSize } from '../../../types';
import { getFunctionHelp, getFunctionErrors } from '../../../i18n';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { isValidUrl } from '../../../common/lib/url';

interface Output extends ContainerStyle {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common';
import { getFunctionHelp, getFunctionErrors } from '../../../i18n';

// @ts-ignore untyped local
// @ts-expect-error untyped local
import { resolveWithMissingImage } from '../../../common/lib/resolve_dataurl';
// @ts-ignore .png file
// @ts-expect-error .png file
import { elasticLogo } from '../../lib/elastic_logo';

export enum ImageMode {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/

// @ts-ignore no @typed def; Elastic library
// @ts-expect-error no @typed def; Elastic library
import { evaluate } from 'tinymath';
// @ts-ignore untyped local
import { pivotObjectArray } from '../../../common/lib/pivot_object_array';
import { Datatable, isDatatable, ExpressionFunctionDefinition } from '../../../types';
import { getFunctionHelp, getFunctionErrors } from '../../../i18n';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { palettes } from '../../../common/lib/palettes';
import { getFunctionHelp } from '../../../i18n';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
*/

import { get, map, groupBy } from 'lodash';
// @ts-ignore lodash.keyby imports invalid member from @types/lodash
// @ts-expect-error lodash.keyby imports invalid member from @types/lodash
import keyBy from 'lodash.keyby';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { getColorsFromPalette } from '../../../common/lib/get_colors_from_palette';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { getLegendConfig } from '../../../common/lib/get_legend_config';
import { getFunctionHelp } from '../../../i18n';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
* you may not use this file except in compliance with the Elastic License.
*/

// @ts-ignore no @typed def
// @ts-expect-error no @typed def
import keyBy from 'lodash.keyby';
import { groupBy, get, set, map, sortBy } from 'lodash';
import { ExpressionFunctionDefinition, Style } from 'src/plugins/expressions';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { getColorsFromPalette } from '../../../../common/lib/get_colors_from_palette';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { getLegendConfig } from '../../../../common/lib/get_legend_config';
import { getFlotAxisConfig } from './get_flot_axis_config';
import { getFontSpec } from './get_font_spec';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common';
import { Render, ContainerStyle } from '../../../types';
import { getFunctionHelp } from '../../../i18n';
// @ts-ignore unconverted local file
import { DEFAULT_ELEMENT_CSS } from '../../../common/lib/constants';

interface ContainerStyleArgument extends ContainerStyle {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/

import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { resolveWithMissingImage } from '../../../common/lib/resolve_dataurl';
// @ts-ignore .png file
// @ts-expect-error .png file
import { elasticOutline } from '../../lib/elastic_outline';
import { Render } from '../../../types';
import { getFunctionHelp } from '../../../i18n';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/

import { ExpressionFunctionDefinition, ExpressionValueRender } from 'src/plugins/expressions';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { resolveWithMissingImage } from '../../../common/lib/resolve_dataurl';
// @ts-ignore .png file
// @ts-expect-error .png file
import { elasticOutline } from '../../lib/elastic_outline';
import { getFunctionHelp, getFunctionErrors } from '../../../i18n';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export function savedVisualization(): ExpressionFunctionDefinition<
}

if (hideLegend === true) {
// @ts-ignore LegendOpen missing on VisualizeInput
// @ts-expect-error LegendOpen missing on VisualizeInput
visOptions.legendOpen = false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/

// @ts-ignore untyped Elastic library
import { getType } from '@kbn/interpreter/common';
import {
ExpressionFunctionDefinition,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { sortBy } from 'lodash';
import { ExpressionFunctionDefinition } from 'src/plugins/expressions';
// @ts-ignore unconverted lib file
// @ts-expect-error unconverted lib file
import { queryDatatable } from '../../../../common/lib/datatable/query';
import { DemoRows } from './demo_rows_types';
import { getDemoRows } from './get_demo_rows';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
ExpressionValueFilter,
} from 'src/plugins/expressions/common';
/* eslint-disable */
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { buildESRequest } from '../../../server/lib/build_es_request';
/* eslint-enable */
import { getFunctionHelp } from '../../../i18n';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import squel from 'squel';
import { ExpressionFunctionDefinition } from 'src/plugins/expressions';
/* eslint-disable */
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { queryEsSQL } from '../../../server/lib/query_es_sql';
/* eslint-enable */
import { ExpressionValueFilter } from '../../../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common';
/* eslint-disable */
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { queryEsSQL } from '../../../server/lib/query_es_sql';
/* eslint-enable */
import { ExpressionValueFilter } from '../../../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

// @ts-ignore untyped library
// @ts-expect-error untyped library
import { parse } from 'tinymath';
import { getFieldNames } from './pointseries/lib/get_field_names';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/

// @ts-ignore Untyped library
// @ts-expect-error untyped library
import uniqBy from 'lodash.uniqby';
// @ts-ignore Untyped Elastic library
// @ts-expect-error untyped Elastic library
import { evaluate } from 'tinymath';
import { groupBy, zipObject, omit } from 'lodash';
import moment from 'moment';
Expand All @@ -18,13 +18,10 @@ import {
PointSeriesColumnName,
PointSeriesColumns,
} from 'src/plugins/expressions/common';
// @ts-ignore Untyped local
import { pivotObjectArray } from '../../../../common/lib/pivot_object_array';
// @ts-ignore Untyped local
import { unquoteString } from '../../../../common/lib/unquote_string';
// @ts-ignore Untyped local
import { isColumnReference } from './lib/is_column_reference';
// @ts-ignore Untyped local
// @ts-expect-error untyped local
import { getExpressionType } from './lib/get_expression_type';
import { getFunctionHelp, getFunctionErrors } from '../../../../i18n';

Expand Down Expand Up @@ -125,7 +122,7 @@ export function pointseries(): ExpressionFunctionDefinition<
col.role = 'measure';
}

// @ts-ignore untyped local: get_expression_type
// @ts-expect-error untyped local: get_expression_type
columns[argName] = col;
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

// @ts-ignore Untyped Library
// @ts-expect-error untyped library
import { parse } from 'tinymath';

export function isColumnReference(mathExpression: string | null): boolean {
Expand Down
9 changes: 4 additions & 5 deletions x-pack/plugins/canvas/canvas_plugin_src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@ import { Start as InspectorStart } from '../../../../src/plugins/inspector/publi

import { functions } from './functions/browser';
import { typeFunctions } from './expression_types';
// @ts-ignore: untyped local
// @ts-expect-error: untyped local
import { renderFunctions, renderFunctionFactories } from './renderers';
import { initializeElements } from './elements';
// @ts-ignore Untyped Local
// @ts-expect-error untyped local
import { transformSpecs } from './uis/transforms';
// @ts-ignore Untyped Local
// @ts-expect-error untyped local
import { datasourceSpecs } from './uis/datasources';
// @ts-ignore Untyped Local
// @ts-expect-error untyped local
import { modelSpecs } from './uis/models';
import { initializeViews } from './uis/views';
// @ts-ignore Untyped Local
import { initializeArgs } from './uis/arguments';
import { tagSpecs } from './uis/tags';
import { templateSpecs } from './templates';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function toExpression(input: VisualizeInput): string {
.reduce((_, part) => expressionParts.push(part), 0);
}

// @ts-ignore LegendOpen missing on VisualizeInput type
// @ts-expect-error LegendOpen missing on VisualizeInput type
if (input.vis?.legendOpen !== undefined && input.vis.legendOpen === false) {
expressionParts.push(`hideLegend=true`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import { compose, withProps } from 'recompose';
import moment from 'moment';
import { DateFormatArgInput as Component, Props as ComponentProps } from './date_format';
// @ts-ignore untyped local lib
import { templateFromReactComponent } from '../../../../public/lib/template_from_react_component';
import { ArgumentFactory } from '../../../../types/arguments';
import { ArgumentStrings } from '../../../../i18n';
Expand Down
24 changes: 12 additions & 12 deletions x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@
*/

import { axisConfig } from './axis_config';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { datacolumn } from './datacolumn';
import { dateFormatInitializer } from './date_format';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { filterGroup } from './filter_group';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { imageUpload } from './image_upload';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { number } from './number';
import { numberFormatInitializer } from './number_format';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { palette } from './palette';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { percentage } from './percentage';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { range } from './range';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { select } from './select';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { shape } from './shape';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { string } from './string';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { textarea } from './textarea';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { toggle } from './toggle';

import { SetupInitializer } from '../../plugin';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import { compose, withProps } from 'recompose';
import { NumberFormatArgInput as Component, Props as ComponentProps } from './number_format';
// @ts-ignore untyped local lib
import { templateFromReactComponent } from '../../../../public/lib/template_from_react_component';
import { ArgumentFactory } from '../../../../types/arguments';
import { ArgumentStrings } from '../../../../i18n';
Expand Down
27 changes: 13 additions & 14 deletions x-pack/plugins/canvas/canvas_plugin_src/uis/views/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,32 @@
* you may not use this file except in compliance with the Elastic License.
*/

// @ts-ignore untyped local
// @ts-expect-error untyped local
import { dropdownControl } from './dropdownControl';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { getCell } from './getCell';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { image } from './image';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { markdown } from './markdown';
// @ts-ignore untyped local
import { metricInitializer } from './metric';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { pie } from './pie';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { plot } from './plot';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { progress } from './progress';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { repeatImage } from './repeatImage';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { revealImage } from './revealImage';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { render } from './render';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { shape } from './shape';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { table } from './table';
// @ts-ignore untyped local
// @ts-expect-error untyped local
import { timefilterControl } from './timefilterControl';

import { SetupInitializer } from '../../plugin';
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/canvas/common/lib/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { uniq } from 'lodash';
// @ts-ignore Untyped Library
// @ts-expect-error untyped library
import { parse } from '@kbn/interpreter/common';
import {
ExpressionAstExpression,
Expand Down
Loading

0 comments on commit 15ad354

Please sign in to comment.