Skip to content

Issue with return type of render function as defined in tab_loop types. #6075

@cramer-vw

Description

@cramer-vw

Hi! 👋

During transpilation of react-datepicker in my projects context (currently running react18) I am running into an issue with the typings:

src/tab_loop.tsx defines a render function without providing a concrete return type. It seems that tsc creates a wrong return type in this circumstance.

For reasons not completely clear to me it defines the return types as possibly containing bigint which causes a "invalid return type" on the render method during transpiling.

Here is the diff that solved my problem:

diff --git a/node_modules/react-datepicker/dist/tab_loop.d.ts b/node_modules/react-datepicker/dist/tab_loop.d.ts
index 51bef50..3d6394a 100644
--- a/node_modules/react-datepicker/dist/tab_loop.d.ts
+++ b/node_modules/react-datepicker/dist/tab_loop.d.ts
@@ -40,6 +40,5 @@ export default class TabLoop extends Component<TabLoopProps> {
     getTabChildren: () => any[];
     handleFocusStart: () => void;
     handleFocusEnd: () => void;
-    render(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
 }
 export {};

As I am not 100% positive why the types a generated that way I can only guess that changing L.88 intab_toop.tsxto render(): JSX.Element { would probably fix the issue.

Thanks for your help in this.
Sebastian

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions