Morph many to one picker (#14155)
This PR follows the multiSelect PR merged previously. It will enable morph relation Many to One to be handled from the table, using a singleSelect picker Main point : I decided to change the singleSelect API to take an array of **objectMetadataName** instead of only one to deal with both our usecases. --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
+4
-2
@@ -16,7 +16,9 @@ describe('assertIsDefinedOrThrow', () => {
|
||||
});
|
||||
|
||||
it('throws the default error when value is undefined', () => {
|
||||
expect(() => assertIsDefinedOrThrow(undefined)).toThrow('Value not defined');
|
||||
expect(() => assertIsDefinedOrThrow(undefined)).toThrow(
|
||||
'Value not defined',
|
||||
);
|
||||
});
|
||||
|
||||
it('throws the default error when value is null', () => {
|
||||
@@ -38,4 +40,4 @@ describe('assertIsDefinedOrThrow', () => {
|
||||
// After the assertion, TypeScript should treat `maybe` as `string`.
|
||||
expectString(maybe);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4,9 +4,7 @@ import { isDefined } from '@/utils';
|
||||
// eslint-disable-next-line prefer-arrow/prefer-arrow-functions
|
||||
export function assertIsDefinedOrThrow<T>(
|
||||
value: T | undefined | null,
|
||||
exceptionToThrow: Error = new Error(
|
||||
'Value not defined',
|
||||
),
|
||||
exceptionToThrow: Error = new Error('Value not defined'),
|
||||
): asserts value is T {
|
||||
if (!isDefined(value)) throw exceptionToThrow;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user