UNPKG

835 BTypeScriptView Raw
1import { ComponentType } from 'react';
2import { AsElementType } from '@instructure/shared-types';
3interface ComponentWithAsProp {
4 as?: AsElementType;
5 to?: string;
6 href?: string | null;
7 onClick?: ((...args: any) => any) | null;
8}
9/**
10 * ---
11 * category: utilities/react
12 * ---
13 * Get the React element type for a component.
14 *
15 * @module getElementType
16 * @param {ComponentType} Component
17 * @param {Object} props
18 * @param {Function} getDefault an optional function that returns the default element type
19 * @returns {String} the element type
20 */
21declare function getElementType<T extends ComponentWithAsProp>(Component: Omit<ComponentType<T>, 'propTypes'>, props: T, getDefault?: () => AsElementType): AsElementType;
22export default getElementType;
23export { getElementType };
24//# sourceMappingURL=getElementType.d.ts.map
\No newline at end of file