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

esm.sh types are not picked up #875

Closed
rgripper opened this issue Jul 3, 2023 · 6 comments
Closed

esm.sh types are not picked up #875

rgripper opened this issue Jul 3, 2023 · 6 comments
Labels
fresh Something is not working with Fresh needs info

Comments

@rgripper
Copy link

rgripper commented Jul 3, 2023

Describe the bug
When generating a new Fresh 1.2.0 project, JSX and any library imported from esm.sh do not have types loaded, while the tooltip shows the correct types url following which types can be downloaded and work locally if copied.
npm: and denoland-based packages are working fine.

image

To Reproduce

  1. Create a new Fresh 1.2.0 project using the getting-started page
deno run -A -r https://fresh.deno.dev
cd fresh-project
deno task start
  1. open in VSCode
  2. hover over imports syntax: esm.sh-based imports provide no autocompletion and tooltip on the used types does not contain any signatures

Expected behavior

When I use imports, autocompletion works and tooltips show signatures

image

Screenshots

image

Versions

vscode: 1.79.2 deno: 1.34.3 extension: 3.19.1

@bartlomieju bartlomieju added bug Something isn't working fresh Something is not working with Fresh labels Jul 10, 2023
@mazniak
Copy link

mazniak commented Jul 11, 2023

I am experiencing this same issue independent of Fresh. Just set up an empty directory, run deno init and change the main.ts to something like (after running npm i stripe)

import Stripe from "npm:stripe";

import Stripe2 from "https://esm.sh/[email protected]";

type t = Stripe.Price['id']
type u = Stripe2.Price['id']

The npm import has correct type info eg
a

While the esm.sh import is nonsense

b

I see nothing in the error or server logs to indicate an issue or error.

Some esm.sh imports do work:

import merge from "https://esm.sh/[email protected]";

c

I have no idea why though

@deckchairlabs
Copy link

Yeah this makes it basically unusable.

image

@deckchairlabs deckchairlabs mentioned this issue Jul 12, 2023
17 tasks
@dsherret dsherret added needs info and removed bug Something isn't working labels Jul 13, 2023
@dsherret
Copy link
Member

I tried this and it works fine for me:

image

This may have been a temporary issue with esm.sh and might be related to denoland/fresh#1420 -- Can you try running the following if using fresh?

deno run -A -r --watch=static/,routes/ dev.ts

If that doesn't work, are there any other details you can provide? Do you have any errors in the output window (View -> Output -> Select "Deno Language Server" in the drop down)?

@mazniak that is an issue with the esm.sh/stripe module. It's because of stripe/stripe-node#1636 -- the npm specifier handles it, but currently esm.sh does not.

@deckchairlabs if you get the chance, please open a specific issue outlining the problem. I'm not sure how to reproduce that screenshot because I don't know what those bare specifiers map to. Also, try running...

deno check -r --all your_script_goes_here.ts

...then see if there are any type checking errors. Running with deno check --all on the command line is a good way to diagnose type checking issues because it will type check everything including remote modules.

@deckchairlabs
Copy link

I tried this and it works fine for me:

image

This may have been a temporary issue with esm.sh and might be related to denoland/fresh#1420 -- Can you try running the following if using fresh?

deno run -A -r --watch=static/,routes/ dev.ts

If that doesn't work, are there any other details you can provide? Do you have any errors in the output window (View -> Output -> Select "Deno Language Server" in the drop down)?

@mazniak that is an issue with the esm.sh/stripe module. It's because of stripe/stripe-node#1636 -- the npm specifier handles it, but currently esm.sh does not.

@deckchairlabs if you get the chance, please open a specific issue outlining the problem. I'm not sure how to reproduce that screenshot because I don't know what those bare specifiers map to. Also, try running...

deno check -r --all your_script_goes_here.ts

...then see if there are any type checking errors. Running with deno check --all on the command line is a good way to diagnose type checking issues because it will type check everything including remote modules.

Yeah does seem to be an issue on my end, theres no way to run check and it spits out all the type definitions loaded? Or run an info and try and find the culprit that way?

@rgripper
Copy link
Author

I'll only be able to check next Friday

@rgripper
Copy link
Author

I reloaded deno cache and all types are picked up now👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fresh Something is not working with Fresh needs info
Projects
None yet
Development

No branches or pull requests

5 participants