Olivier Massot 4 месяцев назад
Родитель
Сommit
b8c2a3774b

+ 2 - 2
components/Layout/Parameters/EntityTable.vue

@@ -134,7 +134,7 @@ const items: ComputedRef<Array<ApiResource> | null> = computed(() => {
   if (props.columnsDefinitions !== null) {
     // Filter the columns to show
     items = items.map((item) => {
-      const newItem: any = { id: item.id }
+      const newItem: Record<string, unknown> = { id: item.id }
       for (const col of props.columnsDefinitions!) {
         newItem[col.property] = item[col.property]
       }
@@ -144,7 +144,7 @@ const items: ComputedRef<Array<ApiResource> | null> = computed(() => {
 
   if (props.sortBy) {
     items = items.sort((a: ApiResource, b: ApiResource) => {
-      return (a as any)[props.sortBy] > (b as any)[props.sortBy] ? 1 : -1
+      return (a as unknown as Record<string, unknown>)[props.sortBy] > (b as unknown as Record<string, unknown>)[props.sortBy] ? 1 : -1
     })
   }
 

+ 2 - 2
components/Layout/SubHeader/PersonnalizedList.vue

@@ -72,7 +72,7 @@ const items: ComputedRef<Array<PersonalizedList>> = computed(() => {
   const lists: Array<PersonalizedList> =
     collection.value !== null ? collection.value.items : []
 
-  lists.map((item: any) => {
+  lists.map((item: PersonalizedList) => {
     item.menuKey = i18n.t(item.menuKey) as string
   })
 
@@ -82,7 +82,7 @@ const items: ComputedRef<Array<PersonalizedList>> = computed(() => {
 const search = ref('')
 
 const filteredItems = computed(() => {
-  return items.value.filter((item: any) => {
+  return items.value.filter((item: PersonalizedList) => {
     return (
       !search.value ||
       (item.label as string).toLowerCase().includes(search.value.toLowerCase()) ||

+ 1 - 1
components/Ui/Form.vue

@@ -340,7 +340,7 @@ onBeforeUnmount(() => {
   window.removeEventListener('beforeunload', quitWithoutSaving)
 })
 
-function quitWithoutSaving(event: any){
+function quitWithoutSaving(event: BeforeUnloadEvent){
   if (formStore.dirty === true) {
     event.returnValue = i18n.t('quit_without_saving_warning')
   }

+ 1 - 1
components/Ui/Input/Autocomplete.vue

@@ -196,7 +196,7 @@ const props = defineProps({
    * @see https://vuetify.cn/en/components/forms/#validation-with-submit-clear
    */
   rules: {
-    type: Array as PropType<Array<(value: any) => boolean | string>>,
+    type: Array as PropType<Array<(value: unknown) => boolean | string>>,
     required: false,
     default: () => [],
   },

+ 1 - 1
components/Ui/Input/Autocomplete/ApiResources.vue

@@ -235,7 +235,7 @@ const pending = computed(() => statusSearch.value == FETCHING_STATUS.PENDING ||
  * Génère un ListItem à partir des props
  * @param searchItem
  */
-const item = (searchItem: any): ListItem => {
+const item = (searchItem: unknown): ListItem => {
   return {
     id: searchItem[props.listValue],
     title: searchItem[props.listLabel]

+ 1 - 1
components/Ui/Input/DatePicker.vue

@@ -85,7 +85,7 @@ const props = defineProps({
    * @see https://vuetify.cn/en/components/forms/#validation-with-submit-clear
    */
   rules: {
-    type: Array as PropType<Array<(value: any) => boolean | string>>,
+    type: Array as PropType<Array<(value: unknown) => boolean | string>>,
     required: false,
     default: () => [],
   },

+ 1 - 1
components/Ui/Input/DateTimePicker.vue

@@ -105,7 +105,7 @@ const props = defineProps({
    * @see https://vuetify.cn/en/components/forms/#validation-with-submit-clear
    */
   rules: {
-    type: Array as PropType<Array<(value: any) => boolean | string>>,
+    type: Array as PropType<Array<(value: unknown) => boolean | string>>,
     required: false,
     default: () => [],
   },

+ 2 - 2
composables/data/useRefreshProfile.ts

@@ -44,7 +44,7 @@ export const useRefreshProfile = () => {
     //  du repo de MyProfile ne fonctionne pas quand le plugin init.server.ts re-fetch le profil
     em.flush(MyProfile)
 
-    accessProfileStore.initiateProfile(profile as any)
+    accessProfileStore.initiateProfile(profile)
     organizationProfileStore.initiateProfile(profile.organization)
   }
 
@@ -58,7 +58,7 @@ export const useRefreshProfile = () => {
     //  du repo de MyProfile ne fonctionne pas quand le plugin init.server.ts re-fetch le profil
     em.flush(MyProfile)
 
-    accessProfileStore.setProfile(profile as any)
+    accessProfileStore.setProfile(profile)
     organizationProfileStore.setProfile(profile.organization)
   }
 

+ 2 - 2
services/asserts/AssertRuleRegistry.ts

@@ -14,8 +14,8 @@ export class AssertRuleRegistry {
     ];
   }
 
-  getValidators(asserts: Record<string, any>): ((value: any) => true | string)[] {
-    const allRules: ((value: any) => true | string)[] = [];
+  getValidators(asserts: Record<string, unknown>): ((value: unknown) => true | string)[] {
+    const allRules: ((value: unknown) => true | string)[] = [];
 
     for (const key in asserts) {
       const criteria = asserts[key];

+ 2 - 2
services/asserts/NullableAssert.ts

@@ -6,10 +6,10 @@ export class NullableAssert implements AssertRule {
     return key === 'nullable';
   }
 
-  createRule(criteria: boolean): (value: any) => true | string {
+  createRule(criteria: boolean): (value: unknown) => true | string {
 
     const { t } = useI18n();
-    return (value: any) =>
+    return (value: unknown) =>
       !criteria ? value !== null && !!value || t('please_enter_a_value') : true
   }
 }

+ 2 - 2
services/asserts/TypeAssert.ts

@@ -7,7 +7,7 @@ export class TypeAssert implements AssertRule {
     return key === 'type';
   }
 
-  createRule(criteria: string): (value: any) => true | string {
+  createRule(criteria: string): (value: unknown) => true | string {
     const validationUtils = new ValidationUtils()
     const { t } = useI18n();
 
@@ -17,7 +17,7 @@ export class TypeAssert implements AssertRule {
     }
 
     if (criteria === 'integer') {
-      return (value: any) =>
+      return (value: unknown) =>
         Number.isInteger(value) || t('need_to_be_integer');
     }
 

+ 1 - 1
services/asserts/getAssertUtils.ts

@@ -1,6 +1,6 @@
 import { AssertRuleRegistry } from './AssertRuleRegistry';
 
-export function getAssertUtils(asserts: Record<string, any>, key: string) {
+export function getAssertUtils(asserts: Record<string, unknown>, key: string) {
   if (!asserts || !(key in asserts)) return [];
 
   const registry = new AssertRuleRegistry();

+ 2 - 2
types/global.d.ts

@@ -46,8 +46,8 @@ declare global {
   const useRepo: typeof import('@pinia-orm/pinia')['useRepo']
 
   // Custom store composables (assuming they exist)
-  const usePageStore: () => any
-  const useOrganizationProfileStore: () => any
+  const usePageStore: () => unknown
+  const useOrganizationProfileStore: () => unknown
 
   // Test framework globals (Vitest)
   const describe: typeof import('vitest')['describe']

+ 1 - 1
types/interfaces.d.ts

@@ -221,5 +221,5 @@ interface ColumnDefinition {
 
 interface AssertRule {
   supports(key: string): boolean;
-  createRule(criteria: any): (value: any) => true | string;
+  createRule(criteria: unknown): (value: unknown) => true | string;
 }