@oneplatformdev/utils 0.0.1 → 0.0.2-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cn/package.json +7 -0
- package/index.d.ts +2 -0
- package/index.mjs +6 -0
- package/isValidReactElement/index.d.ts +1 -0
- package/isValidReactElement/index.mjs +5 -0
- package/isValidReactElement/isValidReactElement.d.ts +18 -0
- package/isValidReactElement/isValidReactElement.mjs +1365 -0
- package/isValidReactElement/package.json +7 -0
- package/package.json +4 -3
- package/.babelrc +0 -12
- package/build/README.md +0 -11
- package/build/index.d.ts +0 -1
- package/build/index.mjs +0 -4
- package/build/package.json +0 -53
- package/eslint.config.cjs +0 -12
- package/project.json +0 -9
- package/src/cn/cn.ts +0 -7
- package/src/cn/index.ts +0 -1
- package/src/index.ts +0 -1
- package/tsconfig.json +0 -18
- package/tsconfig.lib.json +0 -23
- package/vite.config.ts +0 -56
- /package/{build/cn → cn}/cn.d.ts +0 -0
- /package/{build/cn → cn}/cn.mjs +0 -0
- /package/{build/cn → cn}/index.d.ts +0 -0
- /package/{build/cn → cn}/index.mjs +0 -0
package/cn/package.json
ADDED
package/index.d.ts
ADDED
package/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { isValidReactElement as default, isValidReactElement } from './isValidReactElement';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { JSXElementConstructor, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Is Valid React Element.
|
|
5
|
+
*
|
|
6
|
+
* Where {@link ReactNode} represents everything that can be rendered, `ReactElement`
|
|
7
|
+
* only represents JSX.
|
|
8
|
+
* @returns boolean - value is valid react element or not
|
|
9
|
+
* @template Type The type of the component or tag
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* const isValid = isValidReactElement(targetElement);
|
|
14
|
+
* const isValidDiv = isValidReactElement(targetElement, 'div');
|
|
15
|
+
* const isValidButton = isValidReactElement(targetElement, Button);
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare const isValidReactElement: <Type extends string | JSXElementConstructor<any> = string | JSXElementConstructor<any>>(element: ReactNode, type?: Type) => boolean;
|