Fix error TS2365 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 14:10:00 -03:00
parent 8000b0158c
commit a493cbdf84
No known key found for this signature in database
GPG Key ID: 6A16FD38AFC89CC8
6 changed files with 6 additions and 8 deletions

View File

@ -1128,12 +1128,12 @@ const makeGrid = function (t, enableResize = undefined, enableReorder = undefine
var showMicrosec = false;
var timeFormat = 'HH:mm:ss';
// check for decimal places of seconds
if (($td.attr('data-decimals') > 0) && ($td.attr('data-type').indexOf('time') !== -1)) {
if ((Number($td.attr('data-decimals')) > 0) && ($td.attr('data-type').indexOf('time') !== -1)) {
if (datetimeValue && datetimeValue.indexOf('.') === false) {
datetimeValue += '.';
}
if ($td.attr('data-decimals') > 3) {
if (Number($td.attr('data-decimals')) > 3) {
showMillisec = true;
showMicrosec = true;
timeFormat = 'HH:mm:ss.lc';

View File

@ -166,7 +166,7 @@ function addDateTimePicker () {
}
$('input.timefield, input.datefield, input.datetimefield').each(function () {
var decimals = $(this).parent().attr('data-decimals');
var decimals = Number($(this).parent().attr('data-decimals'));
var type = $(this).parent().attr('data-type');
var showMillisec = false;

View File

@ -584,7 +584,7 @@ function on () {
*/
var $currRow = $anchor.parents('tr');
/** @var {number} rows Number of columns in the key */
var rows = $anchor.parents('td').attr('rowspan') || 1;
var rows = Number($anchor.parents('td').attr('rowspan')) || 1;
/** @var {number} $rowsToHide Rows that should be hidden */
var $rowsToHide = $currRow;
for (var i = 1, $lastRow = $currRow.next(); i < rows; i++, $lastRow = $lastRow.next()) {

View File

@ -670,7 +670,7 @@ function addNewContinueInsertionFields (event) {
/**
* @var target_rows Number of rows the user wants
*/
var targetRows = $('#insert_rows').val();
var targetRows = Number($('#insert_rows').val());
// remove all datepickers
$('input.datefield, input.datetimefield').each(function () {

View File

@ -75,8 +75,7 @@ AJAX.registerOnload('table/structure.js', function () {
* @var form object referring to the export form
*/
var $form = $(this);
var fieldCnt = $form.find('input[name=orig_num_fields]').val();
var fieldCnt = Number($form.find('input[name=orig_num_fields]').val());
function submitForm () {
var $msg = ajaxShowMessage(window.Messages.strProcessingRequest);

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'.
2365, // TS2365: Operator '%s' cannot be applied to types '%s' and '%s'.
2367, // TS2367: This comparison appears to be unintentional because the types '%s' and '%s' have no overlap.
2405, // TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'.
2538, // TS2538: Type '%s' cannot be used as an index type.