-
Notifications
You must be signed in to change notification settings - Fork 185
Type declarations #998
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 declarations #998
Conversation
Adds basic declaration files generated by `tsc`.
This work also needs far more documentation, IMO. My intention was to use docblocks that can be parsed for intellisense in editors and by documentation generators. |
Hi Kent, Thanks for the contribution! Your PR is a really useful reference (specifically for the files that you paid special attention to) and thank you for reporting bugs to Our plan is as follows:
We'll welcome small-scale suggestions (rather than the bulk output of |
closing this, but I second what Duane says :) |
The roadmap sounds like a solid approach. Having the documentation in the code as a single source of truth will probably reduce the overall maintenance burden. Perhaps ObservableHQ.com will incorporate intellisense & TypeScript in the javascript editor down the road :-). As an ObservableHQ.com user myself, I think it would be as useful there as it is in the IDE. Auto-generating the README is a worthy goal. Modularizing the docs across multiple files instead of a monolithic README might make it more digestible or open the door for a streamlined mechanism of auto-updating documentation snippets in example / tutorial notebooks on ObservableHQ. This work I've done on type declarations is as much for my own purposes, so I started with the files related to the Plot features that I was using. I'll pull in |
TypeScript declarations added in #1320. |
Here's my experimentation with declarations in case it's useful.
IMO this work is too rough to merge, but I defer to the maintainers. It needs thorough review by people who are more familiar with the Plot API and TypeScript than I am. It may conflict with the TypeScript work that's already been done.
I created the base files with
tsc
and then built out a handful of them. Most are still in that initial raw output state.My goal was to create generics that would derive the allowed mark options based on the mark type, as well as utility types for readability, code reuse, etc.
It needs more tests. I stopped writing tests as the complexity increased, until it can be reviewed for correctness.
I started to incorporate the d3 scales types from DefinitelyTyped, but I saw possible errors with them. Reported here.
Related to #401.
Ping @duaneatat.