/
githubmirror
/
ydb-embedded-ui
Обзор
Документация
Войти
/
githubmirror
/
ydb-embedded-ui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/components/slots/utils.ts
15 строк
493 B
Valerii Sidorenko
feat!: update to uikit 6 (#789)
10 апр 2024, 16:48
Не верифицирован
10 апр 2024, 16:48
1a3154d
Код
Авторство
О чём код?
import React from 'react'; import type {SlotComponent} from './types'; export function isSlotElement<P = {}, Type = never>( node: React.ReactNode, ): node is React.ReactElement<P, SlotComponent<P>> & {ref?: React.Ref<Type>} { return React.isValidElement(node) && isSlotComponent(node.type); } export function isSlotComponent<T = {}>( type: string | React.JSXElementConstructor<any>, ): type is SlotComponent<T> { return typeof type === 'function' && '__slotName' in type; }