-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Broken build for @types/d3 #116
Comments
Yes Skypack currently doesn’t serve types-only packages, as currently TypeScript has trouble loading them. If you‘re using Deno, we recommend adding How are you using the types package for D3? Just out of curiosity |
I think I tried that, and it failed, so I was trying to hack around it by just importing the types. Trying to export d3 that why I get:
where I'm just doing
In this particular instance I have functions that a scale, in this case particularly a |
Ah I see. Yes you’re right—there seems to be a bug in packages that rely on external types from DefinitelyTyped, which d3 does. I’ve located the fix, and it should be in production soon! Sorry for the inconvenience. |
Hey @drwpow do you know if there's a way to download the declarations from skypack (to get round the remote declarations problem)? I guess this would need some sort of crawler and I don't know if that exists |
Sort of. If you request |
Yep, the issue I noticed is some declaration files have relative paths to others. So it doesn’t seem as simple as just downloading the file the header points to. It looks like there would need to be some crawler that also fetches sub dependencies, and from what I can tell no such crawler exists (apart from the one built into Deno) |
Correct—Deno does the crawling. For the JS modules themselves this works very well if you think about it—everything is all browser-powered and the browser just tells us what it needs. But as you’ve pointed out this is the opposite of what TypeScript needs, and it’s hard to know from the CDN end every single type that’s needed for your app. We’re really hoping with all the recent browser additions TS starts supporting URLs soon 🤞 but I’ve caught no wind of the TS team putting that on the roadmap. |
I’m not sure I follow this bit.
yeah I find it unlikely to happen anytime soon, which is why I was wondering if there’s any possibility of some interim. Something that can crawl and get declarations and download them to a local adjacent file. |
Sorry; probably worth explaining that many type definitions actually need dependencies. Many type definitions aren’t self-contained like this. For example, So if you were trying to download the types only for react, you’d find you need to crawl at least 4 packages to get everything (this is all done for you in an npm install). So the problem is trickier than it seems at first glance: many packages’ types are spread across multiple packages. |
d3 typescript types seem to be broken. Going off the "build" I pulled just now the "warning" message is
I'm not exactly sure why this is, some of the other independent d3 libraries also have broken types. The definition of that declaration file just re-exports the others.
The text was updated successfully, but these errors were encountered: