From 1865b408808d98fb9d104ce44f407a52a59ccaa6 Mon Sep 17 00:00:00 2001 From: Josh C Date: Fri, 2 Feb 2024 13:55:52 -0500 Subject: [PATCH] fix(react): improve types for AtomProvider (#92) --- .../react/src/components/AtomProvider.tsx | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/packages/react/src/components/AtomProvider.tsx b/packages/react/src/components/AtomProvider.tsx index 546822ef..4968b2ac 100644 --- a/packages/react/src/components/AtomProvider.tsx +++ b/packages/react/src/components/AtomProvider.tsx @@ -1,5 +1,5 @@ import { AnyAtomInstance } from '@zedux/atoms' -import React, { FC, ReactNode } from 'react' +import React, { ReactElement, ReactNode } from 'react' import { useEcosystem } from '../hooks/useEcosystem' import { getReactContext } from '../utils' @@ -15,18 +15,19 @@ import { getReactContext } from '../utils' * dependency on the provided instance via `useAtomInstance()` or manual * graphing inside `useEffect()`. */ -export const AtomProvider: FC< - | { - children?: ReactNode - instance: AnyAtomInstance - instances?: undefined - } - | { - children?: ReactNode - instance?: undefined - instances: AnyAtomInstance[] - } -> = ({ children, instance, instances }) => { +export const AtomProvider: ( + props: + | { + children?: ReactNode + instance: AnyAtomInstance + instances?: undefined + } + | { + children?: ReactNode + instance?: undefined + instances: AnyAtomInstance[] + } +) => ReactElement = ({ children, instance, instances }) => { const ecosystem = useEcosystem() if (DEV && !instance && !instances) {