-
Notifications
You must be signed in to change notification settings - Fork 185
TypeScript declarations #401
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
Comments
I've never done this but a pull-request, even if it's incomplete, would help to get us started. In particular I don't know how to test the coverage of ts declarations in CI. A good starting point is probably the README.md API docs, which is the reference (source of truth). |
Because Plot uses D3 under the hood, I believe this would be preceded by having up to date and well maintained TS declarations for D3. Currently the Definitely Typed package has some pain points that I've run into when using TypeScript with D3, which I imagine would affect the TS declarations for Plot. |
@Fil @clhenrick I've been experimenting with type declarations for Plot, so I'd like to know if any of the pain points that you referred to have been resolved with the recent work on the D3 types. I'm referring to these updates:
|
Thank you for the work you are doing on d3 types! I'd be happy to see your experiments with Plot. |
@Fil Ah, I mixed up my previous reply. I thought that the comment I quoted was from you, but now I see that it was not. Those D3 updates are the work of some other wonderful people. I can't claim any credit for them. I'll create a PR for the Plot type experiments. They are very new, so it will be more of a starting point as you suggested than an actual request to merge. |
Does Plot work with typescript or not? I'm getting errors. |
@sgehrman It does work with typescript, although there are no type declarations (as far as I know). If you want to remove the type errors, what I've done to get it working is to create a file in your project declaring the types. For me that looks like the following: // file /types/untypedDependencies.d.ts
declare module '@observablehq/plot' It would be great to have types to get code completion and better linting though :) |
Same for me.
The project has started converting files to TypeScript, Edit: I was wrong. There are some TS files in a release. |
Fixed in #1320! And more documentation to follow immediately. |
Released in 0.6.5. |
Wow, I just tried these out and they are incredible! The types, documentation, everything! |
Loving this new API 👍, great work all around.
TypeScript declaration files would be a solid UX improvement, making the API surface even more approachable for new comers.
The text was updated successfully, but these errors were encountered: