Skip to content

Commit 136acde

Browse files
committed
rax: fix JSX RaxFragment usage/export
Typescript 5.7 will fail unless usage of RaxFragment is explicit, with an import of it and a `/** @jsxFrag RaxFragment */` pragma at the top of the file. This PR adds that. RaxFragment also needs to have an exported value. I wasn't sure what to use here so I copied preact, since preact is used in the Typescript handbook as an example: ```ts export const RaxFragment: FunctionComponent<{}> ``` Notably, though, the preact source has a comment indicating that *they're* not sure of the correct type either. Here is the Typescript 5.7 PR that made this error appear: microsoft/TypeScript#59933
1 parent 24a32d6 commit 136acde

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

types/rax/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ declare namespace Rax {
211211
interface RaxNodeArray extends Array<RaxNode> {}
212212
type RaxFragment = {} | RaxNodeArray;
213213
type RaxNode = RaxChild | RaxFragment | RaxPortal | boolean | null | undefined;
214+
export const RaxFragment: FunctionComponent<{}>
214215

215216
/**
216217
* ======================================================================

types/rax/test/hooks.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
/** @jsxFrag RaxFragment */
12
import {
23
ComponentRef,
34
createContext,
45
createRef,
56
forwardRef,
67
MutableRefObject,
78
RaxNode,
9+
RaxFragment,
810
Ref,
911
RefObject,
1012
useCallback,

0 commit comments

Comments
 (0)