Skip to content

@inertiajs/react unable to build due to type error #2393

@fxnm

Description

@fxnm

Version:

  • @inertiajs/react version: 2.0.13

Describe the problem:

If i try to build my typescript project with strict: true and skipLibCheck: false the build fails because if library internal type errors
The bugs was introduces via #2356

Steps to reproduce:

  1. create a typescript project with inertia
  2. verify that strict: true and skipLibCheck: false are set in the tsconfig.json
  3. build the project

Error Log:

$ run build

> tsc && vite build

node_modules/.pnpm/@inertiajs+react@2.0.13_react@19.1.0/node_modules/@inertiajs/react/types/useForm.d.ts:5:108 - error TS2344: Type 'TForm' does not satisfy the constraint 'Record<any, any>'.

5 export type SetDataAction<TForm> = SetDataByObject<TForm> & SetDataByMethod<TForm> & SetDataByKeyValuePair<TForm>;
                                                                                                             ~~~~~

  node_modules/.pnpm/@inertiajs+react@2.0.13_react@19.1.0/node_modules/@inertiajs/react/types/useForm.d.ts:5:27
    5 export type SetDataAction<TForm> = SetDataByObject<TForm> & SetDataByMethod<TForm> & SetDataByKeyValuePair<TForm>;
                                ~~~~~
    This type parameter might need an `extends Record<any, any>` constraint.


Found 1 error in node_modules/.pnpm/@inertiajs+react@2.0.13_react@19.1.0/node_modules/@inertiajs/react/types/useForm.d.ts:5

 ELIFECYCLE  Command failed with exit code 2.

Process finished with exit code 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    reactRelated to the react adapter

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions