import { nullableNumberConverter } from '@ni/fast-element';
/**
 * Converts a Mapping key (which is a string when configured in HTML) to the
 * given keyType. The converted value can then be used to compare against
 * values in the table data.
 */
export const resolveKeyWithType = (key, keyType) => {
    if (keyType === 'number') {
        const converted = nullableNumberConverter.fromView(key);
        return converted === null ? undefined : converted;
    }
    if (keyType === 'boolean') {
        if (key === false || key === 'false') {
            return false;
        }
        if (key === true || key === 'true') {
            return true;
        }
        return undefined;
    }
    return key?.toString() ?? undefined;
};
//# sourceMappingURL=mapping-key-resolver.js.map