@madeja-studio/telar
Version:
UI component library by Madeja Studio
21 lines (17 loc) • 541 B
text/typescript
import * as Icons from '@expo/vector-icons';
import React from 'react';
export type IconFamily = keyof typeof Icons;
export type IconReference = {
[K in IconFamily]: {
family: K;
name: React.ComponentPropsWithoutRef<(typeof Icons)[K]>['name'];
};
}[IconFamily];
export const isIconReference = (
maybeIconReference: unknown
): maybeIconReference is IconReference => {
const iconReference = maybeIconReference as IconReference;
return (
iconReference?.family !== undefined && iconReference?.name !== undefined
);
};