c16ba6a7d7
<img width="400" alt="Screenshot 2025-06-10 at 18 14 17" src="https://github.com/user-attachments/assets/05591b46-c36d-45c6-a236-3469c29d7420" /> closes https://github.com/twentyhq/core-team-issues/issues/915 --------- Co-authored-by: Charles Bochet <charles@twenty.com>
16 lines
691 B
TypeScript
16 lines
691 B
TypeScript
import { SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS } from '@/settings/data-model/constants/SettingsCompositeFieldTypeConfigs';
|
|
import { CompositeFieldSubFieldName } from '@/settings/data-model/types/CompositeFieldSubFieldName';
|
|
import { COMPOSITE_FIELD_TYPES } from '@/settings/data-model/types/CompositeFieldType';
|
|
|
|
export const isValidSubFieldName = (
|
|
subFieldName: string,
|
|
): subFieldName is CompositeFieldSubFieldName => {
|
|
const allSubFields = COMPOSITE_FIELD_TYPES.flatMap((compositeFieldType) =>
|
|
SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS[compositeFieldType].subFields.map(
|
|
(subField) => subField.subFieldName,
|
|
),
|
|
);
|
|
|
|
return allSubFields.includes(subFieldName as any);
|
|
};
|