-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Type of useLoaderData<typeof loader>()
doesn’t get inferred when using Yarn PnP
#6994
Comments
useLoaderData<typeof loader>()
doesn’t work well with Yarn PnPuseLoaderData<typeof loader>()
doesn’t get inferred when using Yarn PnP
I have a hunch that the type of |
Did you try wrapping your response in |
The problem is with the underlying type of
|
@markdalgleish good to hear! Semi-relatedly, I think it would be a good idea to upgrade the repository version of Yarn so that it imposes stricter rules on dependencies. (There have been several issues with Yarn that would have been caught by using Yarn 2 or higher.) |
Closed by #7137 |
🤖 Hello there, We just published version Thanks! |
@markdalgleish I installed the nightly version (for all my remix dependencies), but this doesn’t seem to work. The behaviour is the same as before. Did you get a different result? Thanks. |
@lensbart The nightly version has fixed the initial issue where Looks like this might be surfacing an upstream issue? Or am I missing something? |
At this point I find it difficult to help, because it doesn’t match the issue I’m having (TypeScript being seemingly unable to “resolve” the underlying type of |
I would also assume that the issue on the TypeScript playground is unrelated to Yarn PnP? |
Could you share a minimal repo to make sure we're looking at the same thing? I realise the TS playground is unrelated to Yarn PnP, but I was using it to try and see what the expected behaviour should be in a clean environment and was surprised to see a similar issue. |
@markdalgleish Sure! Here you go: https://github.com/nextbook/serialize-from Cmd+click on |
@lensbart Sorry, I meant with the nightly version. |
@markdalgleish my bad. When I upgrade the remix dependencies to I’ll try to come up with a minimal reproduction for the issue I had earlier, after upgrading. |
@markdalgleish Maybe I was confused and did something wrong when posting this message. Using the nightly seems to resolve my initial issue now. Apologies for any time lost. I don’t have the issue with |
What version of Remix are you using?
1.19.1
Are all your remix dependencies & dev-dependencies using the same version?
Steps to Reproduce
yarn create remix
with default settings (my-remix-app
, Just the basics, Remix App Server, TypeScript, runyarn install
)cd my-remix-app
yarn set version berry
yarn
(you should see the message “automatically enabling the compatibility node-modules linker 👍”, a linenodeLinker: node-modules
will be added to.yarnrc.yml
)⇧ ⌘ P
on macOS) →TypeScript: Select TypeScript Version…
→Use Workspace Version
data
is still (correctly)SerializeObject<UndefinedToOptional<{ some: string; }>>
nodeLinker: node-modules
from.yarnrc.yml
(or change it tonodeLinker: pnp
) and runyarn
again. This will remove yournode_modules
folder and enable the Plug‘n’Play module resolution mechanismyarn dlx @yarnpkg/sdks vscode
data
is nowSerializeFrom<T>
.Cmd
+clicking onuseLoaderData
will go to line 114 incomponents.d.ts
:Cmd
+click further onSerializeFrom
.Expected Behavior
The inferred type of
useLoaderData<typeof loader>()
remainsSerializeObject<UndefinedToOptional<{ some: string; }>>
as in step 7Actual Behavior
The inferred type of
useLoaderData<typeof loader>()
isSerializeFrom<T>
as described in step 11The text was updated successfully, but these errors were encountered: