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

TypeScript: useLoaderData is not working properly in 2.9 #9295

Closed
RafalFilipek opened this issue Apr 23, 2024 · 10 comments · Fixed by #9299
Closed

TypeScript: useLoaderData is not working properly in 2.9 #9295

RafalFilipek opened this issue Apr 23, 2024 · 10 comments · Fixed by #9299

Comments

@RafalFilipek
Copy link

Reproduction

https://stackblitz.com/edit/remix-run-remix-yartxj?file=app%2Froutes%2F_index.tsx

System Info

System:
  OS: Linux 5.0 undefined
  CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Memory: 0 Bytes / 0 Bytes
  Shell: 1.0 - /bin/jsh
Binaries:
  Node: 18.18.0 - /usr/local/bin/node
  Yarn: 1.22.19 - /usr/local/bin/yarn
  npm: 10.2.3 - /usr/local/bin/npm
  pnpm: 8.15.3 - /usr/local/bin/pnpm
npmPackages:
  @remix-run/dev: * => 2.9.0 
  @remix-run/node: * => 2.9.0 
  @remix-run/react: * => 2.9.0 
  @remix-run/serve: * => 2.9.0 
  vite: ^5.1.0 => 5.2.10

Used Package Manager

npm

Expected Behavior

Return value should be fully typed like in 2.8

Actual Behavior

For this simple installation, the returned value is typed as any.

I've also checked case with single fetch included in the include key in my tsconfig.json file. In this case, the returned value was unknown

@RafalFilipek RafalFilipek changed the title useLoaderData is not working in 2.9 TypeScript: useLoaderData is not working properly in 2.9 Apr 23, 2024
@RafalFilipek
Copy link
Author

Have you tried downgrading? Because mine still not working even after downgrading.

Yep. Works on 2.8 just fine.

@merthanmerter
Copy link

Have you tried downgrading? Because mine still not working even after downgrading.

Yep. Works on 2.8 just fine.

Sorry for not deleting comment in time. Yea, turns out it was my mistake.

@brophdawg11
Copy link
Contributor

Sorry about this folks! It looks like our TS build is accidentally picking up on the single-fetch.d.ts overrides and causing it to skip outputting some of the existing types because it thinks they're overridden all the time. We'll get a patch release out hopefully early tomorrow.

@brophdawg11
Copy link
Contributor

We just published 2.9.1-pre.0 with a fix if you want to confirm that resolves the issue

@dyeoman2
Copy link

2.9.1-pre.0

2.9.1-pre.0 worked for me. Thanks @brophdawg11

@merthanmerter
Copy link

merthanmerter commented Apr 23, 2024

Its still acting weird.
Thats what return;
image
But thats what I get;
image

@SimeonGriggs
Copy link

We just published 2.9.1-pre.0 with a fix if you want to confirm that resolves the issue

Fixes the issue here!

@brophdawg11
Copy link
Contributor

@merthanmerter Could you provide a reproduction of your issue? defer is being inferred correctly for me (and others) on the prerelease.

Screenshot 2024-04-24 at 11 04 47 AM

@brophdawg11
Copy link
Contributor

This should be resolved in Remix 2.9.1. Please provide minimal reproductions if you're still seeing any type inference issues!

@merthanmerter
Copy link

This should be resolved in Remix 2.9.1. Please provide minimal reproductions if you're still seeing any type inference issues!

Its working with 2.9.1.

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

Successfully merging a pull request may close this issue.

5 participants