diff --git a/.changeset/wicked-mails-check.md b/.changeset/wicked-mails-check.md
new file mode 100644
index 000000000..f397188a7
--- /dev/null
+++ b/.changeset/wicked-mails-check.md
@@ -0,0 +1,5 @@
+---
+"@suspensive/react": patch
+---
+
+fix(react): change return type of Consumers as JSX.Element
diff --git a/packages/react-query/src/SuspenseInfiniteQuery.test-d.tsx b/packages/react-query/src/SuspenseInfiniteQuery.test-d.tsx
index afd4601b1..80a7c6829 100644
--- a/packages/react-query/src/SuspenseInfiniteQuery.test-d.tsx
+++ b/packages/react-query/src/SuspenseInfiniteQuery.test-d.tsx
@@ -1,5 +1,6 @@
import { queryFn, queryKey } from '@suspensive/test-utils'
import type { InfiniteData } from '@tanstack/react-query'
+import type { ReactNode } from 'react'
import { describe, expectTypeOf, it } from 'vitest'
import { SuspenseInfiniteQuery } from './SuspenseInfiniteQuery'
import type { UseSuspenseInfiniteQueryResult } from './useSuspenseInfiniteQuery'
@@ -92,5 +93,10 @@ describe('', () => {
{() => <>>}
).toEqualTypeOf()
+ expectTypeOf(
+
+ {() => <>>}
+
+ ).not.toEqualTypeOf()
})
})
diff --git a/packages/react-query/src/SuspenseQuery.test-d.tsx b/packages/react-query/src/SuspenseQuery.test-d.tsx
index d8f315c32..b016432dc 100644
--- a/packages/react-query/src/SuspenseQuery.test-d.tsx
+++ b/packages/react-query/src/SuspenseQuery.test-d.tsx
@@ -1,4 +1,5 @@
import { queryFn, queryKey } from '@suspensive/test-utils'
+import type { ReactNode } from 'react'
import { describe, expectTypeOf, it } from 'vitest'
import { SuspenseQuery } from './SuspenseQuery'
import type { UseSuspenseQueryResult } from './useSuspenseQuery'
@@ -84,5 +85,10 @@ describe('', () => {
{() => <>>}
).toEqualTypeOf()
+ expectTypeOf(
+
+ {() => <>>}
+
+ ).not.toEqualTypeOf()
})
})
diff --git a/packages/react/src/ErrorBoundary.test-d.tsx b/packages/react/src/ErrorBoundary.test-d.tsx
index a3017fec6..c05c23c75 100644
--- a/packages/react/src/ErrorBoundary.test-d.tsx
+++ b/packages/react/src/ErrorBoundary.test-d.tsx
@@ -1,5 +1,5 @@
import { CustomError, CustomNotError } from '@suspensive/test-utils'
-import type { ComponentProps } from 'react'
+import type { ComponentProps, ReactNode } from 'react'
import { ErrorBoundary } from './ErrorBoundary'
import type { ConstructorType } from './utility-types'
@@ -34,4 +34,9 @@ describe('', () => {
>
)
})
+
+ it('type check', () => {
+ expectTypeOf({() => <>>}).toEqualTypeOf()
+ expectTypeOf({() => <>>}).not.toEqualTypeOf()
+ })
})
diff --git a/packages/react/src/ErrorBoundary.tsx b/packages/react/src/ErrorBoundary.tsx
index d7f9cd4a3..061b8a646 100644
--- a/packages/react/src/ErrorBoundary.tsx
+++ b/packages/react/src/ErrorBoundary.tsx
@@ -181,8 +181,9 @@ export const ErrorBoundary = Object.assign(
return ErrorBoundary
})(),
{
- Consumer: ({ children }: { children: (errorBoundary: ReturnType) => ReactNode }) =>
- children(useErrorBoundary()),
+ Consumer: ({ children }: { children: (errorBoundary: ReturnType) => ReactNode }) => (
+ <>{children(useErrorBoundary())}>
+ ),
}
)
diff --git a/packages/react/src/ErrorBoundaryGroup.test-d.tsx b/packages/react/src/ErrorBoundaryGroup.test-d.tsx
new file mode 100644
index 000000000..25f77ef72
--- /dev/null
+++ b/packages/react/src/ErrorBoundaryGroup.test-d.tsx
@@ -0,0 +1,11 @@
+import type { ReactNode } from 'react'
+import { ErrorBoundaryGroup } from './ErrorBoundaryGroup'
+
+describe('ErrorBoundaryGroup', () => {
+ it('type check', () => {
+ expectTypeOf({() => <>>}).toEqualTypeOf()
+ expectTypeOf(
+ {() => <>>}
+ ).not.toEqualTypeOf()
+ })
+})
diff --git a/packages/react/src/ErrorBoundaryGroup.tsx b/packages/react/src/ErrorBoundaryGroup.tsx
index 0bc271e04..13c942f7e 100644
--- a/packages/react/src/ErrorBoundaryGroup.tsx
+++ b/packages/react/src/ErrorBoundaryGroup.tsx
@@ -59,7 +59,7 @@ export const ErrorBoundaryGroup = Object.assign(
children,
}: {
children: (errorBoundaryGroup: ReturnType) => ReactNode
- }) => children(useErrorBoundaryGroup()),
+ }) => <>{children(useErrorBoundaryGroup())}>,
}
)