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

The inferred type of 'loader' cannot be named without a reference to #9714

Closed
vixalien opened this issue Jul 5, 2024 · 3 comments
Closed

Comments

@vixalien
Copy link

vixalien commented Jul 5, 2024

Reproduction

Install packages with pnpm

Try using the new defineLoader from unstable fetch.

make sure to add

    "types": [
      "@remix-run/react/future/single-fetch.d.ts"
    ]

to tsconfig.json

System Info

System:
    OS: Linux 6.9 Alpine Linux
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
    Memory: 23.21 GB / 31.06 GB
    Container: Yes
    Shell: 5.2.26 - /bin/bash
  Binaries:
    Node: 22.1.0 - ~/.nvm/versions/node/v22.1.0/bin/node
    Yarn: 1.22.22 - ~/.local/share/pnpm/yarn
    npm: 10.7.0 - ~/.nvm/versions/node/v22.1.0/bin/npm
    pnpm: 9.4.0 - ~/.local/share/pnpm/pnpm
  npmPackages:
    @remix-run/dev: ^2.10.2 => 2.10.2 
    @remix-run/eslint-config: ^2.10.2 => 2.10.2 
    @remix-run/node: ^2.10.2 => 2.10.2 
    @remix-run/react: ^2.10.2 => 2.10.2 
    @remix-run/serve: ^2.10.2 => 2.10.2 
    vite: ^5.2.11 => 5.3.3

Used Package Manager

pnpm

Expected Behavior

The code to work correctly

Actual Behavior

I get the following typescript errors:

The inferred type of 'loader' cannot be named without a reference to '.pnpm/@[email protected][email protected]/node_modules/@remix-run/server-runtime/dist/single-fetch'. This is likely not portable. A type annotation is necessary.ts(2742)

The inferred type of 'loader' cannot be named without a reference to '.pnpm/[email protected][email protected]/node_modules/react-router'. This is likely not portable. A type annotation is necessary.ts(2742)

This may be due to pnpm's strict dependencies isolation.

@jansedlon
Copy link

jansedlon commented Jul 17, 2024

Yes this happens to me as well.

PS: btw @vixalien you said you use npm but i can see .pnpm in the errors

@vixalien
Copy link
Author

You're right. That's a mistake from my side

@pcattori pcattori mentioned this issue Aug 28, 2024
5 tasks
@pcattori
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants