Skip to content

Commit 36924ff

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

18 files changed

Lines changed: 43 additions & 38 deletions

File tree

js/src/database/events.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const DatabaseEvents = {
7676
var exportAnchors = $('input.checkall:checked').parents('tr').find('.export_anchor');
7777
var count = exportAnchors.length;
7878
var returnCount = 0;
79-
var p = $.when();
79+
var p: any = $.when();
8080
exportAnchors.each(function () {
8181
var h = $(this).attr('href');
8282
p = p.then(function () {

js/src/database/multi_table_query.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ AJAX.registerOnload('database/multi_table_query.js', function () {
5454

5555
columns[columns.length - 1].push(columnAlias);
5656

57-
if ($(this).val() in tableAliases) {
57+
if (($(this).val() as string) in tableAliases) {
5858
if (! (tableAliases[($(this).val() as string)].includes(tableAlias))) {
5959
tableAliases[($(this).val() as string)].push(tableAlias);
6060
}

js/src/database/routines.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ const DatabaseRoutines = {
9292
ajaxShowMessage(window.Messages.NoExportable);
9393
}
9494

95-
var p = $.when();
95+
var p: any = $.when();
9696
exportAnchors.each(function () {
9797
var h = $(this).attr('href');
9898
p = p.then(function () {

js/src/database/triggers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const DatabaseTriggers = {
8585
var exportAnchors = $('input.checkall:checked').parents('tr').find('.export_anchor');
8686
var count = exportAnchors.length;
8787
var returnCount = 0;
88-
var p = $.when();
88+
var p: any = $.when();
8989
exportAnchors.each(function () {
9090
var h = $(this).attr('href');
9191
p = p.then(function () {

js/src/designer/move.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -711,10 +711,10 @@ const newPage = function () {
711711
// (del?) no for pdf
712712
const save = function (url) {
713713
for (var key in DesignerConfig.jTabs) {
714-
(document.getElementById('t_x_' + key + '_') as HTMLInputElement).value = parseInt(document.getElementById(key).style.left, 10);
715-
(document.getElementById('t_y_' + key + '_') as HTMLInputElement).value = parseInt(document.getElementById(key).style.top, 10);
716-
(document.getElementById('t_v_' + key + '_') as HTMLInputElement).value = document.getElementById('id_tbody_' + key).style.display === 'none' ? 0 : 1;
717-
(document.getElementById('t_h_' + key + '_') as HTMLInputElement).value = (document.getElementById('check_vis_' + key) as HTMLInputElement).checked ? 1 : 0;
714+
(document.getElementById('t_x_' + key + '_') as HTMLInputElement).value = parseInt(document.getElementById(key).style.left, 10).toString();
715+
(document.getElementById('t_y_' + key + '_') as HTMLInputElement).value = parseInt(document.getElementById(key).style.top, 10).toString();
716+
(document.getElementById('t_v_' + key + '_') as HTMLInputElement).value = document.getElementById('id_tbody_' + key).style.display === 'none' ? '0' : '1';
717+
(document.getElementById('t_h_' + key + '_') as HTMLInputElement).value = (document.getElementById('check_vis_' + key) as HTMLInputElement).checked ? '1' : '0';
718718
}
719719

720720
(document.getElementById('container-form') as HTMLFormElement).action = url;

js/src/import.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,10 @@ AJAX.registerOnload('import.js', function () {
279279

280280
if (finished) {
281281
if (originalTitle !== false) {
282+
// @ts-ignore
282283
parent.document.title = originalTitle;
283284
} else {
285+
// @ts-ignore
284286
document.title = originalTitle;
285287
}
286288

js/src/modules/ajax.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ const AJAX = {
437437
if (typeof data.success !== 'undefined' && data.success) {
438438
// reload page if user trying to login has changed
439439
if (CommonParams.get('user') !== data.params.user) {
440+
// @ts-ignore
440441
window.location = 'index.php';
441442
ajaxShowMessage(window.Messages.strLoading, false);
442443
AJAX.active = false;

js/src/modules/console.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ var ConsoleInput = {
593593
}
594594

595595
var nextCount;
596-
var queryString = false;
596+
var queryString: string | boolean = false;
597597
if (upPermitted && event.keyCode === 38) {
598598
// Navigate up in history
599599
if (ConsoleInput.historyCount === 0) {

js/src/modules/functions.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,6 +1206,7 @@ function codeMirrorAutoCompleteOnInputRead (instance) {
12061206
for (var table in tables) {
12071207
if (tables.hasOwnProperty(table)) {
12081208
var columns = tables[table];
1209+
// @ts-ignore
12091210
table = {
12101211
text: table,
12111212
columns: []
@@ -2021,8 +2022,8 @@ function onloadCreateTableEvents (): void {
20212022
return;
20222023
}
20232024

2024-
var col = /\d/.exec($(this).attr('name'));
2025-
col = col[0];
2025+
var colRegEx = /\d/.exec($(this).attr('name'));
2026+
const col = colRegEx[0];
20262027
var $selectFieldKey = $('select[name="field_key[' + col + ']"]');
20272028
if ($selectFieldKey.val() === 'none_' + col) {
20282029
$selectFieldKey.val('primary_' + col).trigger('change', [false]);
@@ -2058,7 +2059,7 @@ function checkPassword ($theForm) {
20582059

20592060
var $password = $theForm.find('input[name=pma_pw]');
20602061
var $passwordRepeat = $theForm.find('input[name=pma_pw2]');
2061-
var alertMessage = false;
2062+
var alertMessage: string | boolean = false;
20622063

20632064
if ($password.val() === '') {
20642065
alertMessage = window.Messages.strPasswordEmpty;

js/src/modules/indexes.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,29 +105,29 @@ function removeColumnFromIndex (colIndex): void {
105105
var previousIndex = $('select[name="field_key[' + colIndex + ']"]')
106106
.attr('data-index');
107107
if (previousIndex.length) {
108-
previousIndex = previousIndex.split(',');
109-
var sourceArray = Indexes.getIndexArray(previousIndex[0]);
108+
const previousIndexes = previousIndex.split(',');
109+
var sourceArray = Indexes.getIndexArray(previousIndexes[0]);
110110
if (sourceArray === null) {
111111
return;
112112
}
113113

114114
// Remove column from index array.
115-
var sourceLength = sourceArray[previousIndex[1]].columns.length;
115+
var sourceLength = sourceArray[previousIndexes[1]].columns.length;
116116
for (var i = 0; i < sourceLength; i++) {
117-
if (sourceArray[previousIndex[1]].columns[i].col_index === colIndex) {
118-
sourceArray[previousIndex[1]].columns.splice(i, 1);
117+
if (sourceArray[previousIndexes[1]].columns[i].col_index === colIndex) {
118+
sourceArray[previousIndexes[1]].columns.splice(i, 1);
119119
}
120120
}
121121

122122
// Remove index completely if no columns left.
123-
if (sourceArray[previousIndex[1]].columns.length === 0) {
124-
sourceArray.splice(previousIndex[1], 1);
123+
if (sourceArray[previousIndexes[1]].columns.length === 0) {
124+
sourceArray.splice(previousIndexes[1], 1);
125125
}
126126

127127
// Update current index details.
128128
$('select[name="field_key[' + colIndex + ']"]').attr('data-index', '');
129129
// Update form index parameters.
130-
Indexes.setIndexFormParameters(sourceArray, previousIndex[0].toLowerCase());
130+
Indexes.setIndexFormParameters(sourceArray, previousIndexes[0].toLowerCase());
131131
}
132132
}
133133

0 commit comments

Comments
 (0)