Skip to content

EspoCRM – Open Source CRM Application

Type fixes

Yurii694282ff7934
diff --git a/client/src/views/fields/base.ts b/client/src/views/fields/base.ts
index 8dedc7097d..b3ed3d79f7 100644
--- a/client/src/views/fields/base.ts
+++ b/client/src/views/fields/base.ts
@@ -69,7 +69,7 @@ export interface Params {
}
export interface ViewSchema {
- model?: Model;
+ model: Model;
}
type Mode = 'list' | 'listLink' | 'detail' | 'edit' | 'search';
diff --git a/client/src/views/fields/bool.ts b/client/src/views/fields/bool.ts
index b1661f8c47..189b962786 100644
--- a/client/src/views/fields/bool.ts
+++ b/client/src/views/fields/bool.ts
@@ -71,7 +71,7 @@ export default class BoolFieldView<
afterRender() {
super.afterRender();
- if (this.mode === this.MODE_SEARCH) {
+ if (this.mode === this.MODE_SEARCH && this.$element) {
this.$element.on('change', () => {
this.trigger('change');
});
@@ -85,7 +85,7 @@ export default class BoolFieldView<
const value = element?.checked
- const data = {};
+ const data = {} as Record<string, any>;
data[this.name] = value;
@@ -93,7 +93,7 @@ export default class BoolFieldView<
}
fetchSearch() {
- const type = this.$element.val();
+ const type = this.$element?.val();
if (!type) {
return null;
@@ -128,8 +128,6 @@ export default class BoolFieldView<
}
getSearchType() {
- return this.getSearchParamsData().type ||
- this.searchParams.type ||
- 'isTrue';
+ return this.getSearchParamsData().type ?? this.searchParams?.type ?? 'isTrue';
}
}