import { RNRiveError, RNRiveErrorType } from './types'; export type Without = { [P in Exclude]?: never }; export type XOR = T | U extends object ? (Without & U) | (Without & T) : T | U; export function isEnum( enumType: EnumType, enumValue: string ): enumValue is EnumType[keyof EnumType] { return Object.values(enumType).includes(enumValue); } export function convertErrorFromNativeToRN(errorFromNative: { type: string; message: string; }): RNRiveError | null { if (isEnum(RNRiveErrorType, errorFromNative.type)) { return { type: errorFromNative.type, message: errorFromNative.message, }; } return null; }