Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect type returned from useLoaderData (changing RenderableTreeNodes into unknown type) #13058

Open
Varkoff opened this issue Feb 19, 2025 · 2 comments
Assignees
Labels

Comments

@Varkoff
Copy link

Varkoff commented Feb 19, 2025

I'm using React Router as a...

framework

Reproduction

Unfortunately Stackblitz does not support Node v20. Check reproduction code here :
https://github.com/Varkoff/react-router-type-error-with-markdoc

Since upgrading to React Router v7.2.0, I've been getting this Type 'unknown' is not assignable to type 'RenderableTreeNodes'.ts(2322) error.

Can you please take a look @pcattori ?

System Info

System:
    OS: macOS 15.3
    CPU: (10) arm64 Apple M2 Pro
    Memory: 84.78 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.9.0 - ~/.nvm/versions/node/v22.9.0/bin/node
    npm: 10.8.3 - ~/.nvm/versions/node/v22.9.0/bin/npm
    pnpm: 9.7.1 - ~/Library/pnpm/pnpm
    bun: 1.1.38 - ~/.bun/bin/bun
    Watchman: 2024.12.02.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 133.0.6943.99
    Safari: 18.3
  npmPackages:
    @react-router/dev: ^7.2.0 => 7.2.0 
    @react-router/express: ^7.2.0 => 7.2.0 
    @react-router/node: ^7.2.0 => 7.2.0 
    @react-router/serve: ^7.2.0 => 7.2.0 
    react-router: ^7.2.0 => 7.2.0 
    vite: ^5.1.0 => 5.4.14

Used Package Manager

npm

Expected Behavior

I would like to not have the type error.

Actual Behavior

I am getting type errors, which prevent me to update code without adding @ts-ignore or @ts-expect-error flags. CI fails.

@Varkoff Varkoff added the bug label Feb 19, 2025
@kroofy
Copy link

kroofy commented Feb 19, 2025

I also experience something similar, for me it is related to sending data typed as Records. Didn’t manage to understand why so I am stuck at 7.1.x.

Were you able find out why this happened to you?

@pcattori
Copy link
Contributor

@Varkoff I'm getting a different error when I clone that repo and try to run npm run typecheck:

❯ npm run typecheck

> typecheck
> react-router typegen && tsc

error TS2688: Cannot find type definition file for '@remix-run/node'.
  The file is in the program because:
    Entry point of type library '@remix-run/node' specified in compilerOptions

  tsconfig.json:13:15
    13     "types": ["@remix-run/node", "vite/client"],
                     ~~~~~~~~~~~~~~~~~
    File is entry point of type library specified here.


Found 1 error.

Not sure why that's happening, haven't dug into it. Any chance you can provide a better reproduction of your issue?

@pcattori pcattori self-assigned this Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants