Fix error TS2538 reported by TypeScript

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2023-04-21 17:35:09 -03:00
parent 0701a3cbeb
commit 0f92356358
No known key found for this signature in database
GPG Key ID: 6A16FD38AFC89CC8
7 changed files with 12 additions and 13 deletions

View File

@ -55,11 +55,11 @@ AJAX.registerOnload('database/multi_table_query.js', function () {
columns[columns.length - 1].push(columnAlias);
if ($(this).val() in tableAliases) {
if (! (tableAliases[$(this).val()].includes(tableAlias))) {
tableAliases[$(this).val()].push(tableAlias);
if (! (tableAliases[($(this).val() as string)].includes(tableAlias))) {
tableAliases[($(this).val() as string)].push(tableAlias);
}
} else {
tableAliases[$(this).val()] = [tableAlias];
tableAliases[($(this).val() as string)] = [tableAlias];
}
}
});

View File

@ -185,7 +185,7 @@ import getImageTag from './modules/functions/getImageTag.ts';
* @return {any}
*/
$.fn.menuResizer = function (method) {
if (methods[method]) {
if (typeof method === 'string' && methods[method]) {
return methods[method].call(this);
} else if (typeof method === 'function') {
return methods.init.apply(this, [method]);

View File

@ -465,7 +465,7 @@ function indexTypeSelectionDialog (sourceArray, indexChoice, colIndex): void {
return false;
}
var arrayIndex = $('input[name="composite_with"]:checked').val();
var arrayIndex = Number($('input[name="composite_with"]:checked').val());
var sourceLength = sourceArray[arrayIndex].columns.length;
var targetColumns = [];
for (var i = 0; i < sourceLength; i++) {

View File

@ -87,7 +87,7 @@ function filterStateRestore (): void {
$tableFilters.each(function () {
$obj = $(this).closest('div.list_container');
// aPath associated with this filter
var filterName = $(this).siblings('input[name=aPath]').val();
var filterName = ($(this).siblings('input[name=aPath]').val() as string);
// if this table's filter has a state stored in storage
if (searchClauses.hasOwnProperty(filterName)
&& searchClauses[filterName].length

View File

@ -275,7 +275,7 @@ function goTo2NFFinish (pd) {
function goTo3NFFinish (newTables) {
for (var table in newTables) {
for (var newtbl in newTables[table]) {
var updatedname = $('#extra input[name="' + newtbl + '"]').val();
var updatedname = ($('#extra input[name="' + newtbl + '"]').val() as string);
newTables[table][updatedname] = newTables[table][newtbl];
if (updatedname !== newtbl) {
delete newTables[table][newtbl];

View File

@ -125,12 +125,12 @@ AJAX.registerTeardown('table/zoom_plot_jqplot.js', function () {
AJAX.registerOnload('table/zoom_plot_jqplot.js', function () {
var currentChart = null;
var searchedDataKey = null;
var xLabel = $('#tableid_0').val();
var yLabel = $('#tableid_1').val();
var xLabel = ($('#tableid_0').val() as string);
var yLabel = ($('#tableid_1').val() as string);
// will be updated via Ajax
var xType = $('#types_0').val();
var yType = $('#types_1').val();
var dataLabel = $('#dataLabel').val();
var dataLabel = ($('#dataLabel').val() as string);
// Get query result
var searchedData;
@ -171,7 +171,7 @@ AJAX.registerOnload('table/zoom_plot_jqplot.js', function () {
$('#tableFieldsId').find('tr').eq(1).find('td').eq(1).html(data.field_collation);
$('#tableFieldsId').find('tr').eq(1).find('td').eq(2).html(data.field_operators);
$('#tableFieldsId').find('tr').eq(1).find('td').eq(3).html(data.field_value);
xLabel = $('#tableid_0').val();
xLabel = ($('#tableid_0').val() as string);
$('#types_0').val(data.field_type);
xType = data.field_type;
$('#collations_0').val(data.field_collations);
@ -196,7 +196,7 @@ AJAX.registerOnload('table/zoom_plot_jqplot.js', function () {
$('#tableFieldsId').find('tr').eq(2).find('td').eq(1).html(data.field_collation);
$('#tableFieldsId').find('tr').eq(2).find('td').eq(2).html(data.field_operators);
$('#tableFieldsId').find('tr').eq(2).find('td').eq(3).html(data.field_value);
yLabel = $('#tableid_1').val();
yLabel = ($('#tableid_1').val() as string);
$('#types_1').val(data.field_type);
yType = data.field_type;
$('#collations_1').val(data.field_collations);

View File

@ -12,7 +12,6 @@ const publicPath = path.resolve(__dirname, 'public');
const typeScriptErrorsToIgnore = [
2322, // TS2322: Type '%s' is not assignable to type '%s'.
2345, // TS2345: Argument of type '%s' is not assignable to parameter of type '%s'.
2538, // TS2538: Type '%s' cannot be used as an index type.
5096, // TS5096: Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set.
];