Skip to content

Commit

Permalink
fix(react): improve types for AtomProvider (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
bowheart authored Feb 2, 2024
1 parent 3b525e3 commit 1865b40
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions packages/react/src/components/AtomProvider.tsx
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -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) {
Expand Down

0 comments on commit 1865b40

Please sign in to comment.