Skip to content

Commit

Permalink
remove useless default value
Browse files Browse the repository at this point in the history
  • Loading branch information
Boris Andreiko committed Nov 8, 2024
1 parent 6d79659 commit 5df6043
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/components/ValidationFieldArray.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function touch() {
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function append(value: Record<string, any>, focusOptions: FocusOptions = null) {
function append(value: Record<string, any>, focusOptions?: FocusOptions) {
value[keyName.value] = getId(value);
fields.value.push(value);
touch();
Expand All @@ -98,7 +98,7 @@ function append(value: Record<string, any>, focusOptions: FocusOptions = null) {
}
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function prepend(value: Record<string, any>, focusOptions: FocusOptions = null) {
function prepend(value: Record<string, any>, focusOptions?: FocusOptions) {
value[keyName.value] = getId(value);
fields.value.unshift(value);
touch();
Expand All @@ -108,7 +108,7 @@ function prepend(value: Record<string, any>, focusOptions: FocusOptions = null)
}
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function insert(index: number, value: Record<string, any>, focusOptions: FocusOptions = null) {
function insert(index: number, value: Record<string, any>, focusOptions?: FocusOptions) {
value[keyName.value] = getId(value);
fields.value.splice(index, 0, value);
touch();
Expand All @@ -117,7 +117,7 @@ function insert(index: number, value: Record<string, any>, focusOptions: FocusOp
handleFocus({ index, ...focusOptions });
}
}
function swap(from: number, to: number, focusOptions: FocusOptions = null) {
function swap(from: number, to: number, focusOptions?: FocusOptions) {
const temp = fields.value[from];
fields.value[from] = fields.value[to];
fields.value[to] = temp;
Expand All @@ -127,15 +127,15 @@ function swap(from: number, to: number, focusOptions: FocusOptions = null) {
handleFocus({ index: to, ...focusOptions });
}
}
function move(from: number, to: number, focusOptions: FocusOptions = null) {
function move(from: number, to: number, focusOptions?: FocusOptions) {
fields.value.splice(to, 0, fields.value.splice(from, 1)[0]);
touch();
if (focusOptions) {
// by default focus on moved field
handleFocus({ index: to, ...focusOptions });
}
}
function remove(index: number, focusOptions: FocusOptions = null) {
function remove(index: number, focusOptions?: FocusOptions = null) {

Check failure on line 138 in src/components/ValidationFieldArray.vue

View workflow job for this annotation

GitHub Actions / build

Parameter cannot have question mark and initializer.

Check failure on line 138 in src/components/ValidationFieldArray.vue

View workflow job for this annotation

GitHub Actions / build

Type 'null' is not assignable to type 'FocusOptions | undefined'.
fields.value.splice(index, 1);
touch();
Expand Down

0 comments on commit 5df6043

Please sign in to comment.