In this PR, we are refactoring two things: - leverage field.defaultValue for Select and MultiSelect settings form (instead of option.isDefault) - use quoted string (ex: "'USD'") for string default values to embrace backend format --------- Co-authored-by: Thaïs Guigon <guigon.thais@gmail.com>
9 lines
331 B
TypeScript
9 lines
331 B
TypeScript
import { simpleQuotesStringSchema } from '~/utils/validation-schemas/simpleQuotesStringSchema';
|
|
|
|
export const stripSimpleQuotesFromString = <Input extends string>(
|
|
value: Input,
|
|
) =>
|
|
(simpleQuotesStringSchema.safeParse(value).success
|
|
? value.slice(1, -1)
|
|
: value) as Input extends `'${infer Output}'` ? Output : Input;
|