@yandex/ui
Version:
Yandex UI components
15 lines (14 loc) • 408 B
JavaScript
/**
* Определяем Union не пустой
*
* Чтобы затем отфильтровать конструкции вида:
* ... as Component<IButtonProps &
* (
* )
*/
module.exports.isNotEmptyUnion = (node) => {
if (node.type === 'TSParenthesizedType' && node.typeAnnotation.type === 'TSUnionType') {
return node.typeAnnotation.types.length > 0;
}
return true;
};