Skip to content

Commit 0f92356

Browse files
committed
Fix error TS2538 reported by TypeScript
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
1 parent 0701a3c commit 0f92356

7 files changed

Lines changed: 12 additions & 13 deletions

File tree

js/src/database/multi_table_query.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ AJAX.registerOnload('database/multi_table_query.js', function () {
5555
columns[columns.length - 1].push(columnAlias);
5656

5757
if ($(this).val() in tableAliases) {
58-
if (! (tableAliases[$(this).val()].includes(tableAlias))) {
59-
tableAliases[$(this).val()].push(tableAlias);
58+
if (! (tableAliases[($(this).val() as string)].includes(tableAlias))) {
59+
tableAliases[($(this).val() as string)].push(tableAlias);
6060
}
6161
} else {
62-
tableAliases[$(this).val()] = [tableAlias];
62+
tableAliases[($(this).val() as string)] = [tableAlias];
6363
}
6464
}
6565
});

js/src/menu_resizer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ import getImageTag from './modules/functions/getImageTag.ts';
185185
* @return {any}
186186
*/
187187
$.fn.menuResizer = function (method) {
188-
if (methods[method]) {
188+
if (typeof method === 'string' && methods[method]) {
189189
return methods[method].call(this);
190190
} else if (typeof method === 'function') {
191191
return methods.init.apply(this, [method]);

js/src/modules/indexes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ function indexTypeSelectionDialog (sourceArray, indexChoice, colIndex): void {
465465
return false;
466466
}
467467

468-
var arrayIndex = $('input[name="composite_with"]:checked').val();
468+
var arrayIndex = Number($('input[name="composite_with"]:checked').val());
469469
var sourceLength = sourceArray[arrayIndex].columns.length;
470470
var targetColumns = [];
471471
for (var i = 0; i < sourceLength; i++) {

js/src/modules/navigation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function filterStateRestore (): void {
8787
$tableFilters.each(function () {
8888
$obj = $(this).closest('div.list_container');
8989
// aPath associated with this filter
90-
var filterName = $(this).siblings('input[name=aPath]').val();
90+
var filterName = ($(this).siblings('input[name=aPath]').val() as string);
9191
// if this table's filter has a state stored in storage
9292
if (searchClauses.hasOwnProperty(filterName)
9393
&& searchClauses[filterName].length

js/src/normalization.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ function goTo2NFFinish (pd) {
275275
function goTo3NFFinish (newTables) {
276276
for (var table in newTables) {
277277
for (var newtbl in newTables[table]) {
278-
var updatedname = $('#extra input[name="' + newtbl + '"]').val();
278+
var updatedname = ($('#extra input[name="' + newtbl + '"]').val() as string);
279279
newTables[table][updatedname] = newTables[table][newtbl];
280280
if (updatedname !== newtbl) {
281281
delete newTables[table][newtbl];

js/src/table/zoom_plot_jqplot.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ AJAX.registerTeardown('table/zoom_plot_jqplot.js', function () {
125125
AJAX.registerOnload('table/zoom_plot_jqplot.js', function () {
126126
var currentChart = null;
127127
var searchedDataKey = null;
128-
var xLabel = $('#tableid_0').val();
129-
var yLabel = $('#tableid_1').val();
128+
var xLabel = ($('#tableid_0').val() as string);
129+
var yLabel = ($('#tableid_1').val() as string);
130130
// will be updated via Ajax
131131
var xType = $('#types_0').val();
132132
var yType = $('#types_1').val();
133-
var dataLabel = $('#dataLabel').val();
133+
var dataLabel = ($('#dataLabel').val() as string);
134134

135135
// Get query result
136136
var searchedData;
@@ -171,7 +171,7 @@ AJAX.registerOnload('table/zoom_plot_jqplot.js', function () {
171171
$('#tableFieldsId').find('tr').eq(1).find('td').eq(1).html(data.field_collation);
172172
$('#tableFieldsId').find('tr').eq(1).find('td').eq(2).html(data.field_operators);
173173
$('#tableFieldsId').find('tr').eq(1).find('td').eq(3).html(data.field_value);
174-
xLabel = $('#tableid_0').val();
174+
xLabel = ($('#tableid_0').val() as string);
175175
$('#types_0').val(data.field_type);
176176
xType = data.field_type;
177177
$('#collations_0').val(data.field_collations);
@@ -196,7 +196,7 @@ AJAX.registerOnload('table/zoom_plot_jqplot.js', function () {
196196
$('#tableFieldsId').find('tr').eq(2).find('td').eq(1).html(data.field_collation);
197197
$('#tableFieldsId').find('tr').eq(2).find('td').eq(2).html(data.field_operators);
198198
$('#tableFieldsId').find('tr').eq(2).find('td').eq(3).html(data.field_value);
199-
yLabel = $('#tableid_1').val();
199+
yLabel = ($('#tableid_1').val() as string);
200200
$('#types_1').val(data.field_type);
201201
yType = data.field_type;
202202
$('#collations_1').val(data.field_collations);

webpack.config.cjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const publicPath = path.resolve(__dirname, 'public');
1212
const typeScriptErrorsToIgnore = [
1313
2322, // TS2322: Type '%s' is not assignable to type '%s'.
1414
2345, // TS2345: Argument of type '%s' is not assignable to parameter of type '%s'.
15-
2538, // TS2538: Type '%s' cannot be used as an index type.
1615
5096, // TS5096: Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set.
1716
];
1817

0 commit comments

Comments
 (0)