-
Notifications
You must be signed in to change notification settings - Fork 862
Closed
Labels
Type: BugConfirmed bugConfirmed bug
Description
Describe the Bug
I tried to dynamically import the render function from @react-email/render package with the codes below in NextJS 13.2:
import dynamic from "next/dynamic";
const render = dynamic(() =>
import("@react-email/render").then((mod) => mod.render)
);However, I got errors like this
Argument of type '() => Promise<(component: ReactElement<any, string | JSXElementConstructor<any>>, options?: Options | undefined) => string>' is not assignable to parameter of type 'DynamicOptions<ReactElement<any, string | JSXElementConstructor<any>>> | Loader<ReactElement<any, string | JSXElementConstructor<any>>>'.
Type '() => Promise<(component: ReactElement<any, string | JSXElementConstructor<any>>, options?: Options | undefined) => string>' is not assignable to type '() => LoaderComponent<ReactElement<any, string | JSXElementConstructor<any>>>'.
Type 'Promise<(component: ReactElement<any, string | JSXElementConstructor<any>>, options?: Options | undefined) => string>' is not assignable to type 'LoaderComponent<ReactElement<any, string | JSXElementConstructor<any>>>'.
Type '(component: ReactElement<any, string | JSXElementConstructor<any>>, options?: Options | undefined) => string' is not assignable to type 'ComponentType<ReactElement<any, string | JSXElementConstructor<any>>> | ComponentModule<ReactElement<any, string | JSXElementConstructor<any>>>'.
Type '(component: ReactElement<any, string | JSXElementConstructor<any>>, options?: Options | undefined) => string' is not assignable to type 'FunctionComponent<ReactElement<any, string | JSXElementConstructor<any>>>'.
Type 'string' is not assignable to type 'ReactElement<any, any>'.ts(2345)
(alias) const render: (component: React.ReactElement, options?: Options) => string
export renderWhich package is affected (leave empty if unsure)
@react-email/render
Link to the code that reproduces this issue
see below
To Reproduce
In a next js 13 project, use the codes below to dynamically import the render function.
import dynamic from "next/dynamic";
const render = dynamic(() =>
import("@react-email/render").then((mod) => mod.render)
);Expected Behavior
Render function should be imported with no error.
What's your node version? (if relevant)
No response
Metadata
Metadata
Assignees
Labels
Type: BugConfirmed bugConfirmed bug