Skip to content

Commit cb17c6d

Browse files
committed
fix: typescript error on i18n
1 parent aa9d010 commit cb17c6d

4 files changed

Lines changed: 14 additions & 7 deletions

File tree

apps/catalog-ui/src/components/field/EntityAttributeDateField.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ import {
9595
import type { Dayjs } from 'dayjs';
9696
import type { ValidationRule } from 'quasar';
9797
import { computed, ref, watch } from 'vue';
98+
import type { ComposerTranslation } from 'vue-i18n';
9899
import type {
99100
AttributeFieldProps,
100101
EntityAttributeFieldOutputs,
@@ -125,7 +126,7 @@ const {
125126
upToDate,
126127
validateFromApi,
127128
} = useQuasarFieldValidation(localI18nScope);
128-
const globalT = getI18nInstance().global.t;
129+
const globalT = getI18nInstance().global.t as ComposerTranslation;
129130
130131
const localValue = ref(props.entity[props.definition.name] ?? null);
131132
@@ -156,8 +157,9 @@ watch(
156157
);
157158
158159
const mask = computed(() => {
159-
const maskI18NKey = props.definition.inputSettings?.maskI18NKey;
160+
const maskI18NKey = props.definition.inputSettings?.maskI18NKey as string;
160161
if (getI18nInstance().global.te(maskI18NKey)) {
162+
// @ts-expect-error - dynamic key, ComposerTranslation blows up type instantiation depth
161163
return globalT(maskI18NKey);
162164
}
163165
return props.definition.inputSettings?.mask || QDATE_DEFAULT_MASK;

apps/catalog-ui/src/components/smart-filter/DateSearchFilterPanel.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ import {
120120
} from '@linagora/linid-im-front-corelib';
121121
import type { ValidationRule } from 'quasar';
122122
import { computed, ref } from 'vue';
123+
import type { ComposerTranslation } from 'vue-i18n';
123124
import type {
124125
DateFilterOperatorKey,
125126
DateSearchFilterPanelProps,
@@ -164,9 +165,10 @@ const isNegation = ref(false);
164165
const selectedOperatorKey = ref<DateFilterOperatorKey>('equals');
165166
166167
const computedMask = computed(() => {
167-
const { te, t } = getI18nInstance().global;
168-
if (props.maskI18NKey && te(props.maskI18NKey)) {
169-
return t(props.maskI18NKey);
168+
const globalT = getI18nInstance().global.t as ComposerTranslation;
169+
const globalTe = getI18nInstance().global.te;
170+
if (props.maskI18NKey && globalTe(props.maskI18NKey)) {
171+
return globalT(props.maskI18NKey);
170172
}
171173
return props.mask ?? QDATE_DEFAULT_MASK;
172174
});

apps/catalog-ui/src/federation/module-page-lifecycle.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import {
3535
useLinidZoneStore,
3636
} from '@linagora/linid-im-front-corelib';
3737
import type { ModulePageOptions } from '../types/ModulePageOptions';
38+
import type { ComposerTranslation } from 'vue-i18n';
3839

3940
/**
4041
* Remote module responsible for page integration.
@@ -75,7 +76,7 @@ class ModulePage extends BasicRemoteModule<ModulePageOptions> {
7576
): Promise<ModuleLifecycleResult> {
7677
const uiStore = useLinidUiStore();
7778
const linidZoneStore = useLinidZoneStore();
78-
const { t } = getI18nInstance().global;
79+
const t = getI18nInstance().global.t as ComposerTranslation;
7980

8081
uiStore.addMainNavigationMenuItems({
8182
id: config.instanceId,

apps/module-users/src/module-lifecycle.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {
3434
useLinidUiStore,
3535
} from '@linagora/linid-im-front-corelib';
3636
import type { ModuleUsersOptions } from './types/moduleUsers';
37+
import type { ComposerTranslation } from 'vue-i18n';
3738

3839
/**
3940
* Remote module responsible for user-related features.
@@ -71,7 +72,8 @@ class ModuleUsers extends BasicRemoteModule<ModuleUsersOptions> {
7172
config: ModuleHostConfig<ModuleUsersOptions>
7273
): Promise<ModuleLifecycleResult> {
7374
const uiStore = useLinidUiStore();
74-
const { t } = getI18nInstance().global;
75+
76+
const t = getI18nInstance().global.t as ComposerTranslation;
7577

7678
uiStore.addMainNavigationMenuItems({
7779
id: config.instanceId,

0 commit comments

Comments
 (0)