Skip to content

Commit 1193988

Browse files
committed
update IDE type errors
1 parent 1914443 commit 1193988

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/lib/utils/list.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ export function getFilterProps(object) {
142142
* @param {?string} inputValue
143143
* @param {?Set} excludeSelected
144144
* @param {ComponentConfig} config
145-
* @param {SearchProps|null} searchProps
145+
* @param {SearchProps} searchProps
146146
* @returns {object[]}
147147
*/
148-
export function filterList(options, inputValue, excludeSelected, config, searchProps) {
148+
export function filterList(options, inputValue, excludeSelected, config, searchProps = {}) {
149149
if (!searchProps.keepSelectionInList && excludeSelected) {
150150
options = options
151151
.filter(opt => !excludeSelected.has(opt[config.valueField]))
@@ -219,12 +219,14 @@ export function fieldInit(type, options, groupItemsField) {
219219
const isValue = type === 'value';
220220
let val = isValue ? 'value' : 'text'; // selectize style defaults
221221
if (options && options.length) {
222+
// @ts-ignore
222223
const firstItem = options[0][groupItemsField] ? options[0][groupItemsField][0] : options[0];
223224
if (!firstItem || typeof firstItem === 'string') return val;
224225
const autoAddItem = isValue ? 0 : 1;
225226
const guessList = isValue
226227
? ['id', 'value', 'ID']
227228
: ['name', 'title', 'label'];
229+
// @ts-ignore
228230
val = Object.keys(firstItem).filter(prop => guessList.includes(prop))
229231
.concat([Object.keys(firstItem)[autoAddItem]]) // auto add field (used as fallback) if empty list is returned
230232
.shift();

src/lib/utils/sifter.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*
2828
* @constructor
2929
* @param {array|object} items
30-
* @param {object} items
30+
* @param {object} [settings]
3131
*/
3232
var Sifter = function(items, settings) {
3333
this.items = items;
@@ -112,7 +112,7 @@ Sifter.prototype.iterator = function(object, callback) {
112112
* If an item is not a match, 0 will be returned by the function.
113113
*
114114
* @param {object|string} search
115-
* @param {object} options (optional)
115+
* @param {object} [options]
116116
* @returns {function}
117117
*/
118118
Sifter.prototype.getScoreFunction = function(search, options) {
@@ -425,6 +425,7 @@ var getattr = function(obj, name, nesting) {
425425
if (!obj || !name) return;
426426
if (!nesting) return obj[name];
427427
var names = name.split(".");
428+
// @ts-ignore
428429
while(names.length && (obj = obj[names.shift()]));
429430
return obj;
430431
};

0 commit comments

Comments
 (0)